Start the DFS at vertex A, and, given a choice, visit neighbors of each vertex in alphabetical order.
Recall that the dfs-numbering of the vertices gives the order in which the vertices are first encountered during the DFS.
Define the dfs post-order numbering of the vertices so that it gives the order in which the vertices are first finished with during the DFS.
For example, a vertex v has post-order number 1 if it is the first one such that the call DFS(v) returns. (Such a vertex will always be a leaf in the dfs tree.) The vertex with post-order number N (the number of vertices) will always be the root of the DFS tree, provided all vertices are reachable from the root.
1A. What are the dfs-numbers of the vertices?
1B. What are the dfs-post-order numbers of the vertices?
1C. If you run BFS (breadth-first search, starting at A) what are the distance labels of the vertices?
Recall that DFS on a directed graph classifies edges into tree, back, cross, and forward edges.
2A. List the edges of each type in the example you did above.
2B. In general, if an edge (u,v) is of the type in the first column below, which conditions are possible?
|type||pre[u] < pre[v]||pre[u] > pre[v]||post[u] < post[v]||post[u] > post[v]|
Run [Dijkstra's algorithm] on the following directed graph, starting at vertex 1. After each iteration of the outer loop, show the contents of the queue Q (the vertices in the queue and their keys). What are the final distances (in the distance array)?
4A: Give an example of a graph with 5 vertices (two of which are S and T) with three S,T-cut vertices.
4B: prove or disprove the following claim: In a DFS of the graph starting at S, every S,T-cut vertex must lie on the path from S to T in the resulting dfs tree.
Claim is true. Suppose a vertex v does not lie on the path. Then even if v is removed, there remains a path from S to T. Thus v is not an S,T-cut vertex.
4C: prove or disprove the following claim: In a DFS of the graph starting at S, every vertex on the path from S to T in the resulting DFS tree is an S,T-cut vertex.
Claim is false. Consider for example a cycle or a complete graph on at least 3 vertices. These graphs have no S,T-cut vertices.
4D: use low numbers (from the DFS-based alg for finding cut vertices) to give a necessary and sufficient condition for a vertex W on the path from S to T in the DFS tree to be an S,T-cut vertex.
A vertex v (other than S or T) on the S,T-path in the DFS tree is an S,T-vertex iff it has a child w in the DFS tree that is on the path from S to T and has low[w] ≥ dfs-num[v].
Note that this includes the case when v is the lowest common ancestor of S and T (when neither S, nor T is the root of the DFS tree).