pub struct GraphStats {
pub node_count: usize,
pub edge_count: usize,
pub density: f64,
pub scc_count: usize,
pub cycle_count: usize,
pub weakly_connected_component_count: usize,
pub isolated_node_count: usize,
pub max_in_degree: usize,
pub max_out_degree: usize,
pub reduced_node_count: usize,
pub reduced_edge_count: usize,
}Expand description
Summary statistics for a dependency graph.
Computed from a NormalizedGraph by GraphStats::from_normalized.
All counts refer to the original (non-condensed) graph unless otherwise
noted.
Fields§
§node_count: usizeNumber of items (nodes) in the graph.
edge_count: usizeNumber of blocking edges in the original graph.
density: f64Graph density: edge_count / (node_count * (node_count - 1)).
Ranges from 0.0 (no edges) to 1.0 (all possible edges present).
Zero for graphs with 0 or 1 node.
scc_count: usizeNumber of strongly connected components.
Equals node_count in a fully acyclic graph.
cycle_count: usizeNumber of SCCs with more than one member (dependency cycles).
weakly_connected_component_count: usizeNumber of weakly connected components (disjoint subgraphs).
isolated_node_count: usizeNumber of nodes with no in-edges and no out-edges.
max_in_degree: usizeMaximum in-degree (most incoming blocking edges on one node).
max_out_degree: usizeMaximum out-degree (most outgoing blocking edges from one node).
reduced_node_count: usizeNumber of nodes in the condensed (reduced) graph.
Equals scc_count — provided for convenience.
reduced_edge_count: usizeNumber of edges in the transitively-reduced condensed graph.
Implementations§
Source§impl GraphStats
impl GraphStats
Sourcepub fn from_normalized(ng: &NormalizedGraph) -> Self
pub fn from_normalized(ng: &NormalizedGraph) -> Self
Compute statistics from a NormalizedGraph.
Sourcepub const fn has_cycles(&self) -> bool
pub const fn has_cycles(&self) -> bool
Return true if the graph contains at least one dependency cycle.
Sourcepub fn reduction_ratio(&self) -> f64
pub fn reduction_ratio(&self) -> f64
Return the reduction ratio: how many edges were removed by transitive reduction vs the raw edge count.
Returns 0.0 if there are no edges in the original graph.
Trait Implementations§
Source§impl Clone for GraphStats
impl Clone for GraphStats
Source§fn clone(&self) -> GraphStats
fn clone(&self) -> GraphStats
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for GraphStats
impl Debug for GraphStats
Source§impl PartialEq for GraphStats
impl PartialEq for GraphStats
impl StructuralPartialEq for GraphStats
Auto Trait Implementations§
impl Freeze for GraphStats
impl RefUnwindSafe for GraphStats
impl Send for GraphStats
impl Sync for GraphStats
impl Unpin for GraphStats
impl UnsafeUnpin for GraphStats
impl UnwindSafe for GraphStats
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,
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<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.