Download presentation
Presentation is loading. Please wait.
1
EMIS 8373: Integer Programming
Optimal Spanning Trees updated 10 April 2007
2
Minimum Spanning Tree (MST)
Input A (simple) graph G = (V,E) Edge cost cij for each edge (i,j) E Optimization Problem Find a minimum-cost spanning tree Spanning tree: a set of |V|-1 edges T such that each vertex is adjacent to at least one edge in T, and T contains no cycles.
3
MST Example: Input 1 3 2 5 4 6 7
4
MST Example: Some Feasible Spanning Trees
6 6 2 3 2 3 3 3 5 cost = 17 1 7 1 cost = 16 1 2 5 4 5 4 6 2 3 2 3 cost = 14 cost = 16 1 4 7 1 7 1 1 2 2 5 4 5 4
5
IP Formulation Sets Variables: Objective Function:
Let Adj[i] be the set of edges in E that are adjacent to vertex i. Variables: Let xij = 1 if and only if edge (i,j) is in the spanning tree. Objective Function:
6
IP Formulation Constraints
The tree must contain at least one edge that is adjacent to any given vertex: Cycle (subtour) elimination:
7
Kruskal’s Algorithm F := E T := {} Repeat Until |T| = |V| - 1
Select (i,j) F such that cij = min(cuv: (u,v) F) F := F \ {(i,j)} If T {(i,j)} does not contain a cycle then T := T {(i,j)}
8
Kruskal’s Algorithm: Example 1
6 2 4 3 5 1 4 7 2 1 3 5
9
Testing for Cycles Let GT be the subgraph of G induced by the set of edges in T. As edges are added to T, the algorithm creates a forest (i.e., a collection of trees). Each tree in the forest forms a connected component of GT. By keeping track of which component each node is in, we can quickly, and easily determine whether or not adding a new edge to T will create a cycle.
10
Testing for Cycles Initialize component[i] = 0 for all i V.
When edge (i, j) is inspected, there are 5 cases to consider component[i] = component[j] = 0 Add (i, j) to T; (i, j) becomes a new component of GT. component[i] = 0, component[j] > 0. Add (i, j) to T; vertex i will go into the same component as j. component[i] > 0, component[j] = 0. Add (i,j) to T; vertex j will go into the same component as i. component[i] > 0, component[j] > 0, component[i] component[j] Add (i, j) to T; merge components. component[i] = component[j] > 0 Adding (i, j) to T would create a cycle.
11
Kruskal’s Algorithm: Example 2
4 2 4 2 5 1 3 1 2 6 3 5
12
Kruskal’s Algorithm: Example 2
4 2 4 1 2 2 5 1 3 1 2 6 3 5 1 2 (2, 3) creates a cycle because vertices 2 and 3 are in the same connected component.
13
Kruskal’s Algorithm: Example 2
4 2 4 1 2 2 5 1 3 1 2 6 3 5 1 2 (2, 4) does not create a cycle because vertices 2 and 4 are in different connected components.
14
Kruskal’s Algorithm: Example 2
4 2 4 1 2 2 5 1 3 1 2 6 3 5 1 2 Merge components 1 and 2.
15
Kruskal’s Algorithm: Example 2
1 4 2 4 1 2 1 5 1 3 1 2 6 3 5 1 1 Component 1 is a MST.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.