Connected Graphs and Walks
Everything from here on is about moving through a network. That needs two ideas first: whether a journey between two vertices is possible at all, and what a journey actually is once it has been written down.
Look at the diagram above. Starting at $A$, list every vertex you could reach by moving along edges. Is $E$ among them? Could any amount of cleverness get you there?
A graph is connected when it is in one piece, so that some route along edges joins every pair of vertices. A walk is such a route written down: an alternating sequence of vertices and edges, with each edge joining the vertices either side of it.
$$A \to B \to C \to B \to D$$
A walk may revisit anything it likes. It can return to a vertex it has already been to, and it can travel along the same edge twice. Restricting those repeats is what produces the more specialised journeys in the next lesson.
Know
- that a connected graph is one in which every pair of vertices is joined by some route along edges
- that a disconnected graph splits into components, each of which is connected
- that a walk is an alternating sequence of vertices and edges in which consecutive vertices are joined by the edge between them
Understand
- why connectedness must be checked before results such as Euler's formula are applied
- why a walk is permitted to repeat both vertices and edges
- why the length of a walk is one less than the number of vertices written down
Can Do
- decide whether a given graph is connected, and identify its components if not
- write down a walk between two given vertices and state its length
- check whether a proposed sequence of vertices is actually a walk in a given graph
A graph is connected if, starting from any vertex, you can reach any other by moving along edges. It is in one piece.
A graph that is not connected splits into components. Each component is itself connected, and no edge joins one component to another. The graph in the diagram has two components: $\{A, B, C, D\}$ and $\{E, F\}$.
To test connectedness, pick any vertex and explore. Mark it, mark everything reachable from it in one step, then everything reachable from those, and continue until nothing new appears. If every vertex has been marked, the graph is connected. If not, the marked vertices form one component and the argument repeats on what is left.
Starting vertex does not matter. If the graph is connected, exploring from any vertex reaches everything, so any choice settles the question.
Connectedness is a precondition for most of what follows, and questions state it for that reason rather than as decoration.
Euler's formula gives $2$ only for connected graphs; a graph in $k$ pieces gives $k + 1$, as Lesson 5 showed.
An Eulerian trail, coming in Lesson 8, uses every edge of the graph. If the graph has two components, no single journey can reach the edges of both, so the question is settled before it is asked.
A disconnected graph is not a broken graph. It is a perfectly good object that certain results simply do not apply to, and noticing which is part of using them correctly.
In applications the check is often the whole question. "Can every suburb reach the hospital?" is a connectedness question about the bus network, and the answer is yes exactly when the relevant vertices lie in one component.
A walk is a route through the network, written as an alternating sequence of vertices and edges. Each edge in the sequence must join the vertex before it to the vertex after it.
In practice only the vertices are written, since the edges are then implied:
$A \to B \to C \to B \to D$
That is a legitimate walk provided the edges $AB$, $BC$, $CB$ and $BD$ all exist. Note that it visits $B$ twice and uses the edge between $B$ and $C$ twice, once in each direction.
A walk has no restrictions at all beyond following existing edges. Repeats of every kind are allowed, and the next lesson is entirely about what happens when they are forbidden.
Where a graph has multiple edges between the same pair of vertices, the vertex list becomes ambiguous and the edges must be named as well, since it matters which of the two was used.
The length of a walk is the number of edges it uses, counting a repeated edge each time it is used.
The walk $A \to B \to C \to B \to D$ lists five vertices and has length $4$. In general the length is one less than the number of vertices written, because each step from one vertex to the next uses one edge.
A walk is closed if it finishes where it started, and open otherwise. The walk $A \to B \to C \to A$ is closed; $A \to B \to C$ is open.
A single vertex on its own counts as a closed walk of length $0$, which sounds like a technicality and matters when a definition has to cover every case without exception.
Open and closed is the second of the two questions that the next lesson uses to classify journeys, the first being which repeats are allowed.
Given a graph and a sequence of vertices, deciding whether it is a walk is mechanical: take the vertices in consecutive pairs and check each pair is joined by an edge.
For the graph with edges $PQ$, $QR$, $RS$, $SP$, the sequence $P \to Q \to R \to S$ is a walk, since $PQ$, $QR$ and $RS$ all exist.
The sequence $P \to R \to S$ is not, because there is no edge $PR$. The two vertices are both in the graph and are connected by a longer route, but a walk must list every vertex it passes through, and this sequence skips $Q$ or $S$.
This is the commonest error: writing the destinations rather than the route. A walk records every step, not the interesting stops.
Watch Me Solve It · 3 examples
-
1Explore from AFrom $A$ the edges reach $B$ and $C$. From $B$ the only new neighbour would be $C$, already found. From $C$, nothing new. The exploration stops with $\{A, B, C\}$.
-
2Note that vertices remain$D$, $E$, $F$ and $G$ were never reached, so the graph is not connected.
-
3Explore from an unreached vertexFrom $D$ the edges reach $E$ and $F$; from $F$ they reach $G$. That gives $\{D, E, F, G\}$, and nothing remains.
-
4State the componentsTwo components: $\{A, B, C\}$ and $\{D, E, F, G\}$. Each is connected within itself and no edge crosses between them.
-
1Find a short route$P \to Q \to R \to S$The edges $PQ$, $QR$ and $RS$ all exist, so this is a walk. It lists four vertices and uses three edges, so its length is $3$.
-
2Find a longer route$P \to Q \to T \to S \to R \to S$Uses $PQ$, $QT$, $TS$, $SR$, $RS$, all of which exist. Five edges, so length $5$.
-
3Note what makes the second one legalIt visits $S$ twice and uses the edge between $R$ and $S$ twice. Both are permitted, because a walk has no restriction on repeats.
-
4Check the length ruleThe second walk lists six vertices and has length $5$, one less, as expected.
-
1Check the firstThe pairs are $AC$ and $CD$. Both edges exist, so this is a walk of length $2$.
-
2Check the secondThe pairs are $AB$ and $BD$. The edge $AB$ exists but $BD$ does not, so this is not a walk. $B$ and $D$ are connected in the graph, but not directly, and a walk cannot skip the vertices in between.
-
3Check the thirdThe pairs are $AB$, $BC$, $CA$ and $AD$. All four edges exist, so this is a walk of length $4$, despite visiting $A$ twice.
-
4Summarise the testTake consecutive pairs and check each is an edge. Nothing else is required, and repeats never disqualify a walk.
Brain Trainer · 5 problems
Five items on connectedness and walks. For each proposed walk, check consecutive pairs against the edge list.
-
1 A graph has edges $AB$, $BC$, $DE$. Is it connected?
Explore from $A$: you reach $B$ and $C$ but never $D$ or $E$.No; two components -
2 How many components does a graph with edges $PQ$, $QR$, $ST$, $UV$ have?
$\{P, Q, R\}$, $\{S, T\}$ and $\{U, V\}$.$3$ -
3 A walk lists $7$ vertices. What is its length?
Each step between consecutive vertices uses one edge.$6$ -
4 In a graph with edges $AB$, $BC$, $CD$, is $A \to B \to A \to B \to C$ a walk?
Every consecutive pair must be an edge; repeats are allowed.Yes, of length $4$ -
5 In a graph with edges $AB$, $BC$, $CD$, is $A \to C$ a walk?
Check whether $AC$ is an edge.No
Multiple Choice · 5 questions
A graph is connected when:
A graph has vertices $A$ to $F$ with edges $AB$, $BC$, $DE$. The number of components is:
The walk $A \to B \to C \to B \to D \to E$ has length:
In a graph with edges $PQ$, $QR$, $RS$, $SP$, which sequence is NOT a walk?
A question says "a connected planar graph". The word connected is there because:
Short Answer · 3 questions
Connected means reachable, not adjacent
Every pair of vertices must be joined by some route, however long. A graph that is not connected splits into components, each connected within itself.
Check it before applying results
Euler's formula gives $2$ only when the graph is connected, and an Eulerian trail is impossible across two components.
A walk allows every repeat
It is an alternating sequence of vertices and edges with each edge joining its neighbours. Vertices and edges may be revisited freely.
Length counts edges
One less than the number of vertices listed, counting a repeated edge each time it is used. A closed walk finishes where it started.
Your Badges
0 of 6Mark lesson as complete
Tick when you've finished Learn, Practice and the Stretch. Earns +90 XP and +25 coins.