
Graphs can feel abstract until students see one built in code. This lesson starts with a simple map of towns and roads, then stores it as an adjacency matrix in Python, so the link between the picture and the 2D array is really clear.
Students write AddEdge and GetNeighbours, meet the classic [[0] * 5] * 5 bug, and compare matrices with adjacency lists, which is exactly the kind of justification 9618 likes to ask for.
What’s included
- 16-slide editable teacher PowerPoint, with speaker notes on every slide
- Python starter code with guided TODOs and the full tested solution, in a Word file ready to copy into your editor (including an adjacency-list extension using a Python dictionary)
- Student worksheet (36 marks) in Word and PDF: completing an adjacency matrix, fill-the-gap code, spot-the-errors and exam-style questions
- Full answer key in Word and PDF
How the lesson runs
- A starter on modelling towns and roads
- What a graph is, with a weighted graph diagram
- Key vocabulary: vertex, edge, weight, directed and adjacency
- The adjacency matrix, AddEdge and GetNeighbours step by step
- A spot-the-bug slide on shared rows in Python
- A trace-table mini task with answers
- Adjacency matrix versus adjacency list
- A coding task, exam-style question with mark scheme, and exit ticket
Written for Cambridge International AS & A Level Computer Science (9618), Paper 4 Practical, and pitched at A Level (Year 13). Everything is editable, so you can adapt it for your own classes.
Please leave a review if you find it useful. It really helps!
Something went wrong, please try again later.
This resource hasn't been reviewed yet
To ensure quality for our reviews, only customers who have purchased this resource can review it
Report this resourceto let us know if it violates our terms and conditions.
Our customer service team will review your report and will be in touch.