pub struct DependencyGraph { /* private fields */ }Expand description
Directed dependency graph of architectural components.
Implementations§
Source§impl DependencyGraph
impl DependencyGraph
pub fn new() -> Self
Sourcepub fn add_component(&mut self, component: &Component) -> NodeIndex
pub fn add_component(&mut self, component: &Component) -> NodeIndex
Add a component as a node. Returns the node index.
Sourcepub fn ensure_node(
&mut self,
id: &ComponentId,
layer: Option<ArchLayer>,
is_cross_cutting: bool,
) -> NodeIndex
pub fn ensure_node( &mut self, id: &ComponentId, layer: Option<ArchLayer>, is_cross_cutting: bool, ) -> NodeIndex
Ensure a component ID exists as a node (create a minimal node if needed).
Sourcepub fn ensure_node_with_mode(
&mut self,
id: &ComponentId,
layer: Option<ArchLayer>,
is_cross_cutting: bool,
architecture_mode: ArchitectureMode,
) -> NodeIndex
pub fn ensure_node_with_mode( &mut self, id: &ComponentId, layer: Option<ArchLayer>, is_cross_cutting: bool, architecture_mode: ArchitectureMode, ) -> NodeIndex
Ensure a component ID exists as a node with a specific architecture mode.
Sourcepub fn add_dependency(&mut self, dep: &Dependency)
pub fn add_dependency(&mut self, dep: &Dependency)
Add a dependency as an edge.
Sourcepub fn edges_with_nodes(&self) -> Vec<(&GraphNode, &GraphNode, &GraphEdge)>
pub fn edges_with_nodes(&self) -> Vec<(&GraphNode, &GraphNode, &GraphEdge)>
Iterate over all edges with their source and target nodes.
Sourcepub fn find_cycles(&self) -> Vec<Vec<ComponentId>>
pub fn find_cycles(&self) -> Vec<Vec<ComponentId>>
Find cycles using DFS. Returns groups of component IDs that form cycles.
Sourcepub fn node_count(&self) -> usize
pub fn node_count(&self) -> usize
Count ports and adapters in the graph.
Sourcepub fn mark_external(&mut self, id: &ComponentId)
pub fn mark_external(&mut self, id: &ComponentId)
Mark a node as external (not from analyzed source files).
Sourcepub fn nodes_by_layer(&self) -> HashMap<String, usize>
pub fn nodes_by_layer(&self) -> HashMap<String, usize>
Count nodes grouped by layer, skipping external nodes.
Sourcepub fn layer_coupling_matrix(&self) -> LayerCouplingMatrix
pub fn layer_coupling_matrix(&self) -> LayerCouplingMatrix
Build a layer coupling matrix from edge data.
Sourcepub fn max_dependency_depth(&self) -> usize
pub fn max_dependency_depth(&self) -> usize
Calculate max dependency depth using BFS from each root node.
Trait Implementations§
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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