pub struct StructuralGraph {
pub graph: DiGraph<Node, Edge>,
/* private fields */
}Fields§
§graph: DiGraph<Node, Edge>Implementations§
Source§impl StructuralGraph
impl StructuralGraph
pub fn from_graph(graph: DiGraph<Node, Edge>) -> Self
pub fn build_from_analysis(entries: &[FileAnalysisOutput]) -> Self
Sourcepub fn from_call_graph(
entries: &[FileAnalysisOutput],
call_graph: &CallGraph,
) -> Self
pub fn from_call_graph( entries: &[FileAnalysisOutput], call_graph: &CallGraph, ) -> Self
Build a StructuralGraph from an already-built CallGraph plus the same entries used to build it. Reuses CallGraph::callees (already-resolved caller/callee names, including scope-prefix stripping) instead of re-deriving Calls edges from entry.semantic.calls, so the expensive edge-resolution pass runs exactly once across both graphs. Node/symbol_index construction (Pass 1) is unavoidable since CallGraph does not track SymbolKind or imports. Note: unlike build_from_analysis, this does not have per-call arg_count available (CallEdge does not carry it), so candidate disambiguation falls back to same-file preference and line proximity only, without the arg-count tie-break stage.
pub fn bfs_blast_radius(&self, symbol: &str, depth: usize) -> Vec<NodeIndex>
Sourcepub fn blast_radius_subgraph(
&self,
symbol: &str,
depth: usize,
) -> (Vec<NodeIndex>, Vec<(NodeIndex, NodeIndex, Edge)>)
pub fn blast_radius_subgraph( &self, symbol: &str, depth: usize, ) -> (Vec<NodeIndex>, Vec<(NodeIndex, NodeIndex, Edge)>)
Blast-radius subgraph including both nodes and edges.
Returns a tuple of (nodes, edges) where:
- nodes: Vec
with the start symbol first, followed by all discovered nodes in BFS order - edges: Vec<(NodeIndex, NodeIndex, Edge)> containing every edge whose source and target are both in the visited set (not just edges walked by the BFS tree), allowing clients to fully reconstruct the subgraph’s connectivity
If the symbol is not found, returns (vec![], vec![]).
Sourcepub fn render_subgraph_text(&self, nodes: &[NodeIndex]) -> String
pub fn render_subgraph_text(&self, nodes: &[NodeIndex]) -> String
Renders a subgraph defined by nodes into a prompt-ready string representation.
Formats function symbols grouped by file path:
// path/to/file.rs
fn name [calls: a, b] [callers: c]Files are sorted lexicographically, functions within files are sorted by name.
Non-Symbol nodes and non-Function SymbolKinds are skipped.
Sourcepub fn find_symbols(&self, names: &[&str]) -> Vec<NodeIndex>
pub fn find_symbols(&self, names: &[&str]) -> Vec<NodeIndex>
Resolves multiple symbol names to their first matching NodeIndex in the symbol index.
Sourcepub fn blast_radius_bidirectional(
&self,
seeds: &[NodeIndex],
max_nodes: usize,
max_depth: usize,
) -> (Vec<NodeIndex>, Vec<(NodeIndex, NodeIndex, Edge)>)
pub fn blast_radius_bidirectional( &self, seeds: &[NodeIndex], max_nodes: usize, max_depth: usize, ) -> (Vec<NodeIndex>, Vec<(NodeIndex, NodeIndex, Edge)>)
Bidirectional blast-radius traversal discovering both callers and callees.
Walks both Direction::Incoming and Direction::Outgoing edges filtered to Edge::Calls.
Caps the visited set at max_nodes and traversal depth at max_depth.
Returns (nodes, edges) for the induced subgraph where all edges between visited nodes
are included.
Trait Implementations§
Source§impl Clone for StructuralGraph
impl Clone for StructuralGraph
Source§fn clone(&self) -> StructuralGraph
fn clone(&self) -> StructuralGraph
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for StructuralGraph
impl Debug for StructuralGraph
Source§impl<'de> Deserialize<'de> for StructuralGraph
impl<'de> Deserialize<'de> for StructuralGraph
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for StructuralGraph
impl RefUnwindSafe for StructuralGraph
impl Send for StructuralGraph
impl Sync for StructuralGraph
impl Unpin for StructuralGraph
impl UnsafeUnpin for StructuralGraph
impl UnwindSafe for StructuralGraph
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more