Introduction to Algorithms, Second Edition

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

View Full Document Right Arrow Icon
The University of Texas at Austin Lectures 9 & 10 Department of Computer Sciences Professor Vijaya Ramachandran Graphs; shortest paths CS357: ALGORITHMS, Spring 2006 1 Graph-theoretic Definitions An undirected graph G = ( V, E ) consists of a finite set of vertices V and a set E of unordered pairs of distinct vertices in V . An edge containing vertices x and y is denoted by ( x, y ) (or equivalently as ( y, x )). A directed graph , also called G = ( V, E ) consists of a finite set of vertices V , and a set of edges E which is a binary relation on V , i.e., E is a subset of V × V . The degree of a vertex v is the number of edges of the form ( v, x ), x V . In a directed graph, this is also called the out-degree of v ; its in-degree is the number of edges of the form ( x, v ), x V . In both an undirected and directed graph, if ( u, v ) is an edge, then v is adjacent to u . A path of length k from vertex u to vertex u 0 in G = ( V, E ) is a sequence of vertices < v 0 , v 1 , · · · , v k > with v 0 = u and v k = u 0 such that each ( v i - 1 , v i ) E , 1 i k . For each v V , < v > represents a path of length 0. A path is simple if all vertices on the path are distinct. We say that v is reachable from u if there is a path (of some length) from u to v . Given a graph G = ( V, E ) (directed or undirected), a graph G 0 = ( V 0 , E 0 ) is a subgraph of G if V 0 V and E 0 E . Given a set of vertices V 1 V , the subgraph of G induced by V 1 is the graph G 1 = ( V 1 , E 1 ) where E 1 contains all edges ( u, u 0 ) E with both u and u 0 in V 1 . Representation of graphs. The running time of graph algorithms is usually measured in terms of the size of the representation used to describe the graph G = ( V, E ). This size is | V | + | E | , if an adjacency-lists representation of G is used, as described in the textbook. Throughout our discussion of graph algorithms, we will use n to denote | V | and m to denote E .
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
Image of page 2
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