hw04_sol

hw04_sol - CS170 Spring 2010 HW4 Solutions(DPV 3.2 The...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CS170 - Spring 2010 HW4 - Solutions (DPV 3.2) The figure below shows pre and post numbers for the vertices in parentheses. Different edges are marked as indicated. A B C D E F G H (1,16) (2,11) (4,5) (7,8) (3,10) (13,16) (12,15) (6,9) Tree Edge Cross Edge Back Edge Forward Edge A B C D E F G H (1,16) (2,15) (3,14) (4,13) (5,12) (6,11) (7,10) (8,9) (a) (b) (DPV 3.3) (a) The figure below shows the pre and post times in parentheses. (1,14) (15,16) (2,13) (3,10) (11,12) (4,9) (5,6) (7,8) A B C D E F G H (b) The vertices A,B are sources and G,H are sinks. (c) Since the algorithm outputs vertices in decreasing order of post numbers, the ordering given is B,A,C,E,D,F,H,G . (d) Any ordering of the graph must be of the form { A,B } ,C, { D,E } ,F, { G,H } , where { A,B } indi- cates A and B may be in any order within these two places. Hence the total number of orderings is 2 3 = 8. (DPV 3.4) To solve this question we use the algorithm provided in page 94 of the text book. (1) G R is built and a DFS is run to generate post times for all nodes. (2) we run a DFS on G picking the nodes in which to start each run from by the decreasing order of the post scores from step (1). Each time the DFS run finishes a “tree” and is ready to pick a new node at which to start at - the nodes traversed in that run are “packed” into an SCC. (i) The strongly connected components are found in the order { B } , { E } , { A } { H,G,I } , { C,D,F,J } . { B } and { E } are sources and { C,D,F,J } is a sink. The “metagraph” is shown in the figure below....
View Full Document

This note was uploaded on 04/30/2010 for the course CS 170 taught by Professor Henzinger during the Spring '02 term at Berkeley.

Page1 / 4

hw04_sol - CS170 Spring 2010 HW4 Solutions(DPV 3.2 The...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online