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§
- Affected
Node - A node affected by a change to the target.
- Analysis
Warning - Warnings about analysis limitations
- Arbor
Graph - The code relationship graph.
- Blast
Radius Summary - Summary of blast radius for changed files (matches CLI
arbor diffoutput). - Centrality
Scores - Centrality scores in two forms.
- Changed
Range - A contiguous run of changed lines within one file.
- Changed
Symbols - Symbols touched by a set of changed line ranges.
- Confidence
Explanation - Reasons explaining the confidence level
- Context
Node - A node included in the context slice.
- Context
Slice - Result of a context slicing operation.
- Dependent
Info - Information about a dependent node.
- Edge
- An edge in the code graph with location info.
- Graph
Builder - Builds an ArborGraph from parsed code nodes.
- Graph
Edge - A simplified edge for graph export/visualization.
- Heuristics
Matcher - Pattern matchers for different frameworks and languages
- Impact
Analysis - Complete impact analysis result.
- Impact
Result - Result of an impact analysis query.
- Node
Info - Basic information about a node.
- Query
Result - Result of a context query.
- Search
Hit - A ranked search hit.
- Search
Index - An inverted index over symbol names, tokens, and documentation.
- Uncertain
Edge - An edge that might exist at runtime but cannot be proven statically
Enums§
- Confidence
Level - Confidence level for an analysis result
- Edge
Kind - The type of relationship between two code entities.
- Impact
Direction - Direction of impact from the target node.
- Impact
Severity - Severity of impact based on hop distance from target.
- Match
Kind - How a symbol matched a query, strongest first.
- Node
Role - Node role classification
- Truncation
Reason - Reason for stopping context collection.
- Uncertain
Edge Kind - 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
- ensure_
centrality - Computes percentile centrality when the graph has nodes and no complete score map.
- is_
noise_ path - Bundled vendor trees and minified assets that should not rank as hotspots.
- 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.
- top_
hotspots - Highest-centrality symbols that participate in the graph and are not vendor noise.
Type Aliases§
- NodeId
- Unique identifier for a node in the graph.