Download presentation

Presentation is loading. Please wait.

1
Graph Algorithms: Minimum Spanning Tree 1 2 3 4 6 5 10 1 5 4 3 2 6 1 1 8 We are given a weighted, undirected graph G = (V, E), with weight function w: E R mapping edges to real valued weights.

2
Graph Algorithms: Minimum Spanning Tree 1 2 3 4 6 5 10 1 5 4 3 2 6 1 1 8 We are given a weighted, undirected graph G = (V, E), with weight function w: E R mapping edges to real valued weights. A spanning tree T = (V’, E’) is a subgraph of G such that V’ = V and T is a tree.

3
Graph Algorithms: Minimum Spanning Tree 1 2 3 4 6 5 10 1 5 4 3 2 6 1 1 8 We are given a weighted, undirected graph G = (V, E), with weight function 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. A spanning tree T = (V’, E’) is a subgraph of G such that V’ = V and T is a tree.

4
Graph Algorithms: Minimum Spanning Tree 1 2 3 4 6 5 10 1 5 4 3 2 6 1 1 8 Prim’s algorithm for finding a minimum spanning tree: 1. Starting from an empty tree, T, pick a vertex, v 0, at random and initialize: V’ = {v 0 } and E’ = {}. v0v0

5
Graph Algorithms: Minimum Spanning Tree 1 2 3 4 6 5 10 1 5 4 3 2 6 1 1 8 Prim’s algorithm for finding a minimum spanning tree: 1. Starting from an empty tree, T, pick a vertex, v 0, at random and initialize: V’ = {v 0 } and E’ = {}. v0v0 2. Choose a vertex v not in V’ such that edge weight from v to a vertex in V’ is minimal.

6
Graph Algorithms: Minimum Spanning Tree 1 2 3 4 6 5 10 1 5 4 3 2 6 1 1 8 Prim’s algorithm for finding a minimum spanning tree: 1. Starting from an empty tree, T, pick a vertex, v 0, at random and initialize: V’ = {v 0 } and E’ = {}. v0v0 2. Choose a vertex v not in V’ such that edge weight from v to a vertex in V’ is minimal and no cycle will be created if v and the edge are added to (V’, E’). Add v to V’ and the edge to E’.

7
Graph Algorithms: Minimum Spanning Tree 1 2 3 4 6 5 10 1 5 4 3 2 6 1 1 8 Prim’s algorithm for finding a minimum spanning tree: 1. Starting from an empty tree, T, pick a vertex, v 0, at random and initialize: V’ = {v 0 } and E’ = {}. v0v0 2. Choose a vertex v not in V’ such that edge weight from v to a vertex in V’ is minimal and no cycle will be created if v and the edge are added to (V’, E’). Add v to V’ and the edge to E’. Repeat until all vertices have been added.

8
Graph Algorithms: Minimum Spanning Tree 1 2 3 4 6 5 10 1 5 4 3 2 6 1 1 8 Prim’s algorithm for finding a minimum spanning tree: 1. Starting from an empty tree, T, pick a vertex, v 0, at random and initialize: V’ = {v 0 } and E’ = {}. v0v0 2. Choose a vertex v not in V’ such that edge weight from v to a vertex in V’ is minimal and no cycle will be created if v and the edge are added to (V’, E’). Add v to V’ and the edge to E’. Repeat until all vertices have been added.

9
Graph Algorithms: Minimum Spanning Tree 1 2 3 4 6 5 10 1 5 4 3 2 6 1 1 8 Prim’s algorithm for finding a minimum spanning tree: 1. Starting from an empty tree, T, pick a vertex, v 0, at random and initialize: V’ = {v 0 } and E’ = {}. v0v0 2. Choose a vertex v not in V’ such that edge weight from v to a vertex in V’ is minimal and no cycle will be created if v and the edge are added to (V’, E’). Add v to V’ and the edge to E’. Repeat until all vertices have been added.

10
Graph Algorithms: Minimum Spanning Tree 1 2 3 4 6 5 10 1 5 4 3 2 6 1 1 8 Prim’s algorithm for finding a minimum spanning tree: 1. Starting from an empty tree, T, pick a vertex, v 0, at random and initialize: V’ = {v 0 } and E’ = {}. v0v0 2. Choose a vertex v not in V’ such that edge weight from v to a vertex in V’ is minimal and no cycle will be created if v and the edge are added to (V’, E’). Add v to V’ and the edge to E’. Repeat until all vertices have been added.

11
Graph Algorithms: Minimum Spanning Tree 1 2 3 4 6 5 10 1 5 4 3 2 6 1 1 8 Prim’s algorithm for finding a minimum spanning tree: 1. Starting from an empty tree, T, pick a vertex, v 0, at random and initialize: V’ = {v 0 } and E’ = {}. v0v0 2. Choose a vertex v not in V’ such that edge weight from v to a vertex in V’ is minimal and no cycle will be created if v and the edge are added to (V’, E’). Add v to V’ and the edge to E’. Repeat until all vertices have been added. Done! Sum of edge weights: 1 + 3 + 4 + 1 + 1 = 10.

Similar presentations

© 2019 SlidePlayer.com Inc.

All rights reserved.

To make this website work, we log user data and share it with processors. To use this website, you must agree to our Privacy Policy, including cookie policy.

Ads by Google