hw07solutions

# hw07solutions - CSE 331 Spring 2008, Section 1 Homework 7...

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

CSE 331 Spring 2008, Section 1 Homework 7 Solutions 1. Varies from state to state. 2. (a) V = {A, B, C, D, E, F, G}. E = {(A, B), (A, D), (B, C), (C, D), (C, G), (D, E), (D, F), (E, F)}. (b) A B, D B A, C C B, D, G D A, C, E, F E D, F F D, E G C (c) A B C D E F G A 0 1 0 1 0 0 0 B 1 0 1 0 0 0 0 C 0 1 0 1 0 0 1 D 1 0 1 0 1 1 0 E 0 0 0 1 0 1 0 F 0 0 0 1 1 0 0 G 0 0 1 0 0 0 0 (d) No simple path exists, but there are several paths that visit a few vertices more than once. Here are a couple examples: A → D → C → G → C → D → E → F A → B → C → D → A → D → E → F 3. (a) No path exists from A to J. (b) J → I → H → F → C → A

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

View Full Document
(c) A B C D E F G H I J Indegree 1 1 2 2 2 3 0 2 1 1 Outdegree 2 2 3 1 0 1 2 2 1 1 (d) G is a source vertex. E is a sink vertex. 4. The first step in topsort is to find all of the vertices of indegree 0 and insert them into a queue. As shown in #3(c), G is the only vertex of indegree zero, so it will be the only vertex in the queue.
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 07/25/2008 for the course CSE 331 taught by Professor M.mccullen during the Spring '08 term at Michigan State University.

### Page1 / 2

hw07solutions - CSE 331 Spring 2008, Section 1 Homework 7...

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

View Full Document
Ask a homework question - tutors are online