module 5 – networks and decision mathematics chapter 23 – undirected graphs

5
Module 5 – Networks and Decision Mathematics Chapter 23 – Undirected Graphs

Upload: stella-hood

Post on 01-Jan-2016

214 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Module 5 – Networks and Decision Mathematics Chapter 23 – Undirected Graphs

Module 5 – Networks and Decision Mathematics

Chapter 23 – Undirected Graphs

Page 2: Module 5 – Networks and Decision Mathematics Chapter 23 – Undirected Graphs

23.5 Weighted Graphs

• A weighted graph is one where a number or value is associated with each edge. These values are called weights.

• Insert graph

• The numbers in the graph above represent the distance between each town in terms of Km.

• Numbers in weighted graphs may also represent times, lengths, people, cost, etc.

Page 3: Module 5 – Networks and Decision Mathematics Chapter 23 – Undirected Graphs

Trees • A tree is a connected graph that has no circuits. A tree does

not have multiple edges nor does it have enclosed areas.

A tree with n vertices has n-1 edges.

• Insert graphNo. of vertices = 7No. of edges = n – 1

= 7 – 1 = 6

Page 4: Module 5 – Networks and Decision Mathematics Chapter 23 – Undirected Graphs

Spanning Trees

• A spanning tree is a subgraph that contains all the vertices of the original graph and is a tree.

• A minimum spanning tree for a weighted graph is a spanning tree for which the sum of the weights of the edges is as small as possible.

Page 5: Module 5 – Networks and Decision Mathematics Chapter 23 – Undirected Graphs

Prim’s Algorithm

• Prim’s Algorithm is a set of rules to determine a minimum spanning tree for a graph.

1.Choose a vertex and connect to another vertex by choosing the smallest weight available.

2.In each following step, take the edge with the lowest value.3.Repeat until all the vertices are connected then stop.4.Calculate the sum of the weights.

• Insert example