minimal connector problems problem: a cable tv company is installing a system of cables to connect...
TRANSCRIPT
![Page 1: MINIMAL CONNECTOR PROBLEMS Problem: A cable TV company is installing a system of cables to connect all the towns in a region. The numbers in the network](https://reader035.vdocuments.net/reader035/viewer/2022080905/56649ce25503460f949adfaf/html5/thumbnails/1.jpg)
MINIMAL CONNECTOR PROBLEMSProblem:
A cable TV company is installing a system
of cables to connect all the towns in a region.
The numbers in the network show
distancesin miles.
![Page 2: MINIMAL CONNECTOR PROBLEMS Problem: A cable TV company is installing a system of cables to connect all the towns in a region. The numbers in the network](https://reader035.vdocuments.net/reader035/viewer/2022080905/56649ce25503460f949adfaf/html5/thumbnails/2.jpg)
F E
D
C
B
A
10
8 14
1215
13
1920
12
![Page 3: MINIMAL CONNECTOR PROBLEMS Problem: A cable TV company is installing a system of cables to connect all the towns in a region. The numbers in the network](https://reader035.vdocuments.net/reader035/viewer/2022080905/56649ce25503460f949adfaf/html5/thumbnails/3.jpg)
KRUSKAL’S ALGORITHM
Step 1 Rank the arcs in ascending order of weight
Step 2 Select the arc of least weight and use this tostart the tree
Step 3 Choose the next smallest arc and addthis to the tree UNLESS IT
COMPLETES A CYCLE in which casereject it and proceed to the next smallest arc
Step 4 Repeat Step 3 until all vertices areincluded in the tree
![Page 4: MINIMAL CONNECTOR PROBLEMS Problem: A cable TV company is installing a system of cables to connect all the towns in a region. The numbers in the network](https://reader035.vdocuments.net/reader035/viewer/2022080905/56649ce25503460f949adfaf/html5/thumbnails/4.jpg)
F E
D
C
B
A
10
8 14
1215
13
1920
12
Smallest arc:
FE (8)
F E8
List the arcs as you choose them
FE
Next smallest arc:
FD (10)
D
10
FD
DB (12)
B12 DB
Not DE because it produces a cycle
BC (13)
C
13
BC
AB (19)
A
19
AB
Not EC or DC as they produce cycles
You now have a minimal spanning tree
Total Length = 62
![Page 5: MINIMAL CONNECTOR PROBLEMS Problem: A cable TV company is installing a system of cables to connect all the towns in a region. The numbers in the network](https://reader035.vdocuments.net/reader035/viewer/2022080905/56649ce25503460f949adfaf/html5/thumbnails/5.jpg)
PRIM’S ALGORITHM
Step 1 Choose a starting vertex
Step 2 Connect it to the nearest vertex using the
least arc
Step 3 Connect the nearest vertex not in the tree,to the tree, using the least arc
Step 4 Repeat step 3 until all of the vertices areconnected
![Page 6: MINIMAL CONNECTOR PROBLEMS Problem: A cable TV company is installing a system of cables to connect all the towns in a region. The numbers in the network](https://reader035.vdocuments.net/reader035/viewer/2022080905/56649ce25503460f949adfaf/html5/thumbnails/6.jpg)
F E
D
C
B
A
10
8 14
1215
13
1920
12
Start with vertex A
Nearest is B so add AB
A
B
19
Arcs from A and B have lengths
20, 12 and 13
So choose BD (12)
List the arcs as you choose themAB
D12 BD
Arcs from A, B & D have lengths
13, 15, 12 and 10
So choose DF (10)
F
10 DF
Arcs from A, B, D, E & F have lengths
13, 15 and 14
So choose FE (8)
E8
FE
So choose BC (13)
Arcs from A, B, D & F have lengths
13, 15 and 8
C
13BC
You now have a minimal spanning tree
Total Length = 62
![Page 7: MINIMAL CONNECTOR PROBLEMS Problem: A cable TV company is installing a system of cables to connect all the towns in a region. The numbers in the network](https://reader035.vdocuments.net/reader035/viewer/2022080905/56649ce25503460f949adfaf/html5/thumbnails/7.jpg)
Both algorithms have led to the same minimal spanning treeBut the order of choosing the arcs is different
Kruskal gives: FE, FD, DB, BC, AB
Prim gives:
AB, BD, DF, FE, BC
That is why it is important to write down the arcs as you select them so that the examiner can tell whether or not you have used the correct algorithm