180 likes | 328 Views
Directed Graphs. Normal Person’s Graph. y = f(x). y. x. Computer Scientist’s Graph. b. a. c. d. f. e. Digraphs. a set, V , of vertices a ka “nodes” a set, E ⊆ V × V of directed edges ( v,w ) ∈ E. notation: v → w. v. w. Relations and Graphs. a. b. d. c.
E N D
Normal Person’s Graph y = f(x) y x
Computer Scientist’s Graph b a c d f e
Digraphs • a set, V, of vertices aka “nodes” • a set, E⊆V×V of directed edges (v,w)∈ E • notation: v→w v w
Relations and Graphs a b d c V= {a,b,c,d} E = {(a,b), (a,c), (c,b)}
Digraphs Formally, a digraph with vertices V is the same as a binary relation on V.
Walks & Paths Walk: follow successive edges length: 5 edges (not the 6 vertices)
Walks & Paths Path: walk thru vertices without repeat vertex length: 4 edges
Walks & Paths Lemma: The shortest walk between two vertices is a path! Proof:(by contradiction) suppose path from u to vcrossed itself: c v u
Walks & Paths Lemma: The shortest walk between two vertices is a path! Proof:(by contradiction) suppose path from u to vcrossed itself: then path without c---cis shorter! c v u
Walks & Paths Digraph G defines walk relation G+ u G+viff∃walk u to v (the positive walk relation) “+” means 1 or more
Walks & Paths Digraph G defines walk relation G* u G*viffu to v (the walk relation) “*” means “0 or more”
Cycles A cycle is a walk whose only repeat vertex is its start & end. (a single vertex is a length 0 cycle)
… v0 v1 v2 vn-1 v0 Cycles vi vi+1 v0
Closed Walks & Cycles Closed walk starts & ends at the same vertex. Lemma:The shortest positive length closed walk containing a vertex is a positive length cycle! Proof: similar
Directed Acyclic Graph DAG has no positive length cycle lec 7M.16
Directed Acyclic Graph DAG examples: < relation on integers ⊊ relation on sets prerequisite on classes
Example: Tournament Graph H H Y Y P P D D DAG => Unique ranking Every team plays every other