This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: Graph and Digraph Sung Yong Shin TC Lab. CS Dept., KAIST Contents 1. Definitions and Representations 2. A Minimum Spanning Tree Algorithm 3. A ShortestPath Algorithm 4. Traversing Graphs and Digraphs 5. Biconnected Components of a Graph 6. Strongly Connected Components of a Digraph 2 1 NIL 4 1 3 1 3 2 NIL 4 2 NIL 4 3 NIL 1. Definitions and Representations • Representations – Adjacency Matrix – Adjacency Lists – Adjacency Multilists 2 1 4 3 1 2 3 4 Vertex 2. MinCost Spanning Tree • Greedy (1) Sort E in the nondecreasing order of weights O( e log e ) n 2 log n Why? (2) Choose n – 1 edges from the sorted list of E as long as the current selected edge does not form a cycle with the previouslychosen edges O( e + eG ( n )) Kruskal’s algorithm !!! Any Better way ? 3 1 2 1 1 4 2 3 1 1 6 2 G= ( V, E, W ) weight Why not local search ? Observation 3 1 15 20 8 2 9 F G A B C D E H 1 2 2 1 2 2 1 5 2 4 1 3 5 G = ( V, E, W ) tree vertices = {A, B, C} = V T fringe vertices = {E,F,D} = V F unseen vertices = {G, H} = V U CE = {{A,D},{B,E},{C,F}} Dijkstra / Prim Algorithm D A C B E 1 4 2 3 1 5 2 7 V T = { A } V F = { C, B, D } CE = { { A, C }, { A, B }, { A, D } } 4 3 1 D A C B E 1 4 2 3 1 5 2 7 V T = { A, C } V F = { B, D, E } CE = { { A, D }, { C, B }, { C, E } } 2 7 3 D A C B E 1 4 2 3 1 5 2 7 V T = { A, B, C } V F = { D, E } CE = { { B, D }, { B, E } } 1 D A C B E 1 4 2 3 1 5 2 7 V T = { A, B, C, D } V F = { E } CE = { { D, E } } D A C B E 1 4 2 3 1 5 2 7 V T = { A, B, C, D, E } V F = Ø CE = Ø D A C B E 1 4 2 3 1 5 2 7 SI { Select an arbitrary vertex to start the tree } v T = Ø, v F = Ø, CE = Ø ; v T = v T r { v } ; Update v F and CE ; while v F ≠ Ø do ; e : = min  weight edge in CE ; Update v T , v F , CE ; end {while} No sorting !!! Why this algorithm works ? Lemma : Let G = ( V, E, W ) be a connected weighted graph and E' ⊆ E be a subset of the edges in some minimum spanning tree T = ( V, E T ) for G . Let V' be the vertices incident with edges in E' . If { x, y } is an edge of minimum weight such that x ∈ V' and y ∉ V' , then E' r { x , y } ⊆ E T ....
View
Full Document
 Spring '08
 Unkown
 Graph Theory, Kruskal Dijkstra, new fringe vertices, fringe vertex, mincost spanning tree

Click to edit the document details