HW2_April2018_solutions.pdf

# Either prove this statement is true or give a

• Homework Help
• 4
• 100% (1) 1 out of 1 people found this document helpful

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

is a DAG. Either prove this statement is true, or give a counterexample to show it is false. Solution: The claim is false. A DAG is a directed acyclic graph with at least one source node and at least one sink node. A graph can have a source node (i.e. a node with no incoming edges) and a cycle. Then it will not be a DAG. For example let G be a graph with three nodes, a, b, c and three edges ( a, b ) , ( b, c ) , ( c, b ) . This graph has a node with no incoming edges and a cycle. Therefore it is not a DAG. 1

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

2. Given a directed acyclic graph G , give an O( | V | + | E | ) time algorithm to determine if the graph has a directed path that visits every vertex. Linearize the given DAG. If there is an edge between successive nodes in the linearized list of nodes then there is a path. 3. Let G be a directed graph. Let s be a ‘start vertex’. An infinite path of G is an infinite sequence v 0 , v 1 , v 2 , ... of vertices such that v 0 = s and for all i > 0, there is an edge from v i to v i +1 . In other words, this is a path of infinite length. Because G has a finite number of vertices, some vertices in an infinite path are visited infinitely often. 1. If p is an infinite path, let Inf ( p ) be the set of vertices that occur infinitely many times in p . Prove that Inf ( p ) is a subset of a single strongly connected component of G .
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern