Q2a Dijkstra
Q2a Dijkstra
Q2a Dijkstra
com
1.
The figure above shows a network of roads. The number on each arc represents the length of
that road in km.
(a) Use Dijkstra’s algorithm to find the shortest route from A to J. State your shortest route
and its length.
(5)
(b) Explain how you determined the shortest route from your labelled diagram.
(2)
(c) Find a shortest route from A to J that does not include CF and state its length.
(2)
(Total 9 marks)
2.
The diagram above shows a network of cycle tracks within a national park. The number on each
arc represents the time taken, in minutes, to cycle along the corresponding track.
(a) Use Dijkstra’s algorithm to find the quickest route from S to T. State your quickest route
and the time it takes.
(6)
(b) Explain how you determined your quickest route from your labelled diagram.
(2)
3.
The diagram above represents a network of paths. The number on each arc gives the time, in
minutes, to travel along that path.
(a) Use Dijkstra’s algorithm to find the quickest route from A to H. State your quickest route
and the time taken.
(5)
Kevin must walk along each path at least once and return to his starting point.
(b) Use an appropriate algorithm to find the time of Kevin’s quickest possible route, starting
and finishing at A. You should make your method and working clear.
(5)
(Total 10 marks)
4.
The diagram above represents a network of roads. The number on each arc gives the length, in
km, of that road.
(a) Use Dijkstra’s algorithm to find the shortest distance from A to I. State your shortest
route.
(6)
5.
The diagram above shows a network of roads through eight villages, A, B, C, D, E, F, G and H.
The number on each arc is the length of that road in km.
(a) Use Dijkstra’s algorithm to find the shortest route from A to H. State your shortest route
and its length.
(5)
There is a fair in village C and you cannot drive through the village. A shortest route from A to
H which avoids C needs to be found.
6.
The diagram above shows a network of roads. The number on each arc represents the length, in
km, of that road.
(a) Use Dijkstra’s algorithm to find the shortest route from A to I. State your shortest route
and its length.
I
12
25
H
14
17
30
F
19
G
6
11
18
10
14
D
B
6
7
8
(5)
Sam has been asked to inspect the network and assess the condition of the roads. He must travel
along each road at least once, starting and finishing at A.
(b) Use an appropriate algorithm to determine the length of the shortest route Sam can travel.
State a shortest route.
B 27 E
28 11 G
23
37
21
D
56
A
15 I
21
44
20
F
39 20
44 27
83 H
C
The figure above shows a network of cycle tracks. The number on each edge represents the
length, in miles, of that track. Mary wishes to cycle from A to I as part of a cycling holiday. She
wishes to minimise the distance she travels.
(b) Use Dijkstra’s algorithm to find the shortest path from A to I. Show all necessary working
in the boxes in the diagram below in the answer book. State your shortest path and its
length.
E Order
of Final
B Vertex
labelling value
27
Working values
G
28 11
23 37
D
56
A 15 21
21
I
20 44
39 F
44
C 20
27
83
H
PhysicsAndMathsTutor.com
15
D1 Dijkstra PhysicsAndMathsTutor.com
Length..........................................................................................................................
(6)
(c) Explain how you determined the shortest path from your labelling.
.....................................................................................................................................
.....................................................................................................................................
.....................................................................................................................................
.....................................................................................................................................
.....................................................................................................................................
.....................................................................................................................................
.....................................................................................................................................
.....................................................................................................................................
.....................................................................................................................................
.....................................................................................................................................
.....................................................................................................................................
.....................................................................................................................................
.....................................................................................................................................
.....................................................................................................................................
.....................................................................................................................................
.....................................................................................................................................
(2)
(d) Find a path of minimal length that goes from A to I via E and state its length.
Route...........................................................................................................................
Length.........................................................................................................................
(2)
(Total 12 marks)
8.
B 27 G
18 6 15
17
E
15 12
18 C H 11
A J
4
10 17
3
15 13
14 F 13
D 29 I
This figure shows a network of roads. The number on each arc represents the length of that road
in km.
(a) Use Dijkstra’s algorithm to find the shortest route from A to J. State your shortest route
and its length.
(5)
(b) Explain how you determined the shortest route from your labelled diagram.
(2)
(c) Find the shortest route from A to J that does not include CF and state its length.
(3)
(Total 10 marks)
9.
B 147 F
124 118
95
75
A 101 102 H
C E
125 74 135
67 78
G
D
The diagram above shows a network of paths. The number on each arc gives the distance, in
metres, of that path.
124 118
95
75
A C 101 E H
102
78
125 74 67 135 KEY
D G Order of Final
Vertex
labelling value
Working values
(ii) Solve the route inspection problem for the network shown in the diagram. You should
make your method and working clear. State a shortest route, starting at A, and find its
length.
10.
Figure 1
70 + 2x 40 + 5x
A
B
60 50
70 30
C
F E
30 40
90 70
130 140
95
D
I
50 80
H
Peter wishes to minimise the time spent driving from his home H, to a campsite at G. Figure 1
shows a number of towns and the time, in minutes, taken to drive between them. The volume of
traffic on the roads into G is variable, and so the length of time taken to drive along these roads
is expressed in terms of x, where x ≥ 0.
(a) On the diagram below, use Dijkstra’s algorithm to find two routes from H to G (one via A
and one via B) that minimise the travelling time from H to G. State the length of each
route in terms of x.
70 + 2x 40 + 5x
A
B
70 60 50 30
F 30 C 40 E
90 70
130 140 95
D
I
80
50
KEY
H Order of Final
Vertex
labelling Value
Working Values
(7)
(b) Find the range of values of x for which Peter should follow the route via A.
(3)
(Total 10 marks)
11.
Figure 1
A 15 F
3 D 8
22
B 8 2
S 18 G 10 T
3
E 6
17
6 7 11
C
15
H
Figure 1 shows a network of roads. The number on each edge gives the time, in minutes, to
travel along that road. Avinash wishes to travel from S to T as quickly as possible.
(a) Use Dijkstra’s algorithm to find the shortest time to travel from S to T.
22 3 D 8
2
8
S B G 10 T
18
3 6
E
11
17 6
C 7 H
15
KEY
Order of Final
Vertex Labelling Value
Working values
PhysicsAndMathsTutor.com
23
(4)
D1 Dijkstra PhysicsAndMathsTutor.com
(b) Find a route for Avinash to travel from S to T in the shortest time. State, with a reason,
whether this route is a unique solution.
(2)
(c) Find a route of minimal time from S to T that includes C, and state its time.
(2)
(Total 8 marks)
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)
(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:
...…………………………………………………………………………………….
...…………………………………………………………………………………….
...…………………………………………………………………………………….
...…………………………………………………………………………………….
...…………………………………………………………………………………….
...…………………………………………………………………………………….
1. (a)
M1 A1 A1 ft A1 ft
Route: AC F EG J
Length: 53 km A1 5
2. (a)
M1 A1 A1 ft A1
Route: SBEFHT B1
Time: 87 minutes B1 ft 6
Note
1M1: Smaller number replacing larger number in the working
values at C or D or G or H or T. (generous – give bod)
1A1: All values in boxes S, A, B, E and F correct
2A1ft: All values in boxes C and D (ft) correct. Penalise order
of labelling errors just once.
3A1: All values in boxes G, H and T correct
1B1: CAO (not ft)
2B1ft: Follow through from their T value, condone lack of units here.
3. (a)
4. (a)
M1
1A1
2A1ft
3A1ft
4A1ft
Route: A E H I 5A1
Note
1M1: Small replacing big in the
working values at C or F or
G or I
1A1: Everything correct in boxes at
A, B, D and F
2A1ft: ft boxes at E and C handled correctly
but penalise order of labelling only once
3A1ft: ft boxes at G and H handled correctly
but penalise order of labelling only once
4A1ft: ft boxes at I handled correctly but penalise
order of labelling only once
5A1: route cao A E H I
5. (a)
M1A1A1ft
Shortest route: A B C E G H A1
Length: 156 (km) A1ft 5
Note
1M1: Dijkstra’s algorithm, small replacing larger in at least one of the
sets of working values at C, E, G or H
1A1: Values correct at vertices A to E.
2A1ft: Values correct at vertices F to H, penalise order only once.
3A1: cao
4A1ft: 156ft
6. (a)
D 4 8 11 G 6 19
8 19
17
8
30
H 8 36
A 0 C 6 E 18 19
1 6 2 14 5 38 37 36
0 6 20 18
12
6 14
7
B 3 7 F 7 24 I 9 48
7 18 25 24 25 49 48
M1A1A1ft
Route: ADGH A1
Length: 48 (km) A1ft 5
7. (a) A path is a (finite) sequence of edges, such that the end vertex
of one edge is the start vertex of the next and in which no vertex
appears more than once/no cycles. B2,1,0 2
B2 A good, complete answer
B1 Close – mostly there. “Bad” sets B1, “route” series may be
OK
8. (a)
B 3 17 27 G 7 38
17 44 38
18 6
17 15
E 6 32
15 35 33 32
A 1 0 18 C 4 18 12 H 9 44 11 J 10 53
18 4 45 44 (44) 53(54)(55)
10 17
F 5 28 3 13
15 29 28
14 13
D 2 15 I 8 41
15 29 44 41
M1 A1 A1ft A1ft
Route: A C F E G J
length: 53 km A1 3
M1 in E or F or G or H or I w.v. large replaced by small
A1 A, B, C, D, F correct (order in rising sequence)
A1ft E G I correct + labelling (penalise order of labelling
only once)
A1ft H, J correct + labelling (penalise order of labelling once
A1 Route + length (both) condone lack of km
9. (i)
M1 A1 A1ft A1ft
shortest distance is 385 m A1 5
10. (a)
G
165+5x ,265+2x
B 8 195 A 5 125
240 195 125
F 6 130 C 7 135 E 4 95
130 (140) 140 135 (175)(160) 95 (150)
I 2 50 D 3 80
50 80
H 1 0
0
M1A1A1ftA1ft 4
Via A HEAG length 165 + 5x M1A1
Via B HECBG length 265 + 2x A1 3
1
(b) 165 + 5x < 265 + 2x ⇒ x , 33 M1A1ft
3
1
so range is 0 ≤ x < 33 A1ft 3
3
[10]
11. (a) M1 A1 A1 ft
Time = 37 minutes A1 ft 4
(b) Either S – A – D – G – T or S – B – E – G – T A1 ft
Not unique, e.g. gives other path A1 ft 2
(c) S–C–E–G–T 39 minutes M1 A1 2
[8]
12. (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
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]
2. Most candidates were able to gain some marks in part (a) but many made errors and only the
most able gained full marks. As always, candidates are reminded that it is the order of the
working values that is key for examiners to determine if the algorithm has been applied
correctly. Many candidates made errors at C, either labelling it fourth due to its position or
omitting at least one of the four working values. Most candidates were able to determine the
correct route.
A full demonstration of the appropriate calculations in part (b) tended to earn both marks,
whereas more generalised explanations tended to omit some key point.
Part (c) was usually answered correctly though EFT was also seen.
3. This was generally well done, with most candidates using the boxes sensibly to make their
working clear, however some candidates listed their working values in the wrong order and
others did not state the correct order of labeling, with F and G often incorrectly ordered. The
correct shortest path and its length were frequently seen. The method was usually correct, in
part (b), with three pairs being found. However, only the better candidates got all three values
correct. Few seemed to make use of the result found in part (a) with 37 frequently stated as the
value of AH. This part also saw a proliferation of basic arithmetical errors. Values seen were
AB + CH = 43, 44, 45, 46, 59; AC + BH = 42; AH + BC = 55, 59, 61, 62, 63, 64. Some went to
the trouble of listing a possible route but then sometimes did not state its length.
4. Many candidates found part (a) straightforward and gained full marks, but candidates are
reminded that it is the order of the working values that is key for examiners to determine if the
algorithm has been applied correctly. Many candidates missed the shortcut to C, giving the third
(and smallest) value of 21, coming from D and it appeared that some candidates were working
‘geographically’ left to right through the network rather in order of their arithmetic nearness to
A. This isconception often led to incorrect, additional or incorrectly ordered working values
particularly at C, D, G and I. Many candidates did not read part (b) of the questions carefully
and stated the shortest distance from A to I rather than A to G.
5. Most candidates were able to make progress in part (a) and there were many fully correct
responses. There were a lot of errors seen in the order of, and calculation of, the working values
and in the order of labelling. It is essential that the working values are listed in the correct order
if the candidates are to gain full credit. Many candidates found the correct new route in (b)
although a few found one of the slightly longer routes (ABEH or ABDGH) of length 166.
6. Most candidates found part (a) straightforward and gained full marks, but candidates are
reminded that it is the order of the working values that is key for examiners to determine if the
algorithm has been applied correctly. Many gained full, or nearly full marks in (b) with errors
mostly due to stating an incorrect inspection route (C was frequently omitted). Some wasted
time finding the shortest route from A to H from scratch, rather than using their working for part
(a), Dijkstra’s algorithm finds the length of the shortest route from the start to all intermediate
points. Others wasted time finding the weight of the network even though it was given to them.
7. Once again the use of technical terms was very confused and very few candidates were able to
give a full, clear definition in part (a), but most were able to gain some credit. The rest of the
question proved accessible to most candidates, with some weaker candidates gaining a lot of
their marks here. There were, of course, the usual problems with candidates listing the working
values in any order in their working for part (b). Candidates must list the working values in the
order in which they occur if they are to demonstrate that they are using the algorithm properly.
This carelessness was a major source of mark loss for some candidates. Mistakes often appeared
at D and E, 62 often being seen as an extra working value at E with the orders of these 2 vertices
reversed. In part (c) candidates who listed the subtractions they had used, together with listing
the arcs this indicated, were usually much more successful than those who attempted a more
general explanation, but it was noted that the general quality of the response to this part of the
question has improved.
8. Candidates had to apply Dijkstra’s algorithm very carefully to obtain full marks in part (a) and
many were able to do this. There are still a few candidates who treat this as a sort of
‘minimising critical path’ forward pass however. The examiners use the working values and the
order in which they occur in the box as the main confirmation that Dijkstra’s algorithm has been
correctly applied, thus it is important that they are legible and that candidates do write them in
order. The order of the working values at E, G, I and H were often incorrect, and the working
values at E, G and H were often incorrect. Most candidates were able to find the correct route
and length. Those that gave a numerical demonstration in part (b) gained full marks most easily,
but those who gave a general explanation often missed out part of the process. Many candidates
were able to score full marks in part (c).
9. This was mostly well done, but Dijkstra’s algorithm had to be very carefully applied to gain full
marks. Common errors were to award a final label to vertex C before vertex E and an incorrect
order of working values. Some candidates did not write down the shortest distance, but wrote
down the shortest route instead. Some candidates did not realise what was being asked in part
(ii) and explained how they achieved their shortest route from their labelled diagram. The
majority, who did attempt the route inspection, were usually fairly successful. The commonest
error was to state that the pairing BG + CD = 348. Most were able to state a correct route and its
length.
10. Part (a) was mostly well done, but a large number of candidates did not make their use of
Dijkstra’s algorithm clear, writing down the working values in any order, and even returning to
vertices already awarded their final label. There were also errors in labelling the vertices e.g.
with two vertices given the same number. There were often errors in listing the routes and the
expressions, with 270 + 2x and HCBG often seen. In part (b) disappointingly few candidates set
up the correct inequality and solved it. Many used trial and improvement with little success.
Many candidates omitted 0 = x from their final answer.
11. This was often well answered by the majority of the candidates. It is essential that the working
values are in written in the order in which they occur, if correct use of Dijkstra’s algorithm is to
be inferred. The values at D, E, H and T were often in the wrong order and the order of labelling
of A and R was often transposed. Parts (b) and (c) were usually well answered. Some candidates
clearly did not understand the word ‘unique’.