0% found this document useful (0 votes)
24 views27 pages

D1 Minimum Connectors - Kruskal's

The document contains examples and explanations of using Kruskal's and Prim's algorithms to find minimum spanning trees in networks. It provides sample networks and asks students to apply the algorithms to find the minimum spanning trees and determine the total weights. It also asks students to compare the two algorithms.

Uploaded by

shees.iqbaal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views27 pages

D1 Minimum Connectors - Kruskal's

The document contains examples and explanations of using Kruskal's and Prim's algorithms to find minimum spanning trees in networks. It provides sample networks and asks students to apply the algorithms to find the minimum spanning trees and determine the total weights. It also asks students to compare the two algorithms.

Uploaded by

shees.iqbaal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 27

D1 Minimum connectors - Kruskal's PhysicsAndMathsTutor.

com

1.

The network in the diagram above shows the distances, in metres, between 10 wildlife
observation points. The observation points are to be linked by footpaths, to form a network
along the arcs indicated, using the least possible total length.

(a) Find a minimum spanning tree for the network in the diagram above, showing clearly the
order in which you selected the arcs for your tree, using

(i) Kruskal’s algorithm,


(3)

(ii) Prim’s algorithm, starting from A.


(3)

Given that footpaths are already in place along AB and FI and so should be included in the
spanning tree,

(b) explain which algorithm you would choose to complete the tree, and how it should be
adapted.
(You do not need to find the tree.)
(2)
(Total 8 marks)

Edexcel Internal Review 1


D1 Minimum connectors - Kruskal's PhysicsAndMathsTutor.com

2.

The diagram above represents the distances, in metres, between eight vertices, A, B, C, D, E, F,
G and H, in a network.

(a) Use Kruskal’s algorithm to find a minimum spanning tree for the network.
You should list the arcs in the order in which you consider them. In each case, state
whether you are adding the arc to your minimum spanning tree.
(3)

(b) Complete the matrix below, to represent the network.

A B C D E F G H
A – 31 30 – – – – –
B 31 – – – – – 38
C 30 – – 24 – –
D – – 18 – –
E – – 24 18 – 28 –
F – – – 28 – 21 –
G – – – – 21 –
H – 38 – – – –
(2)

Edexcel Internal Review 2


D1 Minimum connectors - Kruskal's PhysicsAndMathsTutor.com

(c) Starting at A, use Prim’s algorithm to determine a minimum spanning tree. You must
clearly state the order in which you considered the vertices and the order in which you
included the arcs.
(3)

(d) State the weight of the minimum spanning tree.


(1)
(Total 9 marks)

3.
A B C D E F
A – 24 – – 23 22
B 24 – 18 19 17 20
C – 18 – 11 14 –
D – 19 11 – 13 –
E 23 17 14 13 – 21
F 22 20 – – 21 –

The table shows the distances, in metres, between six vertices, A, B, C, D, E and F, in a
network.

Edexcel Internal Review 3


D1 Minimum connectors - Kruskal's PhysicsAndMathsTutor.com

(a) Draw the weighted network using the vertices given in Diagram 1 below.

Diagram 1
(3)

(b) Use Kruskal’s algorithm to find a minimum spanning tree. You should list the edges in
the order that you consider them and state whether you are adding them to your minimum
spanning tree.
(3)

(c) Draw your tree on Diagram 2 below and find its total weight.

Diagram 2
(2)
(Total 8 marks)

Edexcel Internal Review 4


D1 Minimum connectors - Kruskal's PhysicsAndMathsTutor.com

4.

(a) State two differences between Kruskal’s algorithm and Prim’s algorithm for finding a
minimum spanning tree.
(2)

(b) Listing the arcs in the order that you consider them, find a minimum spanning tree for the
network in the diagram above, using

(i) Prim’s algorithm,

(ii) Kruskal’s algorithm.


(6)
(Total 8 marks)

5. (a)

18 20 11 7 17 15 14 21 23 16 9

The list of numbers shown above is to be sorted into ascending order. Apply quick sort to
obtain the sorted list. You must make your pivots clear.
(5)

Edexcel Internal Review 5


D1 Minimum connectors - Kruskal's PhysicsAndMathsTutor.com

E
21
17
G
B 14
11 9

18 11
7 F I
23 16
A 20 C
H
15
11

The diagram above represents a network of paths in a park. The number on each arc represents
the length of the path in metres.

(b) Using your answer to part (a) and Kruskal’s algorithm, find a minimum spanning tree for
the network in the diagram above. You should list the arcs in the order in which you
consider them and state whether you are adding it to your minimum spanning tree.
(4)

(c) Find the total weight of the minimum spanning tree.


(1)
(Total 10 marks)

Edexcel Internal Review 6


D1 Minimum connectors - Kruskal's PhysicsAndMathsTutor.com

6.

D 17 E 21 G
15
20
A 19 32

24
30 I
C 25 F
38
21 12 31
27

B 45 H 39 J

Edexcel Internal Review 7


D1 Minimum connectors - Kruskal's PhysicsAndMathsTutor.com

The network in the diagram above shows the distances, in metres, between 10 wildlife
observation points. The observation points are to be linked by footpaths, to form a network
along the arcs indicated, using the least possible total length.

(a) Find a minimum spanning tree for the network in the diagram above, showing clearly the
order in which you selected the arcs for your tree, using

(i) Kruskal’s algorithm,


(3)

(ii) Prim’s algorithm, starting from A.


(3)

Given that footpaths are already in place along AB and FI and so should be included in the
spanning tree,

(b) explain which algorithm you would choose to complete the tree, and how it should be
adapted. (You do not need to find the tree.)
(2)
(Total 8 marks)

7.

A B C D E F
A – 7 3 – 8 11
B 7 – 4 2 – 7
C 3 4 – 5 9 –
D – 2 5 – 6 3
E 8 – 9 6 – –
F 11 7 – 3 – –

Edexcel Internal Review 8


D1 Minimum connectors - Kruskal's PhysicsAndMathsTutor.com

The matrix represents a network of roads between six villages A, B, C, D, E and F. The value in
each cell represents the distance, in km, along these roads.

(a) Show this information on the diagram below.

A B

F C

E D
(2)

(b) Use Kruskal’s algorithm to determine the minimum spanning tree. State the order in
which you include the arcs and the length of the minimum spanning tree. Draw the
minimum spanning tree.

A B

F C

E D
(5)

Edexcel Internal Review 9


D1 Minimum connectors - Kruskal's PhysicsAndMathsTutor.com

(c) Starting at D, use Prim’s algorithm on the matrix given below to find the minimum
spanning tree. State the order in which you include the arcs.

A B C D E F
A – 7 3 – 8 11
B 7 – 4 2 – 7
C 3 4 – 5 9 –
D – 2 5 – 6 3
E 8 – 9 6 – –
F 11 7 – 3 – –
(3)
(Total 10 marks)

8. (a) Define the terms

(i) tree,

(ii) spanning tree,

(iii) minimum spanning tree.


(3)

(b) State one difference between Kruskal’s algorithm and Prim’s algorithm, to find a
minimum spanning tree.
(1)

Edexcel Internal Review 10


D1 Minimum connectors - Kruskal's PhysicsAndMathsTutor.com

Figure 1

H
5
B 8

A
9 7
12
10

14 N
E
15

6 11
14
10
13

C
F

Edexcel Internal Review 11


D1 Minimum connectors - Kruskal's PhysicsAndMathsTutor.com

(c) Use Kruskal’s algorithm to find the minimum spanning tree for the network shown in
Fig. 1. State the order in which you included the arcs. Draw the minimum spanning tree
in Diagram 1 below and state its length.

Diagram 1
H

B
A

N
E

C
F

Order arcs included……………………………………………………………………………….

Length of minimum spanning tree………………………………………………………………...


(4)

Figure 2

Edexcel Internal Review 12


D1 Minimum connectors - Kruskal's PhysicsAndMathsTutor.com

H
50
B 80

A
90 70
120

140 100
N
E
150
110
60
140
100
130

C
F

Edexcel Internal Review 13


D1 Minimum connectors - Kruskal's PhysicsAndMathsTutor.com

Figure 2 models a car park. Currently there are two pay-stations, one at E and one at N. These
two are linked by a cable as shown. New pay-stations are to be installed at B, H, A, F and C.
The number on each arc represents the distance between the pay-stations in metres. All of the
pay-stations need to be connected by cables, either directly or indirectly. The current cable
between E and N must be included in the final network. The minimum amount of new cable is
to be used.

(d) Using your answer to part (c), or otherwise, determine the minimum amount of new cable
needed. Use Diagram 2 to show where these cables should be installed. State the
minimum amount of new cable needed.

Diagram 2
H

B
A

N
E

C
F
(3)
(Total 11 marks)

Edexcel Internal Review 14


D1 Minimum connectors - Kruskal's PhysicsAndMathsTutor.com

9. (a) Describe the differences between Prim’s algorithm and Kruskal’s algorithm for finding a
minimum connector of a network.
(3)

C 25 F

15
35 14

A 17 B 24
21
E

18 16 20

D 32 G

(b) Listing the arcs in the order that you select them, find a minimum connector for the
network in the diagram above, using

(i) Prim’s algorithm,

(ii) Kruskal’s algorithm.


(4)
(Total 7 marks)

Edexcel Internal Review 15


D1 Minimum connectors - Kruskal's PhysicsAndMathsTutor.com

10. This question should be answered on the page below.

15 8
B C
D

20 12
10 15 14

E
28
A 36
K

30 10
30

The diagram above shows a number of satellite towns A, B, C, D, E and F surrounding a city K.
The number on each edge give the length of the road in km.

(a) Use Dijkstra’s algorithm to find the shortest route from A to E in the network.
Show your working in the boxes provided on the answer sheet.
(8)

It is planned to link all the sites A, B, C, D, E and F and K by telephone lines laid alongside the
roads.

(b) Use Kruskal’s algorithm to find a minimum spanning tree for the network and hence
obtain the minimum total length of cable required. Draw your tree.
(6)
(Total 14 marks)

Edexcel Internal Review 16


D1 Minimum connectors - Kruskal's PhysicsAndMathsTutor.com

Sheet for use in answering this question

(a)

B 15 C 8
D

20 12
10 15 14

E
A 28
36 K

30 10
30 Permanent
Vertex
Labels
F Temporary Labels
KEY:

Length of Shortest Path:

...…………………………………………………………………………………….

Determination of shortest route:

...…………………………………………………………………………………….

...…………………………………………………………………………………….

...…………………………………………………………………………………….

...…………………………………………………………………………………….

...…………………………………………………………………………………….

(b) Minimum spanning tree

Total weight of minimum spanning tree: ……………………………………………

Edexcel Internal Review 17


D1 Minimum connectors - Kruskal's PhysicsAndMathsTutor.com

 BC 
1. (i) FH, AD, DE, CE, (not DC),  , (not AC), CF, HI, (not FI), IJ M1A1A1 3
 EG 
 BC 
(ii) AD, DE, EC,  , CF, FH, HI, IJ stop M1A1A1 3
 EG 

(b) Start off the tree with AB and FI, then apply Kruskal M1 A1 2
[8]

not CE 
2. (a) DE GF DC   EG (not EF not CF) AC (not AB) GH M1 A1 A1 3
 BD 
Note
1M1: Kruskal’s algorithm – first 4 arcs selected chosen correctly.
1A1: All seven non-rejected arcs chosen correctly.
2A1: All rejections correct and in correct order and at correct time.

(b)

A B C D E F G H
A - 31 30 - - - - -
B 31 - - 24 - - - 38
C 30 - - 22 24 29 - - B2, 1, 0 2
D - 24 22 - 18 - - 34
E - - 24 18 - 28 26 -
F - - 29 - 28 - 21 -
G - - - - 26 21 - 33
H - 38 - 34 - - 33 -

Note
1B1: condone two (double) errors
2B1: cao

(c) AC CD DE BD GE GF GH M1 A1 A1 3
Note
1M1: Prim’s algorithm – first four arcs chosen correctly, in order,
or first five nodes chosen correctly, in order.{A,C,D,E,B….}
1A1: First six arcs chosen correctly or all 8 nodes chosen correctly,
in order. {A,C,D,E,B,G,F,H}
2A1: All correct and arcs chosen in correct order.

Edexcel Internal Review 18


D1 Minimum connectors - Kruskal's PhysicsAndMathsTutor.com

(d) Weight: 174 B1 1


Note
1B1: cao

Starting at Minimum arcs required Nodes order


for M1
A AC CD DE DB ACDEB(GFH) 15234(768)
B BD DE DC BDEC(GFAH) (7)1423(658)
C CD DE DB CDEB(GFAH) (7)4123(658)
D DE DC DB DECB(GFAH) (7)4312(658)
E ED DC DB EDCB(GFAH) (7)4321(658)
F FG GE ED DC DB FGEDCB(AH) (7)654312(8)
G GF GE ED DC DB GFEDCB(AH) (7)654321(8)
H HG GF GE HGFE(DCBA) (8765)4321
[9]

3. (a)

M1
A1
A1 3
Note
1M1: More than 10 arcs
1A1: all arcs correct
2A1: all values correct

(b) CD, DE, reject CE, BE, reject BC, reject BD, BF, reject EF, AF M1 A1
11 13 14 17 18 19 20 21 22 A1 3
Note
1M1: First three arcs correctly chosen
1A1: All used acrs selected correctly
2A1: All rejected arcs selected in correct order

Edexcel Internal Review 19


D1 Minimum connectors - Kruskal's PhysicsAndMathsTutor.com

(c)

B1
Weight of tree 83 (m) B1 2
Note
1B1: CAO for arcs – numbers not needed. NO ft.
2B1: CAO 83, condone units
[8]

4. (a) e.g.
• Prims starts with any vertex, Kruskal starts with the shortest arc.
• It is not necessary to check for cycles when using Prim.
• Prims adds nodes to the growth tree, Kruskal adds arcs.
• The tree ‘grows’ in a connected fashion when using Prim.
• Prim can be used when data in a matrix form.
Other correct statements also get credit. B2,1,0 2
1B1: Generous one coprrect difference. If bod give B1
2B1: Generous two distinct, correct differences.

(b) (i) e.g. AC, CF, FD, DE, DG, AB. M1, A1, A1 3

(ii) CF, DE, DF, not CD, not EF, DG, not FG, not EG, AC, not AD, AB.
[18, 19, 20, not 21, not 21, 22, not 23, not 24, 25, not 26, 27]
M1, A1, A1 3

Edexcel Internal Review 20


D1 Minimum connectors - Kruskal's PhysicsAndMathsTutor.com

1M1: Prim’s algorithm – first three arcs chosen correctly, in order,


or first four nodes chosen correctly, in order.
1A1: First five arcs chosen correctly; all 7 nodes chosen correctly,
in order.
2A1: All correct and arcs chosen in correct order.
2M1: Kruskal’s algorithm – first 4 arcs selected chosen correctly.
1A1: All six non-rejected arcs chosen correctly.
2A1: All regions correct and in correct order and ta correct time.
E
B
27
19
A
D 22
25 G
20

C 18 F
[8]

5. (a) e.g.
18 20 11 7 17 15 14 21 23 16 9 M1
11 7 14 9 15 18 20 17 21 23 16 A1
11 7 9 14 18 20 17 16 21 23 A1ft
7 11 9 16 17 18 20 23 A1ft
9 11 16 18 20
11 18
7 9 11 14 15 16 17 18 20 21 23 A1 5

(b) CF M1
GI
{BC or BF(*) – accept one, reject one
{CD (*) A
EF (*)
DF (*)
HI (*) A1
BE (*)
AB (*)
AC (*)
EG (*)
Tree complete A1 4
(*) Needs letters

Edexcel Internal Review 21


D1 Minimum connectors - Kruskal's PhysicsAndMathsTutor.com

(c) 107 m B1 1
[10]

BC 
6. (a) (i) FH,AD,DE,CE, (not DC),   , (not AC), CF, HI,
EG 
(not FI), IJ stop M1 A1 A1 3
BC 
(ii) AD, DE, EC,   , CF, FH, HI, IJ stop M1 A1 A1 3
EG 
(b) Start off the tree with AB and FI, then apply Kruskal B2, 1, 0 2
[8]

A 7 B

11 4
7 3
F 8 2 C
7. (a) B1
3 9
5

E 6 D
B1 2

A B
(b) M1
F C

E D
 AC
BD,   , BC, Not CD, DE A1, A1
 DF
B1
Length = 18 km B1 5

(c) DB, DF, BC, CA, DE [5,2,4,1,6,3,] M1 A1 A1 3


[10]

8. (a) (i) A connected graph with no cycles, loops or multiple edges B1


(ii) A tree that includes all vertices B1
(iii) A spanning tree of minimum total length B1 3

Edexcel Internal Review 22


D1 Minimum connectors - Kruskal's PhysicsAndMathsTutor.com

(b) E.g.
• In Kruskal the shortest arc is added (unless it completes a
cycle), in Prim the nearest unattached vertex is added
• There is no need to check for cycles when using Prim,
but there is when using Kruskal B1 1
• In Prim the tree always “grows” in a connected fashion
• Kruskal starts with the shortest edge, Prim with any vertex

(c) BH, NF, HN, HA, BE, NC; length = 48 M1 A1; B1


B 5 H
8
A
9 7
N
E
6
13
C F B1 4

(d)
50
80
70
B1

60
130

New cable – 390m M1 A1 3


[11]

9. (a) e.g.: • In Prim the tree always ‘grows’ in a connected fashion; B3,2,1,0 3
• In Kruskal the shortest arc is added (unless it completes a cycle),
in Prim the nearest unattached vertex is added;
• There is no need to check for cycles when using Prim;
• Prim can be easily used when network given in matrix form
• Prim stats with a vertex, Kruskal with an edge

(b) (i) Either AC, AB, BD, BE, EF, EG (if starts at A or C)
or BD, BA, AC, BE, EF, EG (if starts at B or D)
or EF, EG, BE, BD, BA, AC (if starts at E or F)
or GE, EF, BE, BD, BA, AC (if starts at G) M1 A1
(ii) EF, AC, BD, BA, EG, BE M1 A1 4
[7]

Edexcel Internal Review 23


D1 Minimum connectors - Kruskal's PhysicsAndMathsTutor.com

10. (a)

B 20 15 C 35 8
20 35 D 43
45 43
20 12
10 15 14

E 57
A 0 28 60 58 57
0 36 K 30
36 30

10
30 30
Vertex Permanent
Label
F 30 Temporary Labels
30

Length of Shortest Path: 57 km B1


Determination of shortest route:
Label E – Label D = 57 – 43 = 14 (DE)
Label D – Label C = 43 – 35 = 8 (CD) M1 A1
Label C – Label B = 35 – 20 = 15 (BC)
Label B – Label A = 20 – 0 = 20 (AB)
Hence shortest route is A B C D E A1 8

Edexcel Internal Review 24


D1 Minimum connectors - Kruskal's PhysicsAndMathsTutor.com

(b) Minimum spanning tree


B C

20 8
12
A 10 D
K
14
10 E
F
CD (8)
BK (10)
KF (10)
CK (12)
DE (14)
Not KD (15) Cycle
Not BC (15) Cycle
AB (20)
Total weight of minimum spanning tree: 74 km (tree) B1
(weight) B1 6
[14]

Edexcel Internal Review 25


D1 Minimum connectors - Kruskal's PhysicsAndMathsTutor.com

1. No Report available for this question.

2. Around 45% of the candidates gained full marks on this question. Candidates were directed to
list the arcs in the order in which they included them in the tree, but many candidates did not do
so.
In part (a) a number of candidates only stated the arcs they were including in their tree and did
not state the arcs that they rejected, as they rejected them. Some candidates only referred to the
length of the arc rather than by its end vertices, this makes it difficult for the examiners to
determine which arc is being considered.
Part (b) was usually completed correctly.
In part (c) many candidates showed their working on the table but then did not list the arcs in
the correct order, often adding BD too late.
Many candidates completed part (d) correctly.

3. Almost all the candidates gained full marks in part (a), with only a few ambiguous numbers on
the diagonal arcs. There were also many fully correct solutions seen to part (b), although a few
did not make the rejected arcs clear. Good presentation can be a great time saver here, many
gave an ordered list of all arcs with just ticks and crosses by the rejections, others wrote long
sentences about their decision to reject, due to cycles forming. Not all candidates stated the
weight of the tree.

4. Part (a) caused problems for some candidates. Candidates were asked for differences between
the two algorithms and many simply made statements such as Prim uses nodes without going on
to say the Kruskal uses edges. A popular answer was to mention ordering the arcs into
ascending order for Kruskal; if this used as a difference candidates must indicate why this is
important when using the algorithm. There was the usual muddled use of basic technical
terminology. Some candidates muddled the two algorithms. Part (b) as usually well-answered
although some just drew their MST and did not list the arcs, in order, as instructed. Some
wasted time in Prim by converting to the matrix form. Some did not make their rejections clear
when applying Kruskal’s algorithm.

5. (a) Many excellent answers were seen here and the vast majority used the pivot selection seen
on the mark scheme. There were however a number of flawed solution seen also. The most
common errors were; random or inconsistent pivot choices; misordering of 21, 23, 16 on the
first pass, misordering of 11 and 9 on the third pass and not selecting 20 as a pivot; only
selecting one pivot per line. Some candidates used colour to indicate their pivots which should
be discouraged. A very few bubble sorts were seen. In part (b) almost all the candidates were
able to select the first two arcs, CF and GI but the three arcs of length 11 challenged many.
There was often a lack of clarity concerning the order in which edges were rejected. Those who
listed all the arcs, in order, and then ticked or crossed them gained the marks most efficiently.
Some candidates wasted a great deal of time (and space) drawing numerous diagrams, each
successive one having an extra arc.

Edexcel Internal Review 26


D1 Minimum connectors - Kruskal's PhysicsAndMathsTutor.com

6. There was a varied response to this question, with some very good and some quite poor
responses seen. Part (a) was generally better attempted than part (b). In part (a) the candidates
were asked to make the order in which they selected the arcs clear, many did not do this. Many
candidates wasted time by drawing a succession of diagrams showing the addition of one arc at
a time. Many candidates lost marks in Kruskal’s algorithm by not showing the rejection of the
arcs that created loops. In some attempts at Prim’s algorithm, many did not list the arcs and
others referred to rejecting arcs to prevent cycles from forming. Many wasted time in drawing a
matrix for Prim. Part (b) was often poorly done with many candidates opting for Prim despite
the two arcs not being connected. Of those who correctly selected Kruskal, only a few were able
to give a coherent explanation.

7. Almost all of the candidates were able to draw the arcs correctly but it was not always clear
which numbers went with which arcs, which lead to mistakes later. Most candidates were able
to perform Kruskal’s algorithm correctly although a number omitted to state that arc CD was
rejected. Most went on to correctly draw the minimum spanning tree, but units were often
omitted when stating its weight. Prim’s algorithm was less well done. Some did not show that
they had used the matrix, some started at A and many listed vertices instead of arcs.

8. The majority of candidates found part (a) tricky. There were some very poor definitions, poor
use of technical terms and muddled thinking seen. Candidates often did not write in complete
sentences, making it very difficult to understand the point they were trying to make. Part (b)
was usually better done although candidates confused arcs, vertices, nodes and edges and made
some worrying remarks about cycles. Part (c) was usually completed correctly. Part (d) caused
problems for some candidates, with some incorrect diagrams and incorrect answers of 54m,
540m and 39m often seen.

9. Very few candidates attempted a comparison in part (a). Most just described the two methods. A
significant number confused the two algorithms. There was some poor use of technical terms
seen. Part (b) was very well done with most candidates gaining full marks, but a few did not list
the arcs as requested. A surprising number of candidates seem to think that Prim’s algorithm
can only be applied to a matrix and wasted a lot of time in creating the matrix. Others wasted
time (and often went onto at least two extra sides of paper) by drawing a ‘cartoon sequence’
showing the state of the tree after each arc addition, rather than simply listing the arcs in order.

10. No Report available for this question.

Edexcel Internal Review 27

You might also like