pub struct DependencyGraph {
pub nodes: HashMap<String, DependencyNode>,
pub edges: Vec<DependencyEdge>,
}Expand description
Built dependency graph.
Fields§
§nodes: HashMap<String, DependencyNode>§edges: Vec<DependencyEdge>Implementations§
Source§impl DependencyGraph
impl DependencyGraph
Sourcepub fn build(store: &CatalogStore) -> Self
pub fn build(store: &CatalogStore) -> Self
Build the graph from a loaded CatalogStore.
Sourcepub fn upstream(&self, asset_id: &str) -> Vec<&DependencyEdge>
pub fn upstream(&self, asset_id: &str) -> Vec<&DependencyEdge>
All edges that originate from asset_id — i.e. what asset_id depends on.
Sourcepub fn downstream(&self, asset_id: &str) -> Vec<&DependencyEdge>
pub fn downstream(&self, asset_id: &str) -> Vec<&DependencyEdge>
All edges that point to asset_id — i.e. what depends on asset_id.
Sourcepub fn upstream_ids(&self, asset_id: &str) -> Vec<String>
pub fn upstream_ids(&self, asset_id: &str) -> Vec<String>
Convenience: sorted list of IDs that asset_id depends on (upstream nodes).
Sourcepub fn downstream_ids(&self, asset_id: &str) -> Vec<String>
pub fn downstream_ids(&self, asset_id: &str) -> Vec<String>
Convenience: sorted list of IDs that depend on asset_id (downstream nodes).
Sourcepub fn blast_radius(&self, asset_id: &str) -> BlastRadius
pub fn blast_radius(&self, asset_id: &str) -> BlastRadius
Transitive blast-radius: which assets break if asset_id is removed?
Walks backwards through the graph (BFS over downstream edges) and
returns every transitive dependent, sorted and deduplicated.
Sourcepub fn find_cycles(&self) -> Vec<Vec<String>>
pub fn find_cycles(&self) -> Vec<Vec<String>>
Detect all cycles in the graph using iterative DFS.
Returns a list of cycles where each cycle is represented as an ordered list of node IDs forming the cycle path. The result is deterministically sorted so tests can make stable assertions.
Sourcepub fn render_ascii_tree(&self, focus_id: &str, max_depth: usize) -> String
pub fn render_ascii_tree(&self, focus_id: &str, max_depth: usize) -> String
Render an ASCII dependency tree rooted at focus_id.
Each level is indented by 2 spaces per depth. Nodes already visited
in the current path are marked [cycle] to avoid infinite output.
Sourcepub fn to_adjacency_json(&self) -> Value
pub fn to_adjacency_json(&self) -> Value
Export graph as a JSON adjacency list suitable for --report dependencies.
Shape:
{
"nodes": [ { "id": "...", "asset_type": "..." }, ... ],
"adjacency": {
"<id>": [ { "to": "...", "edge_type": "depends-on" }, ... ],
...
}
}Auto Trait Implementations§
impl Freeze for DependencyGraph
impl RefUnwindSafe for DependencyGraph
impl Send for DependencyGraph
impl Sync for DependencyGraph
impl Unpin for DependencyGraph
impl UnsafeUnpin for DependencyGraph
impl UnwindSafe for DependencyGraph
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> 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