Graph Algorithms: Minimum Spanning Tree - PowerPoint PPT Presentation

1 / 13
About This Presentation
Title:

Graph Algorithms: Minimum Spanning Tree

Description:

w: E R mapping edges to real valued weights. ... A minimum spanning tree is a spanning tree where the sum of the weights in E' is minimal. ... – PowerPoint PPT presentation

Number of Views:106
Avg rating:3.0/5.0
Slides: 14
Provided by: DavidR6
Category:

less

Transcript and Presenter's Notes

Title: Graph Algorithms: Minimum Spanning Tree


1
Graph Algorithms Minimum Spanning Tree
We are given a weighted, undirected graph G (V,
E), with weight function w E ? R mapping edges
to real valued weights.
1
5
10
1
3
8
2
4
3
1
1
4
6
6
5
2
2
Graph Algorithms Minimum Spanning Tree
We are given a weighted, undirected graph G (V,
E), with weight function w E ? R mapping edges
to real valued weights.
1
A spanning tree T (V, E) is a subgraph of G
such that V V and T is a tree.
5
10
1
3
8
2
4
3
1
1
4
6
6
5
2
3
Graph Algorithms Minimum Spanning Tree
We are given a weighted, undirected graph G (V,
E), with weight function w E ? R mapping edges
to real valued weights.
1
A spanning tree T (V, E) is a subgraph of G
such that V V and T is a tree.
5
10
1
3
8
2
4
3
1
A minimum spanning tree is a spanning tree where
the sum of the weights in E' is minimal.
1
4
6
6
5
2
4
Graph Algorithms Minimum Spanning Tree
  • Kruskals algorithm for finding an MST
  • Starting from an empty tree, T, pick the edge e
    with the
  • minimum weight, and initialize E e.

1
5
10
1
3
8
2
4
3
1
1
4
6
Add edge (1, 3) to E
6
5
2
5
Graph Algorithms Minimum Spanning Tree
  • Kruskals algorithm for finding an MST
  • Starting from an empty tree, T, pick the edge e
    with the
  • minimum weight, and initialize E e.

1
2. Choose the edge e' not in E' such that, edge
weight of e' in E E' is minimal and no cycle
will be created if e' is added to E. Add e' to
E.
5
10
1
3
8
2
4
3
1
1
4
6
Add edge (2, 6) to E
6
5
2
6
Graph Algorithms Minimum Spanning Tree
  • Kruskals algorithm for finding an MST
  • Starting from an empty tree, T, pick the edge e
    with the
  • minimum weight, and initialize E e.

1
2. Choose the edge e' not in E such that, edge
weight of e' in E E is minimal and no cycle
will be created if e' is added to E. Add e' to
E. Repeat step 2 until all edges are looked at.
5
10
1
3
8
2
4
3
1
1
4
6
Add edge (2, 5) to E
6
5
2
7
Graph Algorithms Minimum Spanning Tree
  • Kruskals algorithm for finding an MST
  • Starting from an empty tree, T, pick the edge e
    with the
  • minimum weight, and initialize E e.

1
1
2. Choose the edge e' not in E such that, edge
weight of e' in E E is minimal and no cycle
will be created if e' is added to E. Add e' to
E. Repeat step 2 until all edges are looked at.
5
5
10
10
1
1
8
3
8
2
4
2
4
3
3
1
1
1
1
4
4
6
6
Edge (5, 6) is NOT added, since it creates a
cycle.
6
6
5
5
2
2
8
Graph Algorithms Minimum Spanning Tree
  • Kruskals algorithm for finding an MST
  • Starting from an empty tree, T, pick the edge e
    with the
  • minimum weight, and initialize E e.

1
1
2. Choose the edge e' not in E such that, edge
weight of e' in E E is minimal and no cycle
will be created if e' is added to E. Add e' to
E. Repeat step 2 until all edges are looked at.
5
5
10
10
1
1
8
3
8
2
4
2
4
3
3
1
1
1
1
4
4
6
6
Add edge (3, 4) to E
6
6
5
5
2
2
9
Graph Algorithms Minimum Spanning Tree
  • Kruskals algorithm for finding an MST
  • Starting from an empty tree, T, pick the edge e
    with the
  • minimum weight, and initialize E e.

1
1
2. Choose the edge e' not in E such that, edge
weight of e' in E E is minimal and no cycle
will be created if e' is added to E. Add e' to
E. Repeat step 2 until all edges are looked at.
5
5
10
10
1
1
8
3
8
2
4
2
4
3
3
1
1
1
1
4
4
6
6
Add edge (4, 5) to E
6
6
5
5
2
2
10
Graph Algorithms Minimum Spanning Tree
  • Kruskals algorithm for finding an MST
  • Starting from an empty tree, T, pick the edge e
    with the
  • minimum weight, and initialize E e.

1
1
2. Choose the edge e' not in E such that, edge
weight of e' in E E is minimal and no cycle
will be created if e' is added to E. Add e' to
E. Repeat step 2 until all edges are looked
at. Edge(1,4) is NOT added, since it creates a
cycle.
5
5
10
10
1
1
8
3
8
2
4
2
4
3
3
1
1
1
1
4
4
6
6
6
6
5
5
2
2
11
Graph Algorithms Minimum Spanning Tree
  • Kruskals algorithm for finding an MST
  • Starting from an empty tree, T, pick the edge e
    with the
  • minimum weight, and initialize E e.

1
1
2. Choose the edge e' not in E such that, edge
weight of e' in E E is minimal and no cycle
will be created if e' is added to E. Add e' to
E. Repeat step 2 until all edges are looked
at. Edge(2,3) is NOT added, since it creates a
cycle.
5
5
10
10
1
1
3
8
2
4
2
4
3
3
1
1
1
1
4
4
6
6
6
6
5
5
2
2
12
Graph Algorithms Minimum Spanning Tree
  • Kruskals algorithm for finding an MST
  • Starting from an empty tree, T, pick the edge e
    with the
  • minimum weight, and initialize E e.

1
1
2. Choose the edge e' not in E such that, edge
weight of e' in E E is minimal and no cycle
will be created if e' is added to E. Add e' to
E. Repeat step 2 until all edges are looked
at. Edge(1, 2) is NOT added, since it creates a
cycle.
5
5
10
10
1
1
8
3
8
2
4
2
4
3
3
1
1
1
1
4
4
6
6
6
6
5
5
2
2
13
Graph Algorithms Minimum Spanning Tree
  • Kruskals algorithm for finding an MST
  • Starting from an empty tree, T, pick the edge e
    with the
  • minimum weight, and initialize E e.

1
1
2. Choose the edge e' not in E such that, edge
weight of e' in E E is minimal and no cycle
will be created if e' is added to E. Add e' to
E. Repeat step 2 until all edges are looked
at. Done!!
5
5
10
10
1
1
8
3
8
2
4
2
4
3
3
1
1
1
1
4
4
6
6
6
6
5
5
2
2
Sum of edge weights 1 1 1 3 4 10.
Write a Comment
User Comments (0)
About PowerShow.com