Skip to main content

DependencyGraph

Struct DependencyGraph 

Source
pub struct DependencyGraph { /* private fields */ }
Expand description

Directed dependency graph of architectural components.

Implementations§

Source§

impl DependencyGraph

Source

pub fn new() -> Self

Source

pub fn add_component(&mut self, component: &Component) -> NodeIndex

Add a component as a node. Returns the node index.

Source

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).

Source

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.

Source

pub fn add_dependency(&mut self, dep: &Dependency)

Add a dependency as an edge.

Source

pub fn edges_with_nodes(&self) -> Vec<(&GraphNode, &GraphNode, &GraphEdge)>

Iterate over all edges with their source and target nodes.

Source

pub fn find_cycles(&self) -> Vec<Vec<ComponentId>>

Find cycles using DFS. Returns groups of component IDs that form cycles.

Source

pub fn node_count(&self) -> usize

Count ports and adapters in the graph.

Source

pub fn nodes(&self) -> Vec<&GraphNode>

Get all nodes

Source

pub fn mark_external(&mut self, id: &ComponentId)

Mark a node as external (not from analyzed source files).

Source

pub fn nodes_by_layer(&self) -> HashMap<String, usize>

Count nodes grouped by layer, skipping external nodes.

Source

pub fn layer_coupling_matrix(&self) -> LayerCouplingMatrix

Build a layer coupling matrix from edge data.

Source

pub fn max_dependency_depth(&self) -> usize

Calculate max dependency depth using BFS from each root node.

Trait Implementations§

Source§

impl Default for DependencyGraph

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.