Discrete MathematicsGraphs, Paths and Circuits4 of 6
Graphs, Paths and Circuits · 4

Paths, Cycles and Connectivity

In any network of vertices and edges, we need a way to describe how to travel from one vertex to another and find what it takes to break the network apart.

1

Walks, Trails, Paths, and Cycles

To travel from one vertex to another along the edges of a graph, we classify a route by whether it repeats edges or vertices.

Walks, Trails, Paths, and Cycles
AA
BB
CC
DD
EE
Text solution
Spot the repeated vertexIn the walk from AA to EE, vertex B\repeated{B} is visited twice, which means every step between the first B\repeated{B} and the second B\repeated{B} is an unnecessary detour.
A→B→C→B⏟repeated-vertex detour→D→E\displaystyle \route{A \to} \underbrace{\repeated{B \to C \to B}}_{\text{repeated-vertex detour}} \route{\to D \to E}
Snip out the detourCutting out the loop B→C→B\repeated{B \to C \to B} and keeping a single B\route{B} leaves a route with no repeated vertices or edges.
A→B→D→E⏟path (no repeated vertices)\displaystyle \underbrace{\route{A \to B \to D \to E}}_{\text{path (no repeated vertices)}}
Check closed routes for repeated middle verticesOn the figure-eight graph, tracing both triangles uses each edge once but passes through the shared vertex C\repeated{C} twice, while tracing a single triangle returns to AA without repeating any middle vertex.
A→B→C→D→E→C→A⏟circuit (repeats vertex C),A→B→C→A⏟cycle (only start vertex repeats)\displaystyle \begin{aligned} &\underbrace{\route{A \to B \to} \repeated{C} \route{\to D \to E \to} \repeated{C} \route{\to A}}_{\text{circuit (repeats vertex } \repeated{C}\text{)}}, \\ &\underbrace{\route{A \to B \to C \to A}}_{\text{cycle (only start vertex repeats)}} \end{aligned}

Whenever a walk revisits a vertex, the steps between the first and last visit form a closed detour that can be snipped out without breaking the connection between the endpoints.

Repeating an edge always repeats a node, and cutting out the detours between repeated nodes turns any walk into a path.
2

Connected Components, Bridges, and Cut Vertices

Knowing when a path exists between two vertices lets us test whether an entire network holds together in one piece, or whether a single failed edge or vertex can split it into separate connected components.

Connected Components, Bridges, and Cut Vertices
AA
BB
CC
DD
EE
FF
Text solution
Test an edge by looking for a cycleWhen two triangles A-B-CA\text{-}B\text{-}C and D-E-FD\text{-}E\text{-}F are joined by a single edge CF\breaks{CF}, cutting AB\breaks{AB} leaves the alternate route A→C→B\backup{A \to C \to B} around its triangle, whereas CF\breaks{CF} sits on no cycle and has no backup route.
Cut AB:A→C→B⏟detour around cycle,Cut CF:{A,B,C}    ∣    {D,E,F}⏟bridge splits graph into 2 components\displaystyle \begin{aligned} &\text{Cut } \breaks{AB}: \\ &\quad \underbrace{\backup{A \to C \to B}}_{\text{detour around cycle}}, \\[6pt] &\text{Cut } \breaks{CF}: \\ &\quad \underbrace{\firstpiece{\{A, B, C\}} \;\; \mid \;\; \secondpiece{\{D, E, F\}}}_{\text{bridge splits graph into 2 components}} \end{aligned}
Test a vertex where cycles meetIn the figure-eight graph made of triangles A-B-CA\text{-}B\text{-}C and C-D-EC\text{-}D\text{-}E, every edge is protected by a 3-cycle so there are zero bridges, but deleting vertex C\breaks{C} takes down all four of its edges and strands {A,B}\firstpiece{\{A, B\}} from {D,E}\secondpiece{\{D, E\}}.
Delete C:{A,B}    ∣    {D,E}⏟cut vertex splits graph despite 0 bridges\displaystyle \text{Delete } \breaks{C}: \quad \underbrace{\firstpiece{\{A, B\}} \;\; \mid \;\; \secondpiece{\{D, E\}}}_{\text{cut vertex splits graph despite 0 bridges}}

An edge has a backup route around it if and only if it sits on a cycle, whereas a single shared vertex can still bottleneck all paths between two cycles.

A cycle gives every edge on it a backup route, yet two cycles that meet at a single shared node can still split apart when that node is removed.
3

Edge Connectivity and Vertex Connectivity

When a graph can survive a single failure, we measure how hard it is to break apart by finding its edge connectivity (the fewest edges we must cut to disconnect it) and its vertex connectivity (the fewest vertices we must delete to disconnect it, or reduce it to a single vertex).

AA
BB
CC
DD
EE
figure-eight with edge BE\text{figure-eight with edge } BE
11
22
33
44
K4K_4
Edge Connectivity and Vertex Connectivity
AA
BB
CC
DD
EE
figure-eight\text{figure-eight}
edge connectivity:\text{edge connectivity:}
fewest edges to cut\text{fewest edges to cut}
vertex connectivity:\text{vertex connectivity:}
fewest vertices to delete\text{fewest vertices to delete}
Text solution
Compare vertex and edge cuts on the figure-eight graphDeleting the single cut vertex C\breaks{C} splits the graph in two, whereas no single edge is a bridge and cutting both edges touching AA isolates AA from the rest of the network.
delete C⏟vertex connectivity =  1,cut AB and AC⏟edge connectivity =  2\displaystyle \begin{aligned} &\underbrace{\text{delete } \breaks{C}}_{\text{vertex connectivity } = \; \conn{1}}, \\[20pt] &\underbrace{\text{cut } \breaks{AB} \text{ and } \breaks{AC}}_{\text{edge connectivity } = \; \conn{2}} \end{aligned}
Add a bypass edge or test the complete graph K4K_4Adding edge BEBE provides a detour around C\breaks{C} so two vertices (C\breaks{C} and B\breaks{B}, or C\breaks{C} and E\breaks{E}) must be deleted to split the graph; in the complete graph K4K_4, every pair of surviving vertices has a direct edge between them, so we must delete 4−1=34 - 1 = \conn{3} vertices (leaving 1 vertex) or cut all 3\conn{3} edges at a single vertex.
For Kn:vertex connectivity=edge connectivity=n−1(for K4,  4−1=3)\displaystyle \begin{aligned} &\text{For } K_n: \\ &\quad \text{vertex connectivity} \\ &\quad = \text{edge connectivity} \\ &\quad = \conn{n - 1} \\ &\quad (\text{for } K_4, \; 4 - 1 = \conn{3}) \end{aligned}

Notice why KnK_n needs the "single vertex left" rule for vertex connectivity but not for edge connectivity. Deleting a vertex removes the vertex along with its edges, so any two survivors in KnK_n stay directly connected. Cutting the n−1\conn{n - 1} edges at Vertex 1, on the other hand, leaves all nn vertices in the graph with Vertex 1 stranded from the other n−1n - 1 vertices.

4

Strong and Weak Connectivity in Directed Graphs

Up to now, every edge allowed two-way travel. In a directed graph, where edges are one-way arrows, we check whether you can follow the arrows both ways between every pair of vertices (strongly connected) or whether the graph only holds together when you ignore the arrowheads (weakly connected).

Strong and Weak Connectivity in Directed Graphs
AA
BB
CC
Text solution
Group vertices that can reach each other both waysVertices A\firstpiece{A} and B\firstpiece{B} form a two-way loop and vertices C,D,E\secondpiece{C, D, E} form a directed 3-cycle, so inside each group every vertex can reach every other vertex along the arrows.
A↔B⏟strongly connected component {A,B}⟶C→D→E→C⏟strongly connected component {C,D,E}\displaystyle \begin{aligned} &\underbrace{\firstpiece{A \leftrightarrow B}}_{\text{strongly connected component } \firstpiece{\{A, B\}}} \\[10pt] &\breaks{\longrightarrow} \underbrace{\secondpiece{C \to D \to E \to C}}_{\text{strongly connected component } \secondpiece{\{C, D, E\}}} \end{aligned}
Check the one-way link between groupsThe arrow B→C\breaks{B \to C} leads from {A,B}\firstpiece{\{A, B\}} into {C,D,E}\secondpiece{\{C, D, E\}} with no return arrow back to {A,B}\firstpiece{\{A, B\}}, making the entire directed graph weakly connected with two strongly connected components.
5

Counting Walks with Adjacency Matrix Powers

Tracing routes by eye works on a small drawing, but to count the exact number of walks of length kk between any two vertices, or test directly whether a large network is connected, we take powers of the graph's adjacency matrix AA.

11
22
33
44
1\htmlClass{lc-blue}{1}
1\htmlClass{lc-pink}{1}
2\htmlClass{lc-blue}{2}
2\htmlClass{lc-pink}{2}
3\htmlClass{lc-blue}{3}
3\htmlClass{lc-pink}{3}
4\htmlClass{lc-blue}{4}
4\htmlClass{lc-pink}{4}
0\htmlClass{lc-mute}{0}
1\htmlClass{lc-green}{1}
1\htmlClass{lc-green}{1}
0\htmlClass{lc-mute}{0}
1\htmlClass{lc-green}{1}
0\htmlClass{lc-mute}{0}
0\htmlClass{lc-mute}{0}
1\htmlClass{lc-green}{1}
1\htmlClass{lc-green}{1}
0\htmlClass{lc-mute}{0}
0\htmlClass{lc-mute}{0}
1\htmlClass{lc-green}{1}
0\htmlClass{lc-mute}{0}
1\htmlClass{lc-green}{1}
1\htmlClass{lc-green}{1}
0\htmlClass{lc-mute}{0}
to\htmlClass{lc-pink}{\text{to}}
from\htmlClass{lc-blue}{\text{from}}
AA
Counting Walks with Adjacency Matrix Powers
11
22
33
44
1→ ? →4\htmlClass{lc-blue}{1} \to \htmlClass{lc-pink}{\boxed{\,?\,}} \to \htmlClass{lc-pink}{4}
in exactly 2 steps\text{in exactly 2 steps}
Text solution
Multiply Row 1 by Column 4 of AA to count 2-step walks from 11 to 44Lining up Row 1 with Column 4 multiplies the 1-step connection from 11 to middle vertex mm by the 1-step connection from mm to 44, summing over all four possible middle vertices m=1,2,3,4m = 1, 2, 3, 4.
(A2)1,4=[0,1,1,0]⏟Row 1 of A⋅[0110]⏟Col 4 of A=(0×0)+(1×1)⏟1→2→4+(1×1)⏟1→3→4+(0×0)=2\displaystyle \begin{aligned} (A^2)_{1,4} &= \underbrace{\firststeps{[0, 1, 1, 0]}}_{\firststeps{\text{Row 1 of } A}} \cdot \underbrace{\laststep{\begin{bmatrix} 0 \\ 1 \\ 1 \\ 0 \end{bmatrix}}}_{\laststep{\text{Col 4 of } A}} \\ &= (0\times 0) + \underbrace{(\firststeps{1}\times \laststep{1})}_{\route{1\to 2\to 4}} \\ &\quad + \underbrace{(\firststeps{1}\times \laststep{1})}_{\route{1\to 3\to 4}} + (0\times 0) \\ &= \walkcount{2} \end{aligned}
Multiply Row 1 of A2A^2 by Column 4 of AA to count 3-step walks from 11 to 44Pairing the 2-step counts out of vertex 11 with the final 1-step edges into vertex 44 gives zero, because after 2 steps you can only be at vertex 1\firststeps{1} or 4\firststeps{4}, neither of which has an edge into 44.
(A3)1,4=[2,0,0,2]⏟Row 1 of A2⋅[0110]⏟Col 4 of A=(2×0)+(0×1)+(0×1)+(2×0)=0\displaystyle \begin{aligned} (A^3)_{1,4} &= \underbrace{\firststeps{[2, 0, 0, 2]}}_{\firststeps{\text{Row 1 of } A^2}} \cdot \underbrace{\laststep{\begin{bmatrix} 0 \\ 1 \\ 1 \\ 0 \end{bmatrix}}}_{\laststep{\text{Col 4 of } A}} \\ &= (\firststeps{2}\times 0) + (0\times \laststep{1}) \\ &\quad + (0\times \laststep{1}) + (\firststeps{2}\times 0) \\ &= \walkcount{0} \end{aligned}
Multiply Row 1 of A2A^2 by Column 2 of AA to count 3-step walks from 11 to 22Both vertices reachable in 2 steps (1\firststeps{1} and 4\firststeps{4}) have a direct edge into vertex 22, contributing two 3-step walks each.
(A3)1,2=[2,0,0,2]⏟Row 1 of A2⋅[1001]⏟Col 2 of A=(2×1)⏟1→2→1→21→3→1→2+(0×0)+(0×0)+(2×1)⏟1→2→4→21→3→4→2=4\displaystyle \begin{aligned} (A^3)_{1,2} &= \underbrace{\firststeps{[2, 0, 0, 2]}}_{\firststeps{\text{Row 1 of } A^2}} \cdot \underbrace{\laststep{\begin{bmatrix} 1 \\ 0 \\ 0 \\ 1 \end{bmatrix}}}_{\laststep{\text{Col 2 of } A}} \\ &= \underbrace{(\firststeps{2}\times \laststep{1})}_{\route{\substack{1\to 2\to 1\to 2 \\ 1\to 3\to 1\to 2}}} + (0\times 0) \\ &\quad + (0\times 0) + \underbrace{(\firststeps{2}\times \laststep{1})}_{\route{\substack{1\to 2\to 4\to 2 \\ 1\to 3\to 4\to 2}}} \\ &= \walkcount{4} \end{aligned}

In every entry (i,j)(i, j) of AkA^k, the dot product of Row ii of Ak−1\firststeps{A^{k-1}} with Column jj of A\laststep{A} pairs the walks that reach each intermediate vertex mm in k−1\firststeps{k - 1} steps with the final edge from mm to jj.

Each entry counts walks between two nodes by pairing the ways to reach each middle node with the final edge to the end node.

Because any longer walk between two vertices repeats a vertex and can be snipped down to a simple path of at most n−1n - 1 edges, we only need to check powers up to An−1A^{n-1} to test whether two vertices are connected:

In an n-vertex graph, i can reach j  (i≠j)  ⟺  (Ak)i,j>0for some k∈{1,2,…,n−1}\displaystyle \boxed{\begin{aligned} &\text{In an } n\text{-vertex graph, } \\ &i \text{ can reach } j \; (i \neq j) \\ &\iff \walkcount{(A^k)_{i,j}} > 0 \\ &\quad \text{for some } k \in \{1, 2, \dots, n - 1\} \end{aligned}}

Key concepts

When classifying a route, check first whether its endpoints match (closed) or differ (open), then scan for repeats: if an edge is used twice, the route is only a walk; if no edge repeats but a middle vertex is visited twice, an open route is a trail and a closed route is a circuit (A→B→C→D→E→C→A\route{A \to B \to} \repeated{C} \route{\to D \to E \to} \repeated{C} \route{\to A}); if no middle vertex repeats either, an open route is a path (A→B→D→E\route{A \to B \to D \to E}) and a closed route is a cycle (A→B→C→A\route{A \to B \to C \to A}). Whenever you need a path from a walk that loops back on itself, don't search the graph from scratch: snip out the steps between the first and last visit to each repeated vertex (A→snip(B→C→B)→D→E\route{A \to} \text{snip}(\repeated{B \to C \to B}) \route{\to D \to E}).

Cycles also tell you where a network can break. An edge is a bridge if and only if it sits on no cycle (like CF\breaks{CF} between two triangles), whereas a vertex is a cut vertex whenever deleting it and its attached edges splits a component, which still happens in a bridgeless graph wherever two cycles share a single bottleneck vertex (like C\breaks{C} in the figure-eight graph). To find vertex connectivity or edge connectivity, count the fewest vertices or edges needed to split the graph, watching out for a complete graph KnK_n where every survivor stays connected by an edge to every other survivor so both numbers equal n−1\conn{n - 1}. In a directed graph, don't rely on an undirected path: two vertices belong to the same strongly connected component only when arrows let you travel both ways (X→⋯→Y\route{X \to \dots \to Y} and Y→⋯→X\route{Y \to \dots \to X}), while a one-way bridge like B→C\breaks{B \to C} leaves the graph merely weakly connected. Finally, use (Ak)i,j\walkcount{(A^k)_{i,j}} == (Row i of Ak−1)⋅(Col j of A)\firststeps{(\text{Row } i \text{ of } A^{k-1})} \cdot \laststep{(\text{Col } j \text{ of } A)} to count kk-step walks (including back-and-forth edge repeats like 1→2→1→2\route{1 \to 2 \to 1 \to 2}), and stop at An−1A^{n-1} when testing whether vertex ii can reach vertex jj in an nn-vertex graph. Never compute higher powers like An\fails{A^n} or A8\fails{A^8} on a 6-vertex graph to test reachability, because any walk of length nn or more would have already appeared as a snipped path of length at most n−1n - 1.

6

Practice

1

A graph on vertices A,B,C,D,EA, B, C, D, E has edges ABAB, BCBC, CACA, BDBD, CDCD, DEDE, ECEC. Classify each route below by the strictest term that applies (walk, trail, path, circuit, or cycle), and for any open route that is not already a path, snip out its repeated-vertex detour to turn it into a path: (a) A→B→C→D→E→C→AA \to B \to C \to D \to E \to C \to A (b) A→B→C→D→B→D→EA \to B \to C \to D \to B \to D \to E (c) B→C→D→BB \to C \to D \to B

For each route, check whether it starts and ends at the same vertex, then list its edges to see if any edge is crossed twice (even in the opposite direction) before checking for repeated vertices.

(a)The route starts and ends at AA and uses six distinct edges (AB,BC,CD,DE,EC,CAAB, BC, CD, DE, EC, CA), but it visits vertex C\repeated{C} twice in the middle. Watch out for the common slip of calling this a cycle just because it is a closed loop with no repeated edges; repeating middle vertex C\repeated{C} makes it a circuit.
(b)The open route from AA to EE crosses the undirected edge BD\repeated{BD} twice (once as D→B\repeated{D \to B} and once as B→D\repeated{B \to D}); don't call it a trail by treating D→B\repeated{D \to B} and B→D\repeated{B \to D} as different edges. Because it repeats an edge, it is a walk. Vertex B\repeated{B} repeats in A→B→C→D→B→D→E\route{A \to} \repeated{B \to C \to D \to B} \route{\to D \to E}; snipping out the detour B→C→D→B\repeated{B \to C \to D \to B} between the first and second BB (be careful to keep one copy of BB rather than erasing both, which would leave the non-existent edge AD\fails{AD}) gives the path A→B→D→E\route{A \to B \to D \to E}.
(c)Starting and ending at BB with no repeated edges and no repeated middle vertices makes B→C→D→B\route{B \to C \to D \to B} a cycle.
Final answer: (a) Circuit; (b) Walk, which snips to the path A→B→D→EA \to B \to D \to E (or, snipping between the two DD's, A→B→C→D→EA \to B \to C \to D \to E); (c) Cycle.
2

A graph on vertices 1,2,3,4,5,6,7,81, 2, 3, 4, 5, 6, 7, 8 consists of triangle 1-2-31\text{-}2\text{-}3, triangle 3-4-53\text{-}4\text{-}5 sharing vertex 33, triangle 6-7-86\text{-}7\text{-}8, and the single edge 5656 connecting the middle triangle to the right triangle. List all bridges and all cut vertices of this graph.

First check which edges do not belong to any triangle; then test each vertex where two triangles or a bridge meet to see if deleting that vertex and its edges separates the remaining vertices.

Every edge in triangles 1-2-3\backup{1\text{-}2\text{-}3}, 3-4-5\backup{3\text{-}4\text{-}5}, and 6-7-8\backup{6\text{-}7\text{-}8} sits on a 3-cycle, so cutting any one of them leaves a detour around its triangle. Only edge 56\breaks{56} sits on no cycle, making 56\breaks{56} the only bridge.
For cut vertices, deleting 5\breaks{5} separates {1,2,3,4}\firstpiece{\{1, 2, 3, 4\}} from {6,7,8}\secondpiece{\{6, 7, 8\}}, and deleting 6\breaks{6} separates {1,2,3,4,5}\firstpiece{\{1, 2, 3, 4, 5\}} from {7,8}\secondpiece{\{7, 8\}}. Don't stop at the endpoints {5,6}\breaks{\{5, 6\}} of the bridge 56\breaks{56}: even though no edge touching vertex 3\breaks{3} is a bridge, triangles 1-2-31\text{-}2\text{-}3 and 3-4-53\text{-}4\text{-}5 meet only at 3\breaks{3}, so deleting 3\breaks{3} separates {1,2}\firstpiece{\{1, 2\}} from {4,5,6,7,8}\secondpiece{\{4, 5, 6, 7, 8\}}.
Final answer: Bridge: 5656; Cut vertices: 3,5,63, 5, 6.
3

A graph GG is formed by taking a complete graph K4K_4 on {A,B,C,D}\{A, B, C, D\} and a second complete graph K4K_4 on {E,F,G,H}\{E, F, G, H\}, then adding the two edges DEDE and DFDF between them. Find (a) the vertex connectivity of GG, (b) the edge connectivity of GG, and (c) the vertex and edge connectivity of the complete graph K6K_6.

Look closely at the endpoints of the two cross-edges DEDE and DFDF: do they share a vertex on either side, and do they form a cycle together with an edge inside the second K4K_4?

(a)Both cross-edges DEDE and DFDF attach to the single vertex D\breaks{D} in the first K4K_4. Avoid the common mistake of answering 2\fails{2} just because there are two edges crossing between the two K4K_4 pieces: deleting the single vertex D\breaks{D} removes both DE\breaks{DE} and DF\breaks{DF} at once and separates {A,B,C}\firstpiece{\{A, B, C\}} from {E,F,G,H}\secondpiece{\{E, F, G, H\}}, so the vertex connectivity is 1\conn{1}.
(b)Because EFEF is an edge inside the second K4K_4, the edges DE,EF,\backup{DE}, \backup{EF}, and FD\backup{FD} form a 3-cycle D→E→F→D\backup{D \to E \to F \to D}, so GG has no bridges (cutting 11 edge cannot disconnect GG). Cutting both DE\breaks{DE} and DF\breaks{DF} separates the two K4K_4 pieces, so the edge connectivity is 2\conn{2}.
(c)For K6K_6, every vertex connects directly to the other 6−1=56 - 1 = \conn{5} vertices (don't write 6\fails{6}, since a vertex has no edge to itself), so both the vertex connectivity and the edge connectivity are 5\conn{5}.
Final answer: (a) 11; (b) 22; (c) 55.
4

A directed graph on vertices A,B,C,D,E,FA, B, C, D, E, F has directed edges A→BA \to B, B→CB \to C, C→AC \to A, C→DC \to D, D→ED \to E, E→DE \to D, and E→FE \to F. (a) Is this directed graph strongly connected, weakly connected, or disconnected? (b) Find all of its strongly connected components. (c) Name a single directed edge you could add to make the entire graph strongly connected.

Trace which vertices sit on directed cycles that let you return to where you started, and check where the arrows go only one way.

(a)Ignoring the arrowheads leaves one connected piece, but following the arrows you can never return from {D,E}\secondpiece{\{D, E\}} to {A,B,C}\firstpiece{\{A, B, C\}} or leave F\thirdpiece{F}, so the graph is weakly connected.
(b)Vertices A,B,C\firstpiece{A, B, C} form the directed 3-cycle A→B→C→A\firstpiece{A \to B \to C \to A}, and vertices D,E\secondpiece{D, E} form the directed 2-cycle D→E→D\secondpiece{D \to E \to D}. Be careful not to group F\thirdpiece{F} into {D,E,F}\fails{\{D, E, F\}} just because E→F\breaks{E \to F} reaches F\thirdpiece{F}, and don't drop F\thirdpiece{F} altogether: since F\thirdpiece{F} has no outgoing arrows to return to EE, it forms its own 1-vertex component {F}\thirdpiece{\{F\}}.
(c)Directed paths already lead from {A,B,C}\firstpiece{\{A, B, C\}} through C→D\breaks{C \to D} to {D,E}\secondpiece{\{D, E\}} and through E→F\breaks{E \to F} to F\thirdpiece{F}. (Adding D→C\fails{D \to C} would still leave F\thirdpiece{F} as a dead end.) Adding a single arrow from F\thirdpiece{F} back into the first component (F→A\added{F \to A}, F→B\added{F \to B}, or F→C\added{F \to C}) closes one loop through all six vertices.
Final answer: (a) Weakly connected; (b) {A,B,C}\{A, B, C\}, {D,E}\{D, E\}, and {F}\{F\}; (c) F→AF \to A (or F→BF \to B or F→CF \to C).
5

A 4-vertex graph on {1,2,3,4}\{1, 2, 3, 4\} has edges 12,13,23,12, 13, 23, and 3434 (triangle 1-2-31\text{-}2\text{-}3 with edge 3434 attached), so its adjacency matrix has rows R1=[0,1,1,0]R_1 = [0, 1, 1, 0], R2=[1,0,1,0]R_2 = [1, 0, 1, 0], R3=[1,1,0,1]R_3 = [1, 1, 0, 1], and R4=[0,0,1,0]R_4 = [0, 0, 1, 0]. (a) Compute Row 1 of A2A^2. (b) Use Row 1 of A2A^2 and Column 3 of AA to compute the (1,3)(1, 3) entry of A3A^3, and list all walks of length 33 from vertex 11 to vertex 33.

Each entry (A2)1,j(A^2)_{1,j} is the dot product of Row 1 of AA with Column jj of AA; then each nonzero product in (Row 1 of A2)⋅(Column 3 of A)\firststeps{(\text{Row 1 of } A^2)} \cdot \laststep{(\text{Column 3 of } A)} tells you which vertex mm the 3-step walk visits on step 2.

(a)Don't just square the numbers in R1=[0,1,1,0]\firststeps{R_1} = \firststeps{[0, 1, 1, 0]} entry-by-entry to get [0,1,1,0]\fails{[0, 1, 1, 0]}; take the dot product of R1\firststeps{R_1} with each column of AA:
(A2)1,1=[0,1,1,0]⋅[0110]=2,(A2)1,2=[0,1,1,0]⋅[1010]=1,(A2)1,3=[0,1,1,0]⋅[1101]=1,(A2)1,4=[0,1,1,0]⋅[0010]=1\displaystyle \begin{aligned} (A^2)_{1,1} &= \firststeps{[0,1,1,0]}\cdot\laststep{\begin{bmatrix}0\\1\\1\\0\end{bmatrix}} = \walkcount{2}, \\[6pt] (A^2)_{1,2} &= \firststeps{[0,1,1,0]}\cdot\laststep{\begin{bmatrix}1\\0\\1\\0\end{bmatrix}} = \walkcount{1}, \\[6pt] (A^2)_{1,3} &= \firststeps{[0,1,1,0]}\cdot\laststep{\begin{bmatrix}1\\1\\0\\1\end{bmatrix}} = \walkcount{1}, \\[6pt] (A^2)_{1,4} &= \firststeps{[0,1,1,0]}\cdot\laststep{\begin{bmatrix}0\\0\\1\\0\end{bmatrix}} = \walkcount{1} \end{aligned}
So Row 1 of A2A^2 is [2,1,1,1]\walkcount{[2, 1, 1, 1]}.
(b)Taking the dot product of Row 1 of A2A^2 with Column 3 of AA gives:
(A3)1,3=[2,1,1,1]⋅[1101]=(2×1)+(1×1)+(1×0)+(1×1)=4\displaystyle \begin{aligned} (A^3)_{1,3} &= \firststeps{[2, 1, 1, 1]} \cdot \laststep{\begin{bmatrix} 1 \\ 1 \\ 0 \\ 1 \end{bmatrix}} \\ &= (\firststeps{2}\times \laststep{1}) + (\firststeps{1}\times \laststep{1}) \\ &\quad + (\firststeps{1}\times 0) + (\firststeps{1}\times \laststep{1}) \\ &= \walkcount{4} \end{aligned}
When listing the walks, don't restrict yourself to simple paths (there is no simple path of length 33 from 11 to 33, so each of these walks repeats a vertex): the 2×1\firststeps{2}\times \laststep{1} term at m=1m = 1 gives 1→2→1→3\route{1 \to 2 \to 1 \to 3} and 1→3→1→3\route{1 \to 3 \to 1 \to 3}; the 1×1\firststeps{1}\times \laststep{1} term at m=2m = 2 gives 1→3→2→3\route{1 \to 3 \to 2 \to 3}; and the 1×1\firststeps{1}\times \laststep{1} term at m=4m = 4 gives 1→3→4→3\route{1 \to 3 \to 4 \to 3}.
Final answer: (a) [2,1,1,1][2, 1, 1, 1]; (b) (A3)1,3=4(A^3)_{1,3} = 4, with walks 1→2→1→31 \to 2 \to 1 \to 3, 1→3→1→31 \to 3 \to 1 \to 3, 1→3→2→31 \to 3 \to 2 \to 3, and 1→3→4→31 \to 3 \to 4 \to 3.
6

Suppose AA is the adjacency matrix of a 6-vertex graph, and the (1,6)(1, 6) entries of A,A2,A3,A4,A, A^2, A^3, A^4, and A5A^5 are all 00. Can the (1,6)(1, 6) entry of A8A^8 be greater than 00? Explain why or why not.

If an 8-step walk from vertex 11 to vertex 66 existed, what would happen after you snipped out all of its repeated-vertex loops, and what is the maximum length of a simple path on 66 vertices?

Don't be tempted to answer "Yes" by imagining a walk that wanders around for 8 steps before reaching vertex 66. If (A8)1,6>0\supposed{(A^8)_{1,6} > 0}, there would be a walk of length 88 from vertex 11 to vertex 66. Snipping out the repeated-vertex detours from that walk would leave a simple path from 11 to 66. Because the graph has only 66 vertices, a simple path can visit at most 66 vertices and use at most 6−1=56 - 1 = 5 edges, which would force (Ak)1,6≥1\fails{(A^k)_{1,6} \ge 1} for some k∈{1,2,3,4,5}k \in \{1, 2, 3, 4, 5\}, contradicting that all five entries are 00.
Final answer: No, (A8)1,6(A^8)_{1,6} must be 00.