CIS 3223. Data Structures and Algorithms

Decompositions of graphs

 

The problem: to decompose V into a partition of components, in each of them there is a path from any vertex to any other vertex.

 

1. Depth-first search

Finding all reachable nodes: procedure explore (continuous DFS)

Depth-first search: procedure dfs (repeated exploring)

Decomposite a undirected graph into connected components (subgraphs): DFS with a counter for each exploring

Previsit and postvisit orderings, example, property, an ancestor interval includes an descendant interval.

Types of edges, determined by interval

Cycle detection by back-edge checking: in a dag, every edge leads to a vertex with a lower post number

Source node and sink node: every dag has at least one of each

Linearlization, topological sorting

 

2. Strongly connected components

Task: to decomposite a directed graph into strongly connected components

The meta-graph of a directed graph is a dag

Run explore within a sink component will visit all nodes in that component and no other nodes

After a DFS starting from any node, the node with the highest post number must be in a source component of the meta-graph. Proof

To turn a source node to a sink node, we can run DFS on the reverse graph of G

After a sink component is identified, it is removed from G, and the process is repeated

The decomposition algorithm and its complexity