Lecture 9: T sort, Tarjan's Articulation Points Algorithm Flashcards
Proof: There must be at least one “sink vertex” with no outgoing edges in any DAG
Proof by contradiction
Suppose there isn’t. Pick an arbitrary vertex B and begin exploring from it to C->D and continue for n vertices since all vertices have outgoing edges. Then we follow n arcs, and we will have seen n+1 vertices. Via the pigeon-hole principle, we must have seen some vertex twice -> cycle and not DAG
Proof: Does every DAG have atleast one topological ordering?
Base case (n=2): n is the number of vertices in Graph G
Inductive Hypothesis: Assume our base case holds for k vertices. We will prove that it also holds for k+1 vertices.
Given an arbitrary connected graph G with k+1 vertices that is a DAG, find a random node with no outgoing edges (sink vertex) and remove it to create G’
It must be the case that G’ is a DAG as well.
We can concatenate (G’) + v to get the original
QED
Tarjan’s Articulation Point Algorithm
Used to detect articulation points
DFS tree of discovery
Root: if parent[x] is null or -1 and x has two or more children in the tree of discovery, x is an articulation point (so graph not biconnected
- Time stamp each vertex during DFS with entry_time[]
- For every node, we need to discover the earliest discovered vertex that can be reached from the subtree rooted at x.
- use low[], initially low[x] = entry_time[x]
- when backtracking low[x] = min(low[x], low[w]) - When backtracking, if low[neighbor] >= entry_time[x], it means that no descendant of x has an escape route better than x (x is articulation point)
N.B: refer to graph in notes (Lecture 10)
low[neighbor] >= entry_time[x]
Articulation points:
The root of a tree is always thought of as an articulation point. What if we have a graph where the children of the root have edges/paths between them further down in the tree of discovery?
The DFS tree of undirected graphs cannot contain forward or cross edges since in those cases the edge would’ve been traversed.