L18cs2110fa09-6up

# L18cs2110fa09-6up - Announcements 2 Prelim 2 Two and a half...

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

10/20/2009 1 GRAPHS Lecture 18 CS2110 – Fall 2009 Announcements 2 ± Prelim 2: Two and a half weeks from now ± Tuesday, Nov 17, 7:30-9pm ± Uris G01 Auditorium ± Exam conflicts ± Email Ken or Maria soon so that we can plan ahead ± Old exams are available for review on the course website These are not Graphs 3 ...not the kind we mean, anyway These are Graphs 4 K 5 K 3,3 = Applications of Graphs 5 ± Communication networks ± Routing and shortest path problems ± Commodity distribution (flow) ± Traffic control ± Resource allocation ± Geometric modeling ± ... Graph Definitions 6 ± A directed graph (or digraph ) is a pair (V, E) where ± V is a set ± E is a set of ordered pairs (u,v) where u,v ± V ² Usually require u v (i.e., no self-loops) ± An element of V is called a vertex (pl. vertices ) or node ± An element of E is called an edge or arc ± |V| = size of V, often denoted n ± |E| = size of E, often denoted m

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

View Full Document
10/20/2009 2 Example Directed Graph (Digraph) 7 b a c d e f V = {a,b,c,d,e,f } E = {(a,b), (a,c), (a,e), (b,c), (b,d), (b,e), (c,d), (c,f), (d,e), (d,f), (e,f)} |V| = 6, |E| = 11 Example Undirected Graph 8 An undirected graph is just like a directed graph, except the edges are unordered pairs ( sets ) {u,v} Example: b d a c e f V = {a,b,c,d,e,f } E = {{a,b}, {a,c}, {a,e}, {b,c}, {b,d}, {b,e}, {c,d}, {c,f}, {d,e}, {d,f}, {e,f}} Some Graph Terminology 9 ± Vertices u and v are called the source and sink of the directed edge (u,v), respectively ± Vertices u and v are called the endpoints of (u,v) ± Two vertices are adjacent if they are connected by an edge ± The outdegree of a vertex u in a directed graph is the number of edges for which u is the source ± The indegree of a vertex v in a directed graph is the number of edges for which v is the sink ± The degree of a vertex u in an undirected graph is the number of edges of which u is an endpoint b a c e d f b a c d e f More Graph Terminology 10 ± A path is a sequence v 0 ,v 1 ,v 2 ,...,v p of vertices such that (v i ,v i+1 ) א E, 0 i p – 1 ± The length of a path is its number of edges ± In this example, the length is 5 v 0 v 5 ± A path is simple if it does not repeat any vertices ± A cycle is a path v 0 ,v 1 ,v 2 ,...,v p such that v 0 = v p ± A cycle is simple if it does not repeat any vertices except the first and last ± A graph is acyclic if it has no cycles ± A directed acyclic graph is called a dag b a c d e f Is This a Dag? 11 b a c d e f ± Intuition: ± If it’s a dag, there must be a vertex with indegree zero –why? ± This idea leads to an algorithm ± A digraph is a dag if and only if we can iteratively delete indegree-0 vertices until the graph disappears Is This a Dag? 12 b a c d e f ± Intuition: ± If it’s a dag, there must be a vertex with indegree zero ± This idea leads to an algorithm ± A digraph is a dag if and only if we can iteratively delete indegree-0 vertices until the graph disappears
10/20/2009 3 Is This a Dag?

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 03/08/2010 for the course CS 2110 taught by Professor Francis during the Spring '07 term at Cornell.

### Page1 / 15

L18cs2110fa09-6up - Announcements 2 Prelim 2 Two and a half...

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

View Full Document
Ask a homework question - tutors are online