Skip to main content

Crate arbor_graph

Crate arbor_graph 

Source
Expand description

Arbor Graph - Code relationship management

This crate manages the graph of code entities and their relationships. It provides fast lookups, traversals, and centrality scoring for prioritizing context in AI queries.

§Architecture

The graph uses petgraph internally with additional indexes for:

  • Name-based lookups
  • File-based grouping (for incremental updates)
  • Kind-based filtering

§Example

use arbor_graph::ArborGraph;
use arbor_core::{CodeNode, NodeKind};

let mut graph = ArborGraph::new();

// Add nodes from parsing
let node = CodeNode::new("validate", "UserService.validate", NodeKind::Method, "user.rs");
let id = graph.add_node(node);

// Query the graph
let matches = graph.find_by_name("validate");

Re-exports§

pub use lexicon::stem;
pub use lexicon::tokenize_identifier;
pub use lexicon::Lexicon;
pub use store::GraphStore;
pub use store::StoreError;
pub use symbol_table::Resolution;
pub use symbol_table::SymbolEntry;
pub use symbol_table::SymbolTable;

Modules§

lexicon
Identifier tokenization and a code-domain synonym lexicon.
store
symbol_table
Cross-file symbol resolution.

Structs§

AffectedNode
A node affected by a change to the target.
AnalysisWarning
Warnings about analysis limitations
ArborGraph
The code relationship graph.
BlastRadiusSummary
Summary of blast radius for changed files (matches CLI arbor diff output).
CentralityScores
Centrality scores in two forms.
ChangedRange
A contiguous run of changed lines within one file.
ChangedSymbols
Symbols touched by a set of changed line ranges.
ConfidenceExplanation
Reasons explaining the confidence level
ContextNode
A node included in the context slice.
ContextSlice
Result of a context slicing operation.
DependentInfo
Information about a dependent node.
Edge
An edge in the code graph with location info.
GraphBuilder
Builds an ArborGraph from parsed code nodes.
GraphEdge
A simplified edge for graph export/visualization.
HeuristicsMatcher
Pattern matchers for different frameworks and languages
ImpactAnalysis
Complete impact analysis result.
ImpactResult
Result of an impact analysis query.
NodeInfo
Basic information about a node.
QueryResult
Result of a context query.
SearchHit
A ranked search hit.
SearchIndex
An inverted index over symbol names, tokens, and documentation.
UncertainEdge
An edge that might exist at runtime but cannot be proven statically

Enums§

ConfidenceLevel
Confidence level for an analysis result
EdgeKind
The type of relationship between two code entities.
ImpactDirection
Direction of impact from the target node.
ImpactSeverity
Severity of impact based on hop distance from target.
MatchKind
How a symbol matched a query, strongest first.
NodeRole
Node role classification
TruncationReason
Reason for stopping context collection.
UncertainEdgeKind
Types of uncertain edges

Functions§

changed_node_ids
Collect node IDs whose files appear in the changed-files list.
changed_node_ids_for_ranges
Collect node IDs whose line spans overlap the given changed ranges.
compute_blast_radius
Compute blast radius summary from an indexed graph and changed file list.
compute_centrality
Computes production-aware centrality scores for all nodes in the graph.
compute_centrality_warm
Like compute_centrality, but seeds the iteration from a previous score map (e.g. ArborGraph::centrality_map) instead of a uniform start.
detect_analysis_limitations
Check for common patterns that limit static analysis accuracy
node_matches_changed_file
Whether a graph node’s file path matches a git-changed path.
parse_unified_diff_ranges
Extract changed line ranges from a unified diff patch for one file.

Type Aliases§

NodeId
Unique identifier for a node in the graph.