01 · Opening Challenge: Inspect Every Walkway Once
A campus robot must inspect each walkway exactly once. It may pass a building more than once. Could a route cover all the walkways without repeating one, and must the robot finish where it started?
Predict informally: Imagine tracing the network with a pencil without lifting it or drawing an edge twice. An arrival at a middle building usually needs a different walkway to leave. We will turn that observation into a precise test and then try an actual route.
Buildings and walkways
Connections at each building
Each walkway once?
Central question
Can the route use every edge exactly once? The word “edge” will mean a walkway; revisiting a building is allowed for this question.
02 · Learning Objectives and Three-Hour Guide
By the end of Week 13, you should be able to draw a small graph from a route description; identify vertices and edges; distinguish a walk, trail, path and cycle; read degree and adjacency representations; apply the Euler trail/circuit degree test to a connected graph; and justify a campus inspection route or explain why none exists.
| Class time | Essential work |
|---|---|
| 60 min | Human graph, vocabulary, degree and adjacency drawings |
| 50 min | Euler reasoning and degree-test challenges |
| 50 min | Major Case Study 4 setup and route sketch |
| 20 min | Route Inspector and exit check |
Classroom essentials Sections 01–11 and Practice 1–6. Optional self-study Colab and Practice 7. The campus case continues in Week 14 with a different route question.
03 · From a Map to a Graph
A graph describes objects and their connections. In our campus model, a vertex is a building and an edge is a two-way walkway directly connecting two buildings. Drawing positions do not affect which buildings are connected.
For a first tiny example, let V={A,B,C} and E={{A,B},{B,C},{A,C}}. Each pair in E is one undirected edge; {A,B} is the same edge as {B,A}. This triangle has three vertices and three edges.
Read the drawing, not its appearance
If we move vertex C on the page but preserve all three connections, it is still the same graph for today's route questions. If we add or remove a walkway, the edge set changes and so may the possible route.
We model one undirected walkway between a pair of buildings, with no walkway from a building to itself. These assumptions make the subsequent degree counts and adjacency table unambiguous.
04 · Walk, Trail, Path and Cycle
A walk is a sequence of vertices where each consecutive pair is joined by an edge. It may repeat vertices or edges. A trail is a walk with no repeated edge; a vertex may still repeat. A path is a walk with no repeated vertex. A cycle is a closed route returning to its starting vertex without repeating other vertices or edges.
| Route on triangle A–B–C–A | Walk? | Trail? | Path or cycle? |
|---|---|---|---|
| A–B–A | Yes | No: AB repeats | No |
| A–B–C | Yes | Yes | Path |
| A–B–C–A | Yes | Yes | Cycle, not a path with distinct endpoints |
For a path we do not call the closing repetition in a cycle a new distinct vertex; “cycle” names that special closed pattern. In our inspection task, the key restriction is on edges, so a trail is the useful type of route. A trail can revisit a building.
05 · Degree Counts Incident Walkways
The degree of a vertex is the number of edges meeting there. In the triangle A–B–C–A, each vertex has degree 2. Every edge contributes one to the degree of each of its two endpoints, so the sum of all degrees is twice the number of edges:
For the triangle: 2+2+2=6=2×3. This is a useful check on a small undirected graph. An odd-degree vertex has 1,3,5,… connections; an even-degree vertex has 0,2,4,… .
06 · Two Ways to Record Adjacency
Two vertices are adjacent if an edge joins them. For the triangle, a neighbor list says A: B,C; B: A,C; C: A,B. An adjacency matrix gives a 1 if a pair is directly connected and 0 otherwise.
| A | B | C | |
|---|---|---|---|
| A | 0 | 1 | 1 |
| B | 1 | 0 | 1 |
| C | 1 | 1 | 0 |
The matrix is symmetric because our walkways are two-way. Its diagonal entries are zero because the model has no walkway from a building back to itself. A row's 1s count that vertex's degree. We will use a compact neighbor list for the larger campus graph.
07 · Use Every Edge Exactly Once
An Euler trail uses every edge in the graph exactly once; it may start and end at different vertices. An Euler circuit is an Euler trail that returns to its starting vertex. In both cases, every edge must be included. These names describe a route condition, not a method for computing the route.
Triangle. A–B–C–A uses each of its three edges once and returns. It is an Euler circuit.
Chain A–B–C–D. A–B–C–D uses all three edges once and ends at D. It is an Euler trail, but no circuit exists.
Four-spoke star. The center joins four leaves. Any complete inspection would need to stop and restart at too many leaves; no Euler trail exists.
A simple cycle is also an Euler circuit if it includes every edge in the graph. But an Euler circuit in a larger graph may revisit a vertex and therefore need not be a simple cycle.
08 · Why Odd Degrees Matter
At a building used in the middle of a trail, each arrival needs a different edge for departure. Those edges pair up, so the degree at that building is even. The starting point of an open trail can have one unmatched departure, and its ending point can have one unmatched arrival. These are its two odd-degree vertices.
| Connected undirected graph | What the degree test says |
|---|---|
| All vertices have even degree | An Euler circuit exists (and hence an Euler trail). |
| Exactly two vertices have odd degree | An open Euler trail exists, from one odd vertex to the other; no Euler circuit. |
| More than two vertices have odd degree | No Euler trail exists. |
The test is stated here for a connected finite undirected graph: every building can be reached through the network. If two groups of walkways are disconnected, one uninterrupted route cannot inspect edges in both groups, regardless of the degree counts.
Check the three small graphs
The triangle has three even degrees and a circuit. The chain has degrees 1,2,2,1, so its two odd endpoints allow an open trail. The four-spoke star has four degree-1 leaves, so it has no Euler trail, even though the center has even degree 4.
09 · Major Case Study 4 Begins: Campus Inspection and Delivery Robot
Scenario. Five buildings are connected by six two-way walkways. The inspection robot must traverse each walkway exactly once. It may pass a building several times. We treat each named walkway as one edge, and assume all six are open and connected.
| Code | Building | Code | Building |
|---|---|---|---|
| L | Library | H | Hall |
| C | Café | G | Gate |
| S | Science Building |
The six walkways are LH, HC, CG, GL, LS, SH. In this undirected graph, LH and HL name the same walkway. Use the drawing to understand adjacency, then rely on the edge list when checking a route.
10 · Represent, Reason and Interpret
Represent the same graph in a neighbor list
| Building | Direct neighbors | Degree |
|---|---|---|
| L | H, G, S | 3 |
| H | L, C, S | 3 |
| C | H, G | 2 |
| G | C, L | 2 |
| S | L, H | 2 |
Check: 3+3+2+2+2=12=2×6, consistent with six edges. The graph is connected. Exactly two vertices, L and H, have odd degree. Therefore an open Euler trail exists starting at L and ending at H, or vice versa. A closed Euler circuit does not exist.
Test one route edge by edge
The consecutive walkways are LH, HC, CG, GL, LS, SH: all six appear once. Vertex L occurs twice, which is allowed in a trail. The route starts at L and ends at H, matching the two odd-degree vertices.
Interpret the decision
The robot can inspect every walkway once if it may finish at a different building. If the task additionally requires returning to L without reusing an inspected walkway, the requirement cannot be met on this graph. The model does not include travel time, walkway length, direction restrictions, or temporary closures.
11 · Route Inspector
Predict → Test → Explain Choose a start, then select one walkway at a time. Only a walkway touching your current building can be used next, and each walkway can be used once. Try L first; then try an even-degree building and explain what changes.
Build an inspection trail
Current building: · Walkways used: of 6
Choose an unused walkway touching L.
Route: L
Printable Route Inspector
Graph edges: LH, HC, CG, GL, LS, SH. Start at L. Record each consecutive walkway exactly once, then name the ending building.
| Step | Current building | Unused adjacent walkway chosen | Next building |
|---|---|---|---|
| 0 | L | — | — |
| 1 | ____ | ____ | ____ |
| 2 | ____ | ____ | ____ |
| 3 | ____ | ____ | ____ |
| 4 | ____ | ____ | ____ |
| 5 | ____ | ____ | ____ |
| 6 | ____ | ____ | ____ |
Explain: Why can L be visited twice? Why can this route not return to its starting building while using every edge once?
12 · Optional Colab: Read Neighbors and Degrees
Self-study · mathematics first Draw the campus graph and fill its neighbor table before running Python. A dictionary pairs a key with a value. Here a building code is a key, and its value is a list of directly adjacent building codes. The colon means “maps to”; commas separate entries.
neighbors = {
"L": ["H", "G", "S"],
"H": ["L", "C", "S"],
"C": ["H", "G"],
"G": ["C", "L"],
"S": ["L", "H"]
}
print(neighbors["L"])
Predict ["H", "G", "S"]. Notice that if L lists H, H also lists L: the walkway is two-way. The list contains neighbors, not a full inspection route.
Check degrees after the hand count
The familiar for loop visits each key. len(...) counts the entries in that neighbor list, so it reports the degree in this simple graph.
for building in neighbors:
print(building, len(neighbors[building]))
Predict L 3, H 3, C 2, G 2, S 2. Explain why degree data alone is used with the connectedness condition in the Euler test; the code here verifies the table but does not construct a route.
13 · Practice and Case Record
Use a small drawing or edge list for every route question. Selected solutions appear at the end.
- The graph has V={A,B,C,D} and E={{A,B},{B,C},{C,D}}. Find each degree and decide whether an Euler trail or circuit exists.
- For the triangle with edges AB, BC, CA, classify A–B–A, A–B–C, and A–B–C–A as walk/trail/path/cycle where applicable.
- The campus graph has edges LH, HC, CG, GL, LS, SH. Give the neighbors and degree of S. Check the sum of all degrees.
- Find an Euler trail on the campus graph different from L–H–C–G–L–S–H. List its six edges and justify why none repeats.
- Four leaves A, B, C, D each connect only to center O. Count odd-degree vertices. Could one trail use all four edges?
- A connected graph has exactly two odd-degree vertices P and Q. Where must an Euler trail begin and end? Can it be a circuit?
- Draw two disconnected triangles. All six vertices have degree 2. Explain why one uninterrupted route still cannot inspect every edge.
Major Case Study 4 record for Week 14
Submit the campus drawing or edge list, neighbor table, degree calculation, one valid inspection trail, and the assumptions used. Keep the graph available: in Week 14 we will ask a different question about visiting buildings rather than inspecting walkways.
14 · Common Mistakes
| Tempting move | Repair |
|---|---|
| Forbid revisiting any building on an inspection trail. | Only edges must be unique; a vertex may repeat. |
| Count LH and HL as two walkways. | They are the same undirected edge in this model. |
| Ignore the starting vertex when using the degree test. | With two odd vertices, start and finish at those vertices. |
| Conclude a circuit exists because an open trail exists. | A circuit needs all degrees even in a connected graph. |
| Use the degree test on a disconnected collection of edges. | Check connectedness as well as degree parity. |
| Call a route valid after using most, but not all, edges. | Write its edge list and verify every required edge appears exactly once. |
15 · Summary
- A graph consists of vertices and edges. For a two-way campus walkway, one undirected edge joins its two endpoint buildings.
- A trail cannot repeat an edge; a path cannot repeat a vertex. An Euler trail uses every edge once, and an Euler circuit also returns to its start.
- Degree counts incident edges; the sum of degrees equals twice the number of edges in a finite undirected graph.
- For a connected graph, all even degrees allow an Euler circuit; exactly two odd degrees allow an open Euler trail; more than two odd degrees do not allow one.
- The campus graph has odd endpoints L and H and admits an L-to-H inspection trail, conditional on the stated walkway assumptions.
16 · Visual Concept Map
17 · Looking Ahead
Week 14 returns to the campus graph and asks about visiting every building once, which is different from inspecting every walkway once. It also introduces crossing-free drawings and coloring a separate conflict graph. The Euler degree test from this week answers the edge question only.
Selected Solutions
Route Inspector
One valid L-to-H route is L–H–C–G–L–S–H, using LH, HC, CG, GL, LS, SH exactly once. It revisits L but no edge. Starting at an even-degree building cannot finish a trail covering every edge in this graph; its two odd-degree vertices must be the endpoints.
1 · Chain
Degrees are 1,2,2,1 for A,B,C,D. The connected graph has an open Euler trail A–B–C–D, no Euler circuit.
2 · Route vocabulary
A–B–A is a walk but not a trail because AB repeats. A–B–C is a walk, trail and path. A–B–C–A is a walk, trail and cycle; it also covers all three edges and is an Euler circuit on this triangle.
3 · Campus degree check
S has neighbors L and H, so degree 2. The full degree sum is 3+3+2+2+2=12=2×6.
4 · Another inspection trail
L–S–H–C–G–L–H uses LS, SH, HC, CG, GL, LH. Those are precisely the six different edges.
5 · Four-spoke star
A,B,C,D each have degree 1; O has degree 4. Four odd-degree vertices prevent an Euler trail.
6 · Odd endpoints
An Euler trail must begin at P and end at Q, or begin at Q and end at P. It cannot return to its start using every edge once, so it is not a circuit.
7 · Disconnected triangles
Degree parity alone is insufficient. One route cannot move from one component to the other through a graph edge, so it cannot cover both triangles without stopping or leaving the graph.