This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: Assignment #5, CS4/531 Due Date: Monday. Nov. 28, 2011 Total points: 47 • You MUST turn in your HW by 2:10pm on Nov 28. After that, I will NOT accept your HW. This rule will be STRICTLY ENFORCED. • Please PRINT YOUR LAST NAME, FIRST NAME and UB number on the first page. • Write solution of each problem on a separate sheet. Staple them in the order of problem numbers. • If your homework solution deviates significantly from these guidelines, TA may deduct up to 20% of the points. • Although the due date is on Nov 28, you should try to complete HW5 before Thanks Giving break. This is because HW6 will be assigned before the thanks giving break. 1. (3 points) Find the strongly connected components of the graph G = ( V,E ) in Fig. 1, by using the DFS based algorithm in section 22.5. Your solution should provide the following: • Run DFS on G . Indicate the DFS trees constructed by DFS algorithm; indicate the d [ u ] and f [ u ] values for each vertex u ∈ V . • Draw the graph G T . Label the vertices in the reverse order of f [ u ] values. • Run DFS algorithm on G T . Indicate the DFS trees constructed by the DFS algorithm. • Indicate the strongly connected components of G . Answer: • Run DFS on G , as shown in Fig.1. (The DFS tree was indicated in red color.) g f d b c h e a [1,18] [2,11] [3,10] [15,16] [13,14] [4,5] [7,8] [12,17] i [6,9] Figure 1: Graph for Strongly Connected Components Problem. • The graph G T was drawn as in Fig.2. And the vertices were labeled in the decreasing order of f [ u ] values in red color. 1 g f d b c h e a i 3 6 7 8 2 1 4 9 5 [2,7] [1,8] [9,18] [12,15] [13,14] [10,17] [3,6] [4,5] [11,16] Figure 2: Run DFS on G T and find Strongly Connected Components. • Run DFS on G T , as shown in Fig.2, and the DFS tree was indicated in red color. • The strongly connected components of G are shown in Fig.2, as circled in blue color. 2. (4 pts) Consider the graph in Figure 3. Suppose that G is given by adjacency list represen tation where, for each vertex v , the neighbors of v in Adj( v ) are in alphabetical order . Run the DFSbased biconnectivity algorithm on G with a as the starting vertex. You should: 1. Run DFS algorithm on G ; indicate the DFS tree constructed; 2. Rename the vertices of G by integers in the order they are visited by the DFS algorithm; 3. Compute low( v ) for each vertex v ; 4. List the cut vertices found by the algorithm. Answer: • Run DFS algorithm on G , as shown in Fig.3, the DFS tree is indicated in red color. And the vertices are renamed by integers in the order they are visited by the DFS algorithm; c d e f i h b a g [11,16] 1 3 4 7 2 [12,15] [13,14] 9 8 [1,18] [2,17] [4,5] [3,6] [8,9] 6 5 [7,10] Figure 3: Run DFS for Biconnectivity Algorithm • The low( v ) values for each vertex v are computed as Table 1: • The cut vertices found by the algorithm are 2(b) and 7(i)....
View
Full
Document
This note was uploaded on 02/27/2012 for the course CSE 431/531 taught by Professor Xinhe during the Fall '11 term at SUNY Buffalo.
 Fall '11
 XINHE
 Algorithms

Click to edit the document details