jeffgerickson / algorithms

Bug-tracking for Jeff's algorithms book, notes, etc.
7.92k stars 1.02k forks source link

Chapter 6, Exercise 3(c) - Possibly wrong question #46

Closed dipkakwani closed 5 years ago

dipkakwani commented 5 years ago

Please correct me if I am wrong, but I think the lemma asked to be proven in the exercise 3(c) of chapter 6 is incorrect.

Let T be an arbitrary spanning tree of G, rooted at an arbitrary vertex r. For each vertex v, let Tv denote the subtree of T rooted at v; for example, Tr = T . Prove that v is a cut vertex of G if and only if G does not have an edge with exactly one endpoint in Tv .

Consider the below (DFS) spanning tree for example:

kyumejvidyjeovpb

Clearly vertex 1 has an edge with exactly one endpoint in T1, but vertex 1 is a cut vertex.

plin25 commented 5 years ago

The lemma is indeed incorrect as stated. A feasible replacement (for the purposes of part (d)) would be:

Let T be a DFS tree of G. Prove that the root of T is a cut vertex of G if and only if it has more than one child, and a non-root vertex v is a cut vertex of G if and only if no node in Tv with a back edge to a proper ancestor of v.

jeffgerickson commented 5 years ago

@plin25's suggested fix is incorrect: In @dipkakwani's example, 1 is a cut vertex, but there is a back-edge from 4 to 0.

jeffgerickson commented 5 years ago

The correct statement is "A non-root vertex v is a cut vertex of G if and only if v has a child w such that there is no edge in G between a descendant of w and a proper ancestor of v." Because the graph is undirected, any such edge must be a back edge. Equivalently: "...at least one descendant of each child of v is a neighbor of a proper ancestor of v".

jeffgerickson commented 5 years ago

Need to fix Figure 6.20 to be undirected.

jeffgerickson commented 5 years ago

Removed subproblem (b) ("find a cut vertex in a dag"). I don't know what I was thinking here; edge directions don't matter. I suppose I could ask how to find "(s,t)-cut vertices" in a dag, but that would be better as a separate question.

jeffgerickson commented 5 years ago

Added subproblem (b) back as a separate exercise. Time to move on.

06-dfs pdf