Expand description
Pure graph algorithms for dependency analysis.
Operates on abstract graphs represented as adjacency lists
(HashMap<String, HashSet<String>>). No filesystem, CLI, or
normalize-specific types.
Algorithms: Tarjan SCC, bridge-finding, diamond detection, transitive edge detection, longest chains, weakly connected components.
Structs§
- Blast
Radius - Blast radius summary statistics (modules graph only).
- Bridge
Edge - A bridge edge whose removal disconnects the graph.
- Dependent
Entry - A file that depends on the query target (modules graph only).
- Dependents
Report - Report for reverse dependency queries: what depends on a given file/symbol.
- Diamond
- A diamond dependency: source imports left and right, both import target.
- Graph
Report - Full graph analysis report.
- Graph
Stats - Overall graph statistics.
- Import
Chain - A deep import chain (longest dependency path).
- Scc
- A strongly connected component (circular-dependency cluster).
- Transitive
Edge - A transitive (redundant) import: A→C is redundant because A→B→C.
Enums§
- Graph
Target - What the graph nodes represent.
Functions§
- all_
nodes - Collect all nodes from the import graph.
- analyze_
graph_ data - Analyze graph-theoretic properties of an abstract dependency graph.
- count_
transitive_ edges - Count all transitive edges (without limit, for stats).
- edge_
count - Count directed edges.
- find_
bridges - Bridge finding via Tarjan’s bridge algorithm on the undirected view. Only report bridges where exactly one directed edge exists (bidirectional ≠ bridge).
- find_
dead_ nodes - Find nodes with no inbound edges (nothing imports/calls them) that do have outbound edges (they import/call something). These are unreachable internal nodes — potential dead code. Entry points (main.rs, lib.rs) are included; callers can filter based on their heuristics.
- find_
dependents - Find all nodes that (transitively) depend on
targetvia BFS on the reverse graph. Returns a sorted list excluding the target itself. - find_
diamonds - Diamond detection: for each node A with imports {B₁,B₂,…}, check pairs for shared targets.
- find_
longest_ chains - Find the longest import chains (dependency paths) in the graph.
- find_
sccs - Find nontrivial SCCs (size > 1) with internal edge counts.
- find_
transitive_ edges - Transitive edge detection: A→C is redundant if ∃B: A→B and B→C.
- longest_
path_ from - Find the longest path from a node using DFS with memoization.
- reverse_
graph - Build the reverse (transposed) graph: edges point from target to source.
- tarjan_
sccs - Iterative Tarjan’s SCC algorithm.
- weakly_
connected_ components - Weakly connected components via BFS on the undirected view.