Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
d4bd6bb
Rename depconv I/O format flags
Notgnoshi Feb 14, 2026
0b05835
Move I/O format resolution into depgraph crate
Notgnoshi Feb 14, 2026
90e9139
Make NodeInfo::label non-optional
Notgnoshi Feb 14, 2026
91f5fcc
Stub out depfilter CLI arguments
Notgnoshi Feb 14, 2026
bbbce89
Add FlatGraphView petgraph helper for ease of algorithms on DepGraph
Notgnoshi Feb 14, 2026
389d21b
Move around public types in lib.rs
Notgnoshi Feb 14, 2026
b4f9df3
Add select, filter skeletons
Notgnoshi Feb 14, 2026
db0beae
Implement basic selection
Notgnoshi Feb 14, 2026
2aa23e9
Add root identification and BFS traversal utilities
Notgnoshi Feb 14, 2026
603de8b
Add depth and direction options to select algorithm
Notgnoshi Feb 14, 2026
1408227
Make some depfilter integration tests into unit tests
Notgnoshi Feb 14, 2026
f1e70dd
Implement basic filtering
Notgnoshi Feb 14, 2026
ca074ad
Add deps and ancestor cascade to filter
Notgnoshi Feb 14, 2026
dc99ab8
Add connectivity preservation to filter
Notgnoshi Feb 14, 2026
26be45b
Fix bug if both --deps and --ancestors are given
Notgnoshi Feb 15, 2026
a9a41ed
Fix connectivity preservation involving subgraphs
Notgnoshi Feb 15, 2026
927b341
Add more tests around sugraphs and connectivity preservation
Notgnoshi Feb 15, 2026
bcc4661
Add internal mutable cache to DepGraph accessors
Notgnoshi Feb 15, 2026
28de19a
Fix integration test feature gating
Notgnoshi Feb 15, 2026
ca7b27f
Add depfilter blurb to README
Notgnoshi Feb 15, 2026
1f63ab0
Fix behavior when no arguments are passed to select
Notgnoshi Feb 15, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ mermaid-rs-renderer = { version = "0.1.2", default-features = false }
itertools-num = "0.1.3"
kernel-density-estimation = "0.2.0"
ordered-float = "5.0.0"
petgraph = "0.7"
pathdiff = "0.2.3"
serde = { version = "1.0.217", features = ["derive"] }
serde_json = "1"
Expand Down
62 changes: 47 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,18 +176,19 @@ Multiple options are available to customize and tune the output. See `minpath --
## depconv

Convert dependency graphs between formats. Reads from stdin or a file, writes to stdout or a file.
Input and output formats are auto-detected from file extensions or content when `--from`/`--to` are
not specified. Defaults to DOT output when no output format can be inferred.
Input and output formats are auto-detected from file extensions or content when
`--input-format`/`--output-format` are not specified. Defaults to DOT output when no output format
can be inferred.

```sh
$ echo -e "a Node A\nb Node B\n#\na b depends on" | depconv --to dot
$ echo -e "a Node A\nb Node B\n#\na b depends on" | depconv --output-format dot
digraph {
a [label="Node A"]
b [label="Node B"]
a -> b [label="depends on"]
}

$ cargo tree --depth 1 | depconv --to tgf
$ cargo tree --depth 1 | depconv --output-format tgf
csvizmo v0.1.0
clap v4.5.39
...
Expand All @@ -198,16 +199,16 @@ csvizmo v0.1.0 clap v4.5.39

### Supported formats

| Format | `--from` | `--to` | Description |
| -------------- | :------: | :----: | ------------------------------------------------------------------------------- |
| DOT (GraphViz) | yes | yes | `digraph` / `graph` syntax. Parses cmake, ninja, bitbake, and ad-hoc DOT output |
| Mermaid | yes | yes | `flowchart` / `graph` graph types |
| TGF | yes | yes | Trivial Graph Format |
| Depfile | yes | yes | Makefile `.d` depfile |
| Tree | yes | yes | Box-drawing trees (`tree` CLI output) |
| Pathlist | yes | yes | One path per line; hierarchy inferred from `/` separators |
| Cargo tree | yes | -- | `cargo tree` output |
| Cargo metadata | yes | -- | `cargo metadata --format-version=1` JSON |
| Format | `--input-format` | `--output-format` | Description |
| -------------- | :--------------: | :---------------: | ------------------------------------------------------------------------------- |
| DOT (GraphViz) | yes | yes | `digraph` / `graph` syntax. Parses cmake, ninja, bitbake, and ad-hoc DOT output |
| Mermaid | yes | yes | `flowchart` / `graph` graph types |
| TGF | yes | yes | Trivial Graph Format |
| Depfile | yes | yes | Makefile `.d` depfile |
| Tree | yes | yes | Box-drawing trees (`tree` CLI output) |
| Pathlist | yes | yes | One path per line; hierarchy inferred from `/` separators |
| Cargo tree | yes | -- | `cargo tree` output |
| Cargo metadata | yes | -- | `cargo metadata --format-version=1` JSON |

### What's preserved across formats

Expand All @@ -229,11 +230,42 @@ Converting from a rich format (DOT, cargo metadata) to a simpler one (TGF, depfi
unsupported attributes. Converting in the other direction preserves graph topology but cannot
recover lost metadata.

> [!NOTE] DOT parsing requires building with `--features dot`, which pulls in the `dot-parser` crate
> [!NOTE]
>
> DOT parsing requires building with `--features dot`, which pulls in the `dot-parser` crate
> (GPL-2.0). The default build does not include this feature and is MIT-licensed. When built with
> `--features dot`, the resulting binary is GPL-2.0. DOT _emitting_ is always available (custom
> string formatting, no GPL dependency).

## depfilter

Filter or select subsets of dependency graphs. Works on the same formats as `depconv`, and is
designed to be chained with pipes.

* `depfilter select` keeps only nodes matching the given patterns
* `depfilter filter` removes nodes matching the given patterns

Both subcommands have extra options to tune their behavior.

```sh
# From a cargo dependency tree, select the subtree rooted at "clap", then filter out
# all the proc-macro crates and their dependencies:
$ cargo tree --depth 10 \
| depfilter select -p "clap*" --deps -I cargo-tree -O tgf \
| depfilter filter -p "*derive*" -p "*proc*" --deps -I tgf -O dot
digraph {
clap [label="v4.5.57 clap"];
clap_builder [label="v4.5.57 clap_builder"];
anstream [label="v0.6.21 anstream"];
...
}
```

> [!NOTE]
>
> The `depfilter` tool shares the same GPL-2.0 license caveat as `depconv` with respect to
> DOT parsing.

## can2csv

Parse basic data from a CAN frame into a CSV record. Faster than `sed`, and also parses the canid.
Expand Down
2 changes: 2 additions & 0 deletions crates/csvizmo-depgraph/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ csvizmo-utils.workspace = true
dot-parser = { workspace = true, optional = true }
either = { workspace = true, optional = true }
eyre.workspace = true
globset.workspace = true
indexmap.workspace = true
petgraph.workspace = true
mermaid-rs-renderer.workspace = true
serde.workspace = true
serde_json.workspace = true
Expand Down
Loading