cse101_10_28_11 - DFS in Directed Graphs 1 Family...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
DFS in Directed Graphs 1. Family relationships a. A is the cost The descendents of E are F,G,H (the ones that E point to) The ancestors of D are A,B,C (all the nodes that were previous to D in your DFS search) b. A back edge is a non-tree edge that leads back to an ancestor in the DFS tree. Eg(B,A) (E,A) Undirected graph: every edge in E is either a tree edge or a back edge Directed graph: some edges could be neither tree edge nor back edge c. Lemma: u is an ancestor of w if and only if pre(u) < pre(w) < post(w) < post(u) d. Recall: a back edge is a non-tree edge leading to an ancestor Lemma (u,w) is a back edge post(u) < post(w). simply, does it go to a bigger post number. Paraphrase: an edge is a back edge if and only if it leads to a higher post number. Proof: suppose (u,w) is a back edge. That means w is an ancestor of u. Therefore, pre(w) < pre(u) < post(u) < post(w) Suppose edge (u,w) has post(u) < post(w). Since [pre(u),post(u)] and [pre(w), post(w)] are either nested or disjoint, there are only the possibilities:
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Ask a homework question - tutors are online