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] |
tree: | ? | ? | ? | ? |
back: | ? | ? | ? | ? |
forward: | ? | ? | ? | ? |
cross: | ? | ? | ? | ? |
Above pre[u] denotes the dfs-number of u, post[u] denotes the dfs post-order number, defined in problem 1.
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)?
Given a connected, undirected graph with edge weights and two vertices S and T, an S,T-cut vertex is a vertex (other than S or T) whose removal from the graph separates S and T. (That is, a vertex w such that all paths from S to T go through w.)
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.
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.
4D: use low[] numbers (from /Lecture10) 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.