HW2_April2018_solutions.pdf

Either prove this statement is true or give a

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

View Full Document Right Arrow Icon
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
Image of page 1

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

View Full Document Right Arrow Icon
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 .
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    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.

    Student Picture

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

  • Left Quote Icon

    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.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    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.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern