pub struct IncrementalScc { /* private fields */ }Expand description
Incremental SCC tracker over a mutable directed graph.
Implementations§
Source§impl IncrementalScc
impl IncrementalScc
Sourcepub fn new(graph: DynamicGraph) -> GraphalgResult<Self>
pub fn new(graph: DynamicGraph) -> GraphalgResult<Self>
Build the tracker, computing the initial SCC partition with Tarjan.
Sourcepub fn num_components(&self) -> usize
pub fn num_components(&self) -> usize
Number of strongly-connected components.
Sourcepub fn component_of(&self, v: usize) -> GraphalgResult<usize>
pub fn component_of(&self, v: usize) -> GraphalgResult<usize>
Dense component id of vertex v.
Sourcepub fn same_component(&self, u: usize, v: usize) -> GraphalgResult<bool>
pub fn same_component(&self, u: usize, v: usize) -> GraphalgResult<bool>
Whether u and v are in the same SCC (mutually reachable).
Sourcepub fn components(&self) -> Vec<Vec<usize>>
pub fn components(&self) -> Vec<Vec<usize>>
The component partition as sorted vertex lists, each list sorted and the outer list ordered by smallest member.
Sourcepub fn graph(&self) -> &DynamicGraph
pub fn graph(&self) -> &DynamicGraph
Borrow the underlying graph.
Sourcepub fn apply_insert(&mut self, u: usize, v: usize) -> GraphalgResult<()>
pub fn apply_insert(&mut self, u: usize, v: usize) -> GraphalgResult<()>
Insert directed edge u → v and update the partition incrementally.
Sourcepub fn apply_remove(&mut self, u: usize, v: usize) -> GraphalgResult<()>
pub fn apply_remove(&mut self, u: usize, v: usize) -> GraphalgResult<()>
Remove directed edge u → v and update the partition incrementally.
Removing an edge never changes any vertex’s current component label, so
the affected-component test inside handle_remove
can safely read comp_of after the graph mutation.
Sourcepub fn apply_batch(
&mut self,
updates: &[(usize, usize, bool)],
) -> GraphalgResult<()>
pub fn apply_batch( &mut self, updates: &[(usize, usize, bool)], ) -> GraphalgResult<()>
Apply a batch of (u, v, is_insert) updates, maintaining the partition
after each one.
Trait Implementations§
Source§impl Clone for IncrementalScc
impl Clone for IncrementalScc
Source§fn clone(&self) -> IncrementalScc
fn clone(&self) -> IncrementalScc
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more