Skip to main content

Module graph

Module graph 

Source
Expand description

Dependency graph module for cross-file and symbol-level analysis.

This module provides graph data structures and algorithms for analyzing dependencies between source files and their contained symbols. It supports:

  • Building a directed graph from extracted symbols
  • Computing strongly connected components (SCCs)
  • Providing deployability hints based on cycle detection

§Design as stated in RFC 0008

The graph layer sits between the extraction layer and the output layer:

  • node.rs defines FileNode and SymbolNode types
  • edge.rs defines EdgeKind (Ownership, Import, Reference)
  • builder.rs provides GraphBuilder for incremental construction
  • scc.rs provides SCC analysis via Tarjan’s algorithm

§Example

use meta_ast::graph::{GraphBuilder, SccAnalysis, CodeGraph};
use meta_ast::model::SnapshotId;

// Create builder and add files/symbols
let mut builder = GraphBuilder::new(SnapshotId::new(1).unwrap());
// ... add nodes and edges ...
let graph = builder.build();

// Run SCC analysis
let scc = SccAnalysis::analyze(graph.graph());

Re-exports§

pub use builder::AnalysisParts;
pub use builder::GraphBuilder;
pub use edge::ConfidenceTier;
pub use edge::EdgeData;
pub use edge::EdgeKind;
pub use edge::confidence_tier;
pub use node::DataGraphNode;
pub use node::ExternalClassification;
pub use node::ExternalNode;
pub use node::FileNode;
pub use node::NodeData;
pub use node::SymbolNode;
pub use scc::DeployabilityHint;
pub use scc::Scc;
pub use scc::SccAnalysis;

Modules§

builder
Graph builder for incremental construction from extraction results.
edge
Edge types for the dependency graph.
naming
Canonical names of graph nodes.
node
Graph node types for the dependency graph.
resolver
Reference resolution via FlattenedScopeCache.
scc
SCC (Strongly Connected Components) analysis for dependency graphs.

Structs§

CodeGraph
The canonical dependency graph for a codebase snapshot.