SLIDE 1
1
Let be a connected undirected graph with Let be a connected undirected graph with
Minimal Spanning Trees Minimal Spanning Trees
( ) ( )
, G V E =
Vertices Vertices Edges Edges
E V V ⊆ × ⊆ ×
Def.
- Def. A
A weighted weighted graph graph is a undirected graph is a undirected graph with with weight weight function function
( ) ( )
, G V E =
: w E →
Def.
- Def. A
A spanning spanning tree tree T T
- f
- f G
G is a is a subgraph subgraph of
- f a
a undirected graph of undirected graph of G G s.t s.t. . 1) 1) T T is a tree, i.e., a connected acyclic graph is a tree, i.e., a connected acyclic graph 2) 2) V(T)=V(G) V(T)=V(G)
Minimal Spanning Trees Minimal Spanning Trees
Def.
- Def. A
A minimum minimum spanning spanning subtree subtree of a weighted graph
- f a weighted graph
is a spanning is a spanning subtree subtree of
- f G
G
- f minimum weight
- f minimum weight
( ) ( )
, G w
( ) ( )
e T
w T w e
∈
= ∑
Minimum Spanning Minimum Spanning Subtree Subtree Problem: Problem: Given a Given a weighted connected undirected graph weighted connected undirected graph ( (G,w G,w) ), find a , find a minimum spanning minimum spanning subtree subtree
Example of a Example of a Minimal Spanning Tree Minimal Spanning Tree Minimal Spanning Trees Minimal Spanning Trees We will look at two Algorithms: We will look at two Algorithms:
- Kruskal
Kruskal
- Prim ~
Prim ~ Dijkstra Dijkstra’ ’s s Shortest Shortest paths algorithm paths algorithm
Both are Both are $Greedy$ $Greedy$ algorithms algorithms
The Generic Algorithm The Generic Algorithm
This algorithm grows a set of edges This algorithm grows a set of edges A A of
- f G
G which which upon termination of the algorithm becomes a minimal upon termination of the algorithm becomes a minimal spanning tree of spanning tree of G G. .
- In
In Kruskal Kruskal’ ’s s algorithm, algorithm, A A is a coalescing is a coalescing forest forest
- In
In Prim Prim’ ’s s algoritm algoritm, , A A is an expanding tree is an expanding tree Property preserved by Loop: Property preserved by Loop: A A is a subset of is a subset of some minimum spanning tree some minimum spanning tree
Safe Edges Safe Edges
Def.
- Def. A