Beruflich Dokumente
Kultur Dokumente
Assignment
Distanc
e
12
5
22
12
7
8
16
0
17
15
33
4
G
7
22
8
12
12
16
I
F
15
17
33
E
Solution:
Step 1: Start from the home town A. Consider town A as a permanent node and all
other nodes as temporary ones. Go from A to all possible temporary nodes it linked
with. Label them .
(12,A)
22
7
8
12
12
16
I
(o,p)
15
5
17
33
E
(5,A)
Step 2. Determine whether all the nodes connecting with the P node are labeled. If
so find the minimum value containing T node and label it as permanent
.
(12,t)
22
7
8
12
12
16
I
(o,p)
5
(12,A)
22
C
A
(o,p)
(41,D)
(5,p)
12
15
(34,B)
G
7
17
E
12
33
H8
(37,D)
(49,G)
16
(53,F)
I
(46,E)
F
(59,H)
15
Once we are done with making all the nodes permanent the least distance way to A-I should
5
4
(22,C)
be chosen.
That is
17
33
C
E
A-B-D-G-I giving 49 km at a cost of Rs.2205(
49*45)
(5,A)
(55,E)
H
20
0
50
80
20
13
5
140
40
20
E
50
60
20
0
Vertex
Tree
Step 2. Fill in the first step in the table by adding all the nodes to the tree
Ste
Vertex
Tree
p
1
{A},{B}{C},{D{,{E},{F},{G},
Step3: Select the minimum distance from the network and enter it into the vertex.
By doing this you are connecting a node and it should be clearly included in the
tree.
Ste
Vertex
Tree
p
1
2
{D,E}
{A},{B}{C},{D{,{E},{F},{G},
{A},{B},{C},{D,E},{F},{G}
(D-E =20, E-G=20 Therefore you have two minimum distances that you can choose
from. I choose D-E)
Step3: Fill the table with minimum distances and entering them into vertex until
your tree has only one item that include all the nodes. Beware of the loops as you
go on.
Ste
Vertex
Tree
p
1
2
3
{D,E}
{E,G}
{A},{B}{C},{D{,{E},{F},{G},
{A},{B},{C},{D,E},{F},{G}
{A},{B},{C},{F},{D,E,G}
As you can see from the network as well as from the table ,D-E-G is now connected.
Ste
Vertex
Tree
p
1
2
3
4
5
{D,E}
{E,G}
{B,C}
{D,G}
{A},{B}{C},{D{,{E},{F},{G},
{A},{B},{C},{D,E},{F},{G}
{A},{B},{C},{F},{D,E,G}
{A},{ F},{D,E,G},{B,C}
As you can see, connecting DG, the next best distance creates a loop. Therefore, it
should be avoided
Ste
Vertex
Tree
p
1
2
3
4
5
6
7
{D,E}
{E,G}
{B,C}
{F,G}
{A,D}
{C,E}
{A},{B}{C},{D{,{E},{F},{G},
{A},{B},{C},{D,E},{F},{G}
{A},{B},{C},{F},{D,E,G}
{A},{ F},{D,E,G},{B,C}
{A},{D,E,F,G},{B,C}
{A,D,E,F,G},{B,C}
{A,B,C,D,E,F,G}
Final solution has been achieved with the 7 th step of the table.