Expand description
Incremental strongly-connected-component maintenance under edge updates.
IncrementalScc tracks the SCC partition of a DynamicGraph while edges
are inserted and deleted one (or a batch) at a time, recomputing only the
part of the structure that an update can actually change. The key structural
facts exploited are:
-
Insertion
u → vcan only merge SCCs, never split one. A merge happens exactly whenvcould already reachu(the new edge then closes a directed cycle). The SCCs that coalesce are precisely those lying on somecomp(v) ⇝ comp(u)path in the condensation DAG — i.e. the components reachable fromcomp(v)and co-reachable tocomp(u). We find that set by a forward search fromcomp(v)and a backward search tocomp(u)over the condensation and fuse the intersection into one component. Whenvcannot reachu, the partition is unchanged (the common case), and the update costs only the reachability probe — no global recomputation. -
Deletion
u → vcan only split an SCC, never merge. It can affect at most the single componentC = comp(u), and only whencomp(u) == comp(v). We then re-run Tarjan restricted to the induced subgraph onCand replaceCwith the resulting sub-components. A deletion of a cross-component edge changes nothing.
Both paths are exact: after any sequence of updates the maintained partition
equals a from-scratch scc_tarjan
recomputation on the current graph (verified in the test suite over randomised
update streams). Component identifiers are dense in 0..num_components() and
are renumbered after structural changes.
Structs§
- Incremental
Scc - Incremental SCC tracker over a mutable directed graph.