dsagraphs
Use disjoint-set union for connectivity queries
Anonymous
For connectivity queries on a graph that only gains edges, disjoint-set union can track whether two vertices are connected. With path compression and union by size, operations have near-constant amortized cost. It does not keep the actual path, so it is not a replacement for shortest-path search or edge deletions.
0