This preview shows pages 1–3. Sign up to view the full content.
Spanning Trees
Algorithms
IE170: Algorithms in Systems Engineering:
Lecture 19
Jeﬀ Linderoth
Department of Industrial and Systems Engineering
Lehigh University
March 16, 2007
Jeﬀ Linderoth
IE170:Lecture 19
Spanning Trees
Algorithms
Taking Stock
Last Time
Minimum Spanning Trees
This Time
More Spanning Trees
Strongly Connected Components
Jeﬀ 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
Jeﬀ 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 diﬀerent vertices in diﬀerent sets.
5
We used Java Collections Classes
Jeﬀ Linderoth
IE170:Lecture 19
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentSpanning Trees
Algorithms
Kruskal’s Algorithm
kruskal
(
V,E,w
)
1
A
← ∅
2
for each
v
in
V
3
do
makeset
(
v
)
4
sort
(
E,w
)
5
for each
(
u,v
)
in
(sorted)
E
6
do if
FindSet
(
u
)
±
=
FindSet
(
v
)
7
then
A
←
A
∪ {
(
u,v
)
}
8
Union
(
u,v
)
return
A
Jeﬀ Linderoth
IE170:Lecture 19
Spanning Trees
Algorithms
Analysis
Let
T
(
X
)
be the running time of the method
This is the end of the preview. Sign up
to
access the rest of the document.
 Spring '07
 Ralphs
 Systems Engineering

Click to edit the document details