DFS: Edge classification
Dependencies:
Let $G_π$ be the DFS forest obtained by performing DFS on $G$. The edges of $G$ can be partitioned into 4 classes:
- tree edges - $(u, v)$ is a tree edge iff $(u, v) \in G_π$.
- back edges - edges connecting a vertex to itself or to one of its ancestors in $G_π$.
- forward edges - edges connecting a vertex to one of its descendants in $G_π$.
- cross edges - the rest of the edges.
When $G$ is an undirected graph, we classify edges by running DFS on the directed version of $G$. If the classes of $(u, v)$ and $(v, u)$ are different, we choose the one which has more precedence. Precedence order, from highest to lowest: tree edge, back edge, forward edge, cross edge.
Dependency for:
- DFS: Online edge classification
- DFS: Reverse sorting by finish time gives topological ordering
- DFS: Edge classification in undirected graphs
- Directed graph is cyclic iff DFS gives back edges
- Undirected graph is cyclic iff DFS gives back edges
Info:
- Depth: 4
- Number of transitive dependencies: 9
Transitive dependencies:
- /sets-and-relations/equivalence-classes
- /sets-and-relations/relation-composition-is-associative
- /sets-and-relations/equivalence-relation
- Graph
- Transpose of a graph
- Path in Graph
- Rooted tree
- Forest
- Properties of DFS