| Exam Board | OCR MEI |
|---|---|
| Module | D2 (Decision Mathematics 2) |
| Year | 2009 |
| Session | June |
| Marks | 20 |
| Paper | Download PDF ↗ |
| Mark scheme | Download PDF ↗ |
| Topic | Shortest Path |
| Type | Floyd's algorithm application |
| Difficulty | Moderate -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. |
| Spec | 7.04a Shortest path: Dijkstra's algorithm |
| \cline { 2 - 6 } \multicolumn{1}{c|}{} | \(\mathbf { 1 }\) | \(\mathbf { 2 }\) | \(\mathbf { 3 }\) | \(\mathbf { 4 }\) | \(\mathbf { 5 }\) |
| \(\mathbf { 1 }\) | 44 | 22 | 42 | 15 | 15 |
| \(\mathbf { 2 }\) | 22 | 44 | 20 | 5 | 23 |
| \(\mathbf { 3 }\) | 42 | 20 | 40 | 25 | 43 |
| \(\mathbf { 4 }\) | 15 | 5 | 25 | 10 | 16 |
| \(\mathbf { 5 }\) | 15 | 23 | 43 | 16 | 30 |
| Answer | Marks | Guidance |
|---|---|---|
| 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 |
| Answer | Marks | Guidance |
|---|---|---|
| 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 |
| Answer | Marks | Guidance |
|---|---|---|
| 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 |
| Answer | Marks | Guidance |
|---|---|---|
| Answer | Marks | Guidance |
| Complete network drawn with 5 nodes, correct shortest distances as edge weights, no loops | B1 | |
| All edges correct | B1 |
| Answer | Marks | Guidance |
|---|---|---|
| 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 |
# 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]}}