The source explicitly labels this question “Corrected”; that label does not imply that the four assertions in part (b) are true.
In depth-first search, mark every vertex white initially. At a white start vertex , increment a global clock, record and color it gray. Scan its outgoing adjacency list; recursively visit each still-white neighbor, recording the discovery edge. After all neighbors have been processed, color black, increment the clock and record . Start again from every remaining white vertex to obtain a forest. Each vertex is discovered once and each edge scanned once, so the time is with adjacency lists.
The DFS parenthesis property says that for distinct vertices , their intervals and are disjoint or one lies strictly inside the other. Moreover is a proper descendant in a rooted tree of exactly when . A recursive call finishes before its caller returns, while completed calls from separate branches have disjoint intervals; these two possibilities prove the property.
False. Take two vertices with both directed edges, and start depth-first search at . The timestamps are , , , . There is an edge, hence a directed path, from to , but . Reaching a gray ancestor does not make the ancestor finish first.
False. Use only the directed edge , but choose first in the outer loop of depth-first search. It finishes before a second discovery tree starts at : , , , . The edge supplies the required directed path and , yet . A path to an already black vertex need not put the two vertices into one discovery tree.
False. Let the directed edges be , , and . Start depth-first search at and explore its neighbor before . ThenThe directed path exists and , but and are siblings in the discovery tree. An existing path may leave the current recursive branch via a gray ancestor and only later enter a different branch. The usual white-path condition would need all vertices of a suitable path to be white when is discovered; that condition is absent here.
A directed path crosses from an earlier DFS branch to a later branch through the root; node labels give discovery and finishing times
. Details. False for directed distance. Take four vertices . Put both directed edges between every distinct pair in , and add and . Every vertex has out-degree two, satisfying , and there are no self-loops. Nevertheless no directed path leads from any of to , so the claimed finite upper bound on graph distance fails.
If “connected” means weakly connected, that portion does follow: a weak component of size gives each of its vertices out-degree at most , so each component would have size at least , making two components impossible. It does not imply a strongly connected directed graph. Thus either the strong-connectivity interpretation fails outright or the weak interpretation leaves the distance assertion false; the complete claim is false in either case.
First run breadth-first search from to compute each distance . All are finite by hypothesis. Next compute the strongly connected components and their condensation graph . For every component , initialize a representative minimizing over . Process components in reverse topological order, usingBreak equal-distance ties consistently, for example by fixed vertex index. Return for every .
Every vertex of one strongly connected component reaches every other; every reachable different component is reached through some first outgoing edge of . Since is a Directed acyclic graph, reverse topological order has already solved every successor. Induction over that order proves that the representative minimizes over all reachable vertices. This is minimum reachable label propagation.
All stages take time and space with explicit adjacency lists. Retaining parallel component edges is harmless: they can be scanned once each without sorting or deduplication. Reachability here includes the length-zero path, so ; this standard convention also makes the requested answer meaningful at a sink.
Replace breadth-first search by Dijkstra's algorithm from , using the positive edge weights to compute . The strongly connected components, the condensation graph and the reverse-topological order propagation are unchanged, because reachability ignores weights. Only the label assigned to a reachable vertex changes.
With a binary heap, the total time is , including the linear component-processing stages. More specialized priority queues give their corresponding shortest-path bounds. The proof still compares the precomputed distances from ; it must not add the weight of a path from to the candidate, which would optimize a different quantity.
Articles by others on the same topic
There are currently no matching articles.
