OCR MEI D2 2009 June — Question 4 20 marks

Exam BoardOCR MEI
ModuleD2 (Decision Mathematics 2)
Year2009
SessionJune
Marks20
PaperDownload PDF ↗
Mark schemeDownload PDF ↗
TopicShortest Path
TypeFloyd's algorithm application
DifficultyModerate -0.8 This is a routine algorithmic question requiring mechanical application of Floyd's algorithm. Students must set up initial matrices from a diagram and understand the algorithm's iteration structure. While it involves multiple steps, it requires no problem-solving insight—just following a standard procedure taught directly in D2 courses. Easier than average A-level maths questions.
Spec7.04a Shortest path: Dijkstra's algorithm

4 The diagram shows routes connecting five cities. Lengths are in km . \includegraphics[max width=\textwidth, alt={}, center]{ae8dc840-0c61-4ba5-b082-1f5f3e6c2cef-4_442_995_319_534}
  1. Produce the initial matrices for an application of Floyd's algorithm to find the complete network of shortest distances between the five cities. The following are the distance and route matrices after the third iteration of Floyd's algorithm.
    \cline { 2 - 6 } \multicolumn{1}{c|}{}\(\mathbf { 1 }\)\(\mathbf { 2 }\)\(\mathbf { 3 }\)\(\mathbf { 4 }\)\(\mathbf { 5 }\)
    \(\mathbf { 1 }\)4422421515
    \(\mathbf { 2 }\)224420523
    \(\mathbf { 3 }\)4220402543
    \(\mathbf { 4 }\)155251016
    \(\mathbf { 5 }\)1523431630

Question 4:
Part (i)
AnswerMarks Guidance
AnswerMarks Guidance
Initial distance matrix with correct direct distances (e.g. \(d_{12}=15\), \(d_{14}=8+7=\) via reading graph, \(\infty\) where no direct route)B2 B1 one error
Initial route matrix with \(d_{ij}=j\) for all direct connectionsB2 B1 one error
Part (ii)
AnswerMarks Guidance
AnswerMarks Guidance
Fourth iteration uses node 4 as intermediateM1
Updated distances: e.g. \(d_{13}\): check via 4; \(d_{35}\) via 4 etc.M1
Correct updated distance matrixA1
Correct updated route matrixA1
Part (iii)
AnswerMarks Guidance
AnswerMarks Guidance
Read distance matrix: row 3, col 1 gives shortest distanceB1
Distance = 42 km (or value from completed matrix)B1
Route matrix: row 3 col 1 gives next node; trace through route matrixM1
Route traced correctly e.g. \(3 \to 2 \to 1\) or similar using route matrix entriesA1
Clear explanation of how route matrix is used to trace pathB1
Part (iv)
AnswerMarks Guidance
AnswerMarks Guidance
Complete network drawn with 5 nodes, correct shortest distances as edge weights, no loopsB1
All edges correctB1
Part (v)
AnswerMarks Guidance
AnswerMarks Guidance
Start at 2, nearest unvisited neighbour selected at each stageM1
Correct sequence of vertices visitedA1
Correct total length of Hamilton cycle statedA1
Interpretation: this represents a travelling salesman tour visiting each city onceB1
Statement of what achieved (upper bound for TSP on original network)B1
# Question 4:

## Part (i)
| Answer | Marks | Guidance |
|--------|-------|----------|
| Initial distance matrix with correct direct distances (e.g. $d_{12}=15$, $d_{14}=8+7=$ via reading graph, $\infty$ where no direct route) | B2 | B1 one error |
| Initial route matrix with $d_{ij}=j$ for all direct connections | B2 | B1 one error |

## Part (ii)
| Answer | Marks | Guidance |
|--------|-------|----------|
| Fourth iteration uses node 4 as intermediate | M1 | |
| Updated distances: e.g. $d_{13}$: check via 4; $d_{35}$ via 4 etc. | M1 | |
| Correct updated distance matrix | A1 | |
| Correct updated route matrix | A1 | |

## Part (iii)
| Answer | Marks | Guidance |
|--------|-------|----------|
| Read distance matrix: row 3, col 1 gives shortest distance | B1 | |
| Distance = 42 km (or value from completed matrix) | B1 | |
| Route matrix: row 3 col 1 gives next node; trace through route matrix | M1 | |
| Route traced correctly e.g. $3 \to 2 \to 1$ or similar using route matrix entries | A1 | |
| Clear explanation of how route matrix is used to trace path | B1 | |

## Part (iv)
| Answer | Marks | Guidance |
|--------|-------|----------|
| Complete network drawn with 5 nodes, correct shortest distances as edge weights, no loops | B1 | |
| All edges correct | B1 | |

## Part (v)
| Answer | Marks | Guidance |
|--------|-------|----------|
| Start at 2, nearest unvisited neighbour selected at each stage | M1 | |
| Correct sequence of vertices visited | A1 | |
| Correct total length of Hamilton cycle stated | A1 | |
| Interpretation: this represents a travelling salesman tour visiting each city once | B1 | |
| Statement of what achieved (upper bound for TSP on original network) | B1 | |
4 The diagram shows routes connecting five cities. Lengths are in km .\\
\includegraphics[max width=\textwidth, alt={}, center]{ae8dc840-0c61-4ba5-b082-1f5f3e6c2cef-4_442_995_319_534}\\
(i) Produce the initial matrices for an application of Floyd's algorithm to find the complete network of shortest distances between the five cities.

The following are the distance and route matrices after the third iteration of Floyd's algorithm.

\begin{center}
\begin{tabular}{ | c | c | c | c | c | c | }
\cline { 2 - 6 }
\multicolumn{1}{c|}{} & $\mathbf { 1 }$ & $\mathbf { 2 }$ & $\mathbf { 3 }$ & $\mathbf { 4 }$ & $\mathbf { 5 }$ \\
\hline
$\mathbf { 1 }$ & 44 & 22 & 42 & 15 & 15 \\
\hline
$\mathbf { 2 }$ & 22 & 44 & 20 & 5 & 23 \\
\hline
$\mathbf { 3 }$ & 42 & 20 & 40 & 25 & 43 \\
\hline
$\mathbf { 4 }$ & 15 & 5 & 25 & 10 & 16 \\
\hline
$\mathbf { 5 }$ & 15 & 23 & 43 & 16 & 30 \\
\hline
\end{tabular}
\end{center}

\hfill \mbox{\textit{OCR MEI D2 2009 Q4 [20]}}