Skip to main content

arbor_graph/
lib.rs

1//! Arbor Graph - Code relationship management
2//!
3//! This crate manages the graph of code entities and their relationships.
4//! It provides fast lookups, traversals, and centrality scoring for
5//! prioritizing context in AI queries.
6//!
7//! # Architecture
8//!
9//! The graph uses petgraph internally with additional indexes for:
10//! - Name-based lookups
11//! - File-based grouping (for incremental updates)
12//! - Kind-based filtering
13//!
14//! # Example
15//!
16//! ```no_run
17//! use arbor_graph::ArborGraph;
18//! use arbor_core::{CodeNode, NodeKind};
19//!
20//! let mut graph = ArborGraph::new();
21//!
22//! // Add nodes from parsing
23//! let node = CodeNode::new("validate", "UserService.validate", NodeKind::Method, "user.rs");
24//! let id = graph.add_node(node);
25//!
26//! // Query the graph
27//! let matches = graph.find_by_name("validate");
28//! ```
29
30mod builder;
31mod confidence;
32mod diff;
33mod edge;
34mod graph;
35mod heuristics;
36mod impact;
37pub mod lexicon;
38mod query;
39mod ranking;
40mod search_index;
41mod slice;
42
43pub mod store;
44pub mod symbol_table;
45
46pub use search_index::{MatchKind, SearchHit, SearchIndex};
47
48pub use builder::GraphBuilder;
49pub use confidence::{ConfidenceExplanation, ConfidenceLevel, NodeRole};
50pub use diff::{
51    changed_node_ids, changed_node_ids_for_ranges, compute_blast_radius, node_matches_changed_file,
52    parse_unified_diff_ranges, BlastRadiusSummary, ChangedRange, ChangedSymbols,
53};
54pub use edge::{Edge, EdgeKind, GraphEdge};
55pub use graph::{ArborGraph, NodeId};
56pub use heuristics::{
57    detect_analysis_limitations, AnalysisWarning, HeuristicsMatcher, UncertainEdge,
58    UncertainEdgeKind,
59};
60pub use impact::{AffectedNode, ImpactAnalysis, ImpactDirection, ImpactSeverity};
61pub use lexicon::{stem, tokenize_identifier, Lexicon};
62pub use query::{DependentInfo, ImpactResult, NodeInfo, QueryResult};
63pub use ranking::{
64    compute_centrality, compute_centrality_warm, ensure_centrality, is_noise_path, top_hotspots,
65    CentralityScores,
66};
67pub use slice::{ContextNode, ContextSlice, TruncationReason};
68pub use store::{GraphStore, StoreError};
69pub use symbol_table::{Resolution, SymbolEntry, SymbolTable};