Decision Math - Kruskal Algorithm

You might also like

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 37

Decision Maths

Networks
Kruskals Algorithm

Networks

Wiltshire

A Network is a weighted graph, which just means

there is a number associated with each edge.

The numbers can represent distances, costs, times in

real world applications.


Obvious examples include maps and similar
geographical networks.

Networks

Wiltshire

Minimum Connector Problem

Wiltshire

Basically you need to travel to every node using the least total

length.
Consider 4 houses in a Network shown in the diagram below. The
weight on each arc represents the distance between each house.
An Electricity company

wants to supply every


house by using as little
cable as possible.
Clearly the shortest possible route is to go from A to B to C and then

to D.
So 4 + 3 + 3 = 10, there is no shorter way of supplying every house .

Algorithms

Wiltshire

The previous example was a simple one and

the solution was very easy to spot.


For more complicated examples you will need
to use an algorithm.
An Algorithm is simply a list of instructions
that solve a particular problem.
(You will cover Algorithms in more depth later
on in the course)

Kruskal`s Algorithm

Wiltshire

There are 3 steps to follow in Kruskal`s Algorithm.


Step 1 Select the shortest arc in the
Step 2

Step 3

network.
Select the shortest arc from those
which are remaining. Ensure that
you do not create a cycle. If you do
ignore and move on to the next
shortest arc.
If all the vertices are connected then stop.
If not return to step 2.

Example
Consider the Network

below.

Wiltshire

It helps to rank the arcs

in increasing order.

Applying the Algorithm


1 Start by selecting

the smallest arc, AB


or DE, it makes no
difference.
Select AB.

Wiltshire

Applying the Algorithm


2 Now select the next

smallest, which is
DE.

Wiltshire

Applying The Algorithm


3 Next we can select CF or `

DF, again it makes no


difference. Lets pick DF.

Wiltshire

Applying the Algorithm.


Next select CF.

Wiltshire

Applying the Algorithm

Wiltshire

The next smallest length is EF. However there is already a route

from E to F, so this arc is not required.

Applying the Algorithm

Wiltshire

Adding CD will again create a loop so the last arc to add is AF.

All vertices are now joined so the problem is complete.

Question Ex 3a pg 66 q1

Wiltshire

Find the minimal spanning tree and associated

shortest distance for the network below:

Solution Ex 3a pg 66 q1

Wiltshire

Solution Ex 3a pg 66 q1

Wiltshire

Solution Ex 3a pg 66 q1

Wiltshire

Solution Ex 3a pg 66 q1

Wiltshire

Solution Ex 3a pg 66 q1

Wiltshire

Solution Ex 3a pg 66 q1

Wiltshire

Solution Ex 3a pg 66 q1

Wiltshire

Solution Ex 3a pg 66 q4

Wiltshire

Solution Ex 3a pg 66 q4

Wiltshire

Solution Ex 3a pg 66 q4

Wiltshire

Solution Ex 3a pg 66 q4

Wiltshire

Solution Ex 3a pg 66 q4

Wiltshire

Solution Ex 3a pg 66 q4

Wiltshire

Solution Ex 3a pg 66 q4

Wiltshire

Solution Ex 3a pg 66 q4

Wiltshire

Solution Ex 3a pg 66 q4

Wiltshire

Solution Ex 3a pg 66 q4

Wiltshire

Solution Ex 3a pg 66 q4

Wiltshire

Solution Ex 3a pg 66 q4

Wiltshire

Solution Ex 3a pg 66 q4

Wiltshire

Solution Ex 3a pg 66 q4

Wiltshire

Solution Ex 3a pg 66 q4

Wiltshire

Solution Ex 3a pg 66 q4

Wiltshire

You might also like