lecture19

lecture19 - Spanning Trees Algorithms Spanning Trees...

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

View Full Document Right Arrow Icon
Spanning Trees Algorithms IE170: Algorithms in Systems Engineering: Lecture 19 Jeff Linderoth Department of Industrial and Systems Engineering Lehigh University March 16, 2007 Jeff Linderoth IE170:Lecture 19 Spanning Trees Algorithms Taking Stock Last Time Minimum Spanning Trees This Time More Spanning Trees Strongly Connected Components Jeff Linderoth IE170:Lecture 19 Spanning Trees Algorithms Spanning Tree We model the problem as a graph problem. G = ( V,E ) is an undirected graph Weights w : E R | E | w uv ( u,v ) E Find T E such that 1 T connects all vertices 2 The weight w ( T ) def = ± ( u,v ) T w uv is minimized Jeff Linderoth IE170:Lecture 19 Spanning Trees Algorithms Kruskal’s Algorithm 1 Start with each vertex being its own component 2 Merge two components into one by choosing the light edge that connects them 3 Scans the set of edges in increasing order of weight 4 It uses an abstract “disjoint sets” data structure to determine if an edge connects different vertices in different sets. 5 We used Java Collections Classes Jeff Linderoth IE170:Lecture 19
Background image of page 1

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

View Full DocumentRight Arrow Icon
Spanning Trees Algorithms Kruskal’s Algorithm kruskal ( V,E,w ) 1 A ← ∅ 2 for each v in V 3 do make-set ( v ) 4 sort ( E,w ) 5 for each ( u,v ) in (sorted) E 6 do if Find-Set ( u ) ± = Find-Set ( v ) 7 then A A ∪ { ( u,v ) } 8 Union ( u,v ) return A Jeff Linderoth IE170:Lecture 19 Spanning Trees Algorithms Analysis Let T ( X ) be the running time of the method
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 5

lecture19 - Spanning Trees Algorithms Spanning Trees...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online