Discrete MathematicsGraphs, Paths and Circuits3 of 6
Graphs, Paths and Circuits · 3

Graph Isomorphism: When Two Drawings Are the Same Graph

Two people can draw the same network of connections in completely different ways, so we need a reliable way to tell when two drawings are really the same graph in disguise.

1

Same Graph, Different Drawing

In geometry, a square with crossing diagonals and a triangle with a dot in the center are different shapes, and a pentagon is different from a five-pointed star. In graph theory, however, a graph only records which vertices are connected to which. When two drawings have the exact same network of connections underneath, we say the graphs are isomorphic.

Same Graph, Different Drawing

No matter where the vertices sit on the page or whether the edges cross each other, the list of connected vertex pairs stays the same.

Moving the vertices changes edge lengths, crossings, and which vertex sits inside, while the connected vertex pairs never change.
2

Finding an Isomorphism by Matching Vertices

Untangling edges in your head works for four or five vertices, but for larger or more tangled graphs we need a method that works on paper. An isomorphism is a one-to-one matching (a bijection) between the vertices of two graphs so that two vertices are connected in the first graph if and only if their matched vertices are connected in the second.

Let's prove that these two 55-vertex graphs are isomorphic by finding the vertex matching between A,B,C,D,EA, B, C, D, E and 1,2,3,4,51, 2, 3, 4, 5.

AA
BB
CC
DD
EE
11
22
33
44
55
Finding an Isomorphism by Matching Vertices
11
22
33
44
55
A=\htmlClass{lc-violet}{A =}
B=\htmlClass{lc-violet}{B =}
C=\htmlClass{lc-violet}{C =}
D=\htmlClass{lc-violet}{D =}
E=\htmlClass{lc-violet}{E =}
Text solution
Match vertices with unique degreesCounting the edges at each vertex shows that only CC and 22 have degree 3\holds{3}, and only EE and 55 have degree 1\holds{1}, which locks in those two pairs right away.
Left degrees:C:3,A,B,D:2,E:1Right degrees:2:3,1,3,4:2,5:1  ⟹  C=2,E=5\displaystyle \begin{aligned} &\text{Left degrees:} \\ &\quad C: \holds{3},\quad A, B, D: \holds{2},\quad E: \holds{1} \\ &\text{Right degrees:} \\ &\quad 2: \holds{3},\quad 1, 3, 4: \holds{2},\quad 5: \holds{1} \\ &\implies \quad \matched{C = 2},\quad \matched{E = 5} \end{aligned}
Break ties using neighbor degreesAmong the three degree-2\holds{2} vertices on the left (A,B,DA, B, D), only DD connects to the degree-1\holds{1} vertex EE, and among the degree-2\holds{2} vertices on the right (1,3,41, 3, 4), only 11 connects to the degree-1\holds{1} vertex 55.
D is adjacent to E (degree 1)and1 is adjacent to 5 (degree 1)  ⟹  D=1\displaystyle \begin{aligned} &D \text{ is adjacent to } E \text{ (degree } \holds{1}\text{)} \\ &\text{and} \quad 1 \text{ is adjacent to } 5 \text{ (degree } \holds{1}\text{)} \\ &\implies \quad \matched{D = 1} \end{aligned}
Match the remaining symmetric vertices and check all edgesThe last two vertices on each side (A,BA, B and 3,43, 4) connect to each other and to the degree-3\holds{3} vertex (C=2\matched{C = 2}), so matching A=3\matched{A = 3} and B=4\matched{B = 4} (or the reverse) maps all 55 edges of the left graph onto the 55 edges of the right graph with no extra edges left over.
A=3,B=4,C=2,D=1,E=5\displaystyle \begin{aligned} &\matched{A = 3},\quad \matched{B = 4},\quad \matched{C = 2}, \\ &\matched{D = 1},\quad \matched{E = 5} \end{aligned}
A-B→3-4,A-C→3-2,B-C→4-2,C-D→2-1,D-E→1-5\displaystyle \begin{aligned} \holds{A\text{-}B} &\matched{\to} \holds{3\text{-}4}, &\quad \holds{A\text{-}C} &\matched{\to} \holds{3\text{-}2}, \\ \holds{B\text{-}C} &\matched{\to} \holds{4\text{-}2}, &\quad \holds{C\text{-}D} &\matched{\to} \holds{2\text{-}1}, \\ \holds{D\text{-}E} &\matched{\to} \holds{1\text{-}5} \end{aligned}

So the two drawings are isomorphic, with two valid matchings depending on whether AA and BB map to 33 and 44 or to 44 and 33.

3

Isomorphism in Adjacency Matrices

When graphs are stored in a computer, we aren't given a drawing at all, just an edge list or an adjacency matrix. We want to see how to find an isomorphism directly from two adjacency matrices, and what relabeling the vertices does to the matrix itself.

Let's check whether these two 4×44 \times 4 adjacency matrices describe the same graph:

Graph 1: ABCDA0100B1010C0101D0010Graph 2: 123410010200013100140110\displaystyle \begin{gathered} \text{Graph 1: } \begin{array}{c|cccc} & A & B & C & D \\ \hline A & 0 & \holds{1} & 0 & 0 \\ B & \holds{1} & 0 & \holds{1} & 0 \\ C & 0 & \holds{1} & 0 & \holds{1} \\ D & 0 & 0 & \holds{1} & 0 \end{array} \\[1em] \text{Graph 2: } \begin{array}{c|cccc} & 1 & 2 & 3 & 4 \\ \hline 1 & 0 & 0 & \holds{1} & 0 \\ 2 & 0 & 0 & 0 & \holds{1} \\ 3 & \holds{1} & 0 & 0 & \holds{1} \\ 4 & 0 & \holds{1} & \holds{1} & 0 \end{array} \end{gathered}
Isomorphism in Adjacency Matrices
Graph 1 and Graph 2:\displaystyle \text{Graph 1 and Graph 2:}
the same graph?\displaystyle \text{the same graph?}
Text solution
Sum each row to find the vertex degreesAdding the 1\holds{1}s across each row gives the degree of each vertex, and since the degrees in both graphs sum to 66, the handshake lemma tells us both graphs have 62=3\tfrac{6}{2} = 3 edges.
Graph 1 row sums:A:1,B:2,C:2,D:1Graph 2 row sums:1:1,2:1,3:2,4:2\displaystyle \begin{aligned} &\text{Graph 1 row sums:} \\ &\quad A: \holds{1},\quad B: \holds{2},\quad C: \holds{2},\quad D: \holds{1} \\ &\text{Graph 2 row sums:} \\ &\quad 1: \holds{1},\quad 2: \holds{1},\quad 3: \holds{2},\quad 4: \holds{2} \end{aligned}
Match a degree-1 vertex and follow the 1 in its rowMatching the degree-1\holds{1} vertices as A=1\matched{A = 1} and D=2\matched{D = 2}, the single 1\holds{1} in Row AA sits in Column BB while the single 1\holds{1} in Row 11 sits in Column 33, which forces B=3\matched{B = 3} and leaves C=4\matched{C = 4}.
A=1,D=2  ⟹  Row A has 1 at B,Row 1 has 1 at 3  ⟹  B=3,C=4\displaystyle \begin{aligned} &\matched{A = 1},\quad \matched{D = 2} \\ \implies &\quad \text{Row } A \text{ has } \holds{1} \text{ at } B, \\ &\quad \text{Row } 1 \text{ has } \holds{1} \text{ at } 3 \\ \implies &\quad \matched{B = 3},\quad \matched{C = 4} \end{aligned}
Reorder both the rows and the columns in the matching orderListing Graph 2's vertices in the order 1,3,4,2\matched{1, 3, 4, 2} (to match A,B,C,DA, B, C, D) along both the rows and the columns makes Graph 2's matrix identical to Graph 1's matrix in every entry.
Graph 2 reordered: 1 (A)3 (B)4 (C)2 (D)1 (A)01003 (B)10104 (C)01012 (D)0010\displaystyle \begin{gathered} \text{Graph 2 reordered: } \\ \begin{array}{c|cccc} & \begin{gathered}1\,\\\matched{(A)}\end{gathered} & \begin{gathered}3\,\\\matched{(B)}\end{gathered} & \begin{gathered}4\,\\\matched{(C)}\end{gathered} & \begin{gathered}2\,\\\matched{(D)}\end{gathered} \\ \hline 1\,\matched{(A)} & 0 & \holds{1} & 0 & 0 \\ 3\,\matched{(B)} & \holds{1} & 0 & \holds{1} & 0 \\ 4\,\matched{(C)} & 0 & \holds{1} & 0 & \holds{1} \\ 2\,\matched{(D)} & 0 & 0 & \holds{1} & 0 \end{array} \end{gathered}

Because each vertex labels both a row and a column, moving a vertex in the ordering shifts its row and its matching column together while keeping its row sum unchanged. When the vertex order matches Graph 1, the two grids of 00s and 11s line up in every entry.

Reordering the vertices slides each row and column together, moving the 1s around without changing any connections until a matching order makes the two matrices identical.
4

Proving Graphs Are Not Isomorphic Using Invariants

What if you try to match the vertices of two graphs and nothing works? Saying "I couldn't find a matching" is not a proof, because you might simply have missed one among hundreds of possibilities. To prove two graphs are not isomorphic, we point to a graph invariant (a structural property that cannot change when vertices are moved or relabeled) that one graph has and the other does not.

Now let's test two pairs of graphs that have the exact same number of vertices, number of edges, and degree sequence, and see how other invariants tell them apart.

2\htmlClass{lc-green}{2}
3\htmlClass{lc-green}{3}
3\htmlClass{lc-green}{3}
2\htmlClass{lc-green}{2}
2\htmlClass{lc-green}{2}
3\htmlClass{lc-green}{3}
3\htmlClass{lc-green}{3}
2\htmlClass{lc-green}{2}
2\htmlClass{lc-green}{2}
2\htmlClass{lc-green}{2}
3\htmlClass{lc-green}{3}
3\htmlClass{lc-green}{3}
3\htmlClass{lc-green}{3}
3\htmlClass{lc-green}{3}
3\htmlClass{lc-green}{3}
3\htmlClass{lc-green}{3}
3\htmlClass{lc-green}{3}
3\htmlClass{lc-green}{3}
3\htmlClass{lc-green}{3}
3\htmlClass{lc-green}{3}
3\htmlClass{lc-green}{3}
3\htmlClass{lc-green}{3}
Proving Graphs Are Not Isomorphic Using Invariants
same number of vertices,\displaystyle \text{same number of vertices,}
same number of edges,\displaystyle \text{same number of edges,}
same degree sequence:\displaystyle \text{same degree sequence:}
isomorphic?\displaystyle \text{isomorphic?}
Text solution
Check vertex counts, edge counts, and sorted degree sequences firstIn the 55-vertex pair, both graphs have 55 vertices, 66 edges, and the same sorted degree sequence, so the basic counts pass.
First pair:5 vertices,6 edges,degrees (3,3,2,2,2)\displaystyle \begin{aligned} &\text{First pair:} \\ &\quad 5 \text{ vertices},\quad 6 \text{ edges}, \\ &\quad \text{degrees } \holds{(3, 3, 2, 2, 2)} \end{aligned}
Compare neighbor degrees and closed loops on the 5-vertex pairIn the left house graph, the two degree-3\holds{3} vertices are connected directly to each other and, together with the top of the roof, form a triangle (3\walk{3}-step closed loop), whereas in the right graph the two degree-3\holds{3} vertices do not share an edge and the shortest closed loop takes 4\walk{4} steps, proving they are not isomorphic.
Left 5-vertex graph:degree-3 vertices sharean edge (1 triangle)Right 5-vertex graph:degree-3 vertices do notshare an edge (0 triangles)\displaystyle \begin{aligned} &\text{Left 5-vertex graph:} \\ &\quad \text{degree-}\holds{3} \text{ vertices share} \\ &\quad \text{an edge (}\holds{1} \text{ triangle)} \\ &\text{Right 5-vertex graph:} \\ &\quad \text{degree-}\holds{3} \text{ vertices do not} \\ &\quad \text{share an edge (}\fails{0} \text{ triangles)} \end{aligned}
Count triangles when all degrees and neighbor degrees match on the 6-vertex pairIn the 66-vertex pair, every vertex in both graphs has degree 3\holds{3} and connects to three degree-3\holds{3} neighbors, but the left graph contains 2\holds{2} triangles while every closed loop in the right graph takes at least 4\walk{4} steps, so they are not isomorphic.
Second pair:6 vertices,9 edges,degrees (3,3,3,3,3,3)Left 6-vertex graph:2 triangles(closed loops of 3 steps)Right 6-vertex graph:0 triangles(shortest closed looptakes 4 steps)\displaystyle \begin{aligned} &\text{Second pair:} \\ &\quad 6 \text{ vertices},\quad 9 \text{ edges}, \\ &\quad \text{degrees } \holds{(3, 3, 3, 3, 3, 3)} \\ &\text{Left 6-vertex graph:} \\ &\quad \holds{2} \text{ triangles} \\ &\quad \text{(closed loops of } \walk{3} \text{ steps)} \\ &\text{Right 6-vertex graph:} \\ &\quad \fails{0} \text{ triangles} \\ &\quad \text{(shortest closed loop} \\ &\quad \text{takes } \walk{4} \text{ steps)} \end{aligned}

On a test, pointing out a single invariant that differs, such as one graph having a triangle while the other has none, or one graph being broken into two pieces while the other is connected in one piece, is a complete proof that they are not isomorphic. Just remember that invariants only work in one direction: if all your invariant checks match, you still have to write down the vertex bijection to prove the graphs are isomorphic.

5

Counting Graphs on Four Vertices Up to Isomorphism

Invariants also let us count how many genuinely different graphs exist on a given number of vertices without missing any or counting the same graph twice in disguise. Counting graphs up to isomorphism means grouping all isomorphic drawings together and counting each distinct structure only once.

Let's find the total number of simple graphs on 44 vertices up to isomorphism.

Counting Graphs on Four Vertices Up to Isomorphism
AA
BB
CC
DD
AA
BB
CC
DD
AA
BB
CC
DD
AA
BB
CC
DD
AA
BB
CC
DD
AA
BB
CC
DD
Text solution
Sort into buckets by edge count and list 0, 1, and 2 edgesOn 44 vertices, a simple graph has between 00 and 66 edges. There is 11 graph with 00 edges and 11 with 11 edge, while 22 edges either sit separate or share a vertex, giving 22 non-isomorphic graphs with different degree sequences.
0 edges:(0,0,0,0)→1 graph1 edge:(1,1,0,0)→1 graph2 edges:(1,1,1,1), (2,1,1,0)→2 graphs\displaystyle \begin{aligned} 0 \text{ edges:} &\quad \holds{(0, 0, 0, 0)} \quad \to 1 \text{ graph} \\ 1 \text{ edge:} &\quad \holds{(1, 1, 0, 0)} \quad \to 1 \text{ graph} \\ 2 \text{ edges:} &\quad \holds{(1, 1, 1, 1)},\ \\ &\quad \holds{(2, 1, 1, 0)} \quad \to 2 \text{ graphs} \end{aligned}
Classify 3-edge graphs by maximum degree using the handshake lemmaWith 33 edges, the four degrees sum to 2×3=62 \times 3 = 6, so the maximum degree cannot be 1\holds{1} (1+1+1+1=4<61 + 1 + 1 + 1 = \fails{4 < 6}). A maximum degree of 3\holds{3} gives a 33-pointed star, and a maximum degree of 2\holds{2} gives either a triangle with a lone vertex or a 44-vertex chain, producing 33 graphs with distinct degree sequences.
3 edges (degree sum 6):max degree 3→(3,1,1,1)(star)max degree 2→(2,2,2,0)(triangle + lone vertex)max degree 2→(2,2,1,1)(4-vertex chain)→3 graphs\displaystyle \begin{aligned} &3 \text{ edges (degree sum } 6\text{):} \\ &\quad \text{max degree } \holds{3} \to \holds{(3, 1, 1, 1)} \\ &\qquad \text{(star)} \\ &\quad \text{max degree } \holds{2} \to \holds{(2, 2, 2, 0)} \\ &\qquad \text{(triangle + lone vertex)} \\ &\quad \text{max degree } \holds{2} \to \holds{(2, 2, 1, 1)} \\ &\qquad \text{(4-vertex chain)} \\ &\to 3 \text{ graphs} \end{aligned}
Count 4, 5, and 6 edges using complements in K4K_4 and sum the bucketsChoosing 44, 55, or 66 edges to draw on 44 vertices is the same as starting with all 66 edges of the complete graph K4K_4 and choosing 2\fails{2}, 1\fails{1}, or 0\fails{0} edges to erase (taking the complement), which mirrors the first three buckets and brings the total to 1111 graphs.
4 edges (2 erased from K4):(2,2,2,2), (3,2,2,1)→2 graphs5 edges (1 erased from K4):(3,3,2,2)→1 graph6 edges (0 erased from K4):(3,3,3,3)→1 graphTotal up to isomorphism:1+1+2+3+2+1+1=11 graphs\displaystyle \begin{aligned} &4 \text{ edges (}\fails{2} \text{ erased from } K_4\text{):} \\ &\quad \holds{(2, 2, 2, 2)},\ \\ &\quad \holds{(3, 2, 2, 1)} \to 2 \text{ graphs} \\ &5 \text{ edges (}\fails{1} \text{ erased from } K_4\text{):} \\ &\quad \holds{(3, 3, 2, 2)} \to 1 \text{ graph} \\ &6 \text{ edges (}\fails{0} \text{ erased from } K_4\text{):} \\ &\quad \holds{(3, 3, 3, 3)} \to 1 \text{ graph} \\ &\text{Total up to isomorphism:} \\ &\quad 1 + 1 + 2 + 3 + 2 + 1 + 1 \\ &\quad = 11 \text{ graphs} \end{aligned}
0 edges0\text{ edges}
(0,0,0,0)\htmlClass{lc-green}{(0, 0, 0, 0)}
1 edge1\text{ edge}
(1,1,0,0)\htmlClass{lc-green}{(1, 1, 0, 0)}
2 edges2\text{ edges}
(1,1,1,1)\htmlClass{lc-green}{(1, 1, 1, 1)}
(2,1,1,0)\htmlClass{lc-green}{(2, 1, 1, 0)}
3 edges3\text{ edges}
(3,1,1,1)\htmlClass{lc-green}{(3, 1, 1, 1)}
(2,2,2,0)\htmlClass{lc-green}{(2, 2, 2, 0)}
(2,2,1,1)\htmlClass{lc-green}{(2, 2, 1, 1)}
4 edges4\text{ edges}
(2,2,2,2)\htmlClass{lc-green}{(2, 2, 2, 2)}
(3,2,2,1)\htmlClass{lc-green}{(3, 2, 2, 1)}
5 edges5\text{ edges}
(3,3,2,2)\htmlClass{lc-green}{(3, 3, 2, 2)}
6 edges6\text{ edges}
(3,3,3,3)\htmlClass{lc-green}{(3, 3, 3, 3)}

Every kk-edge graph on 44 vertices is paired with a (6−k)\fails{(6 - k)}-edge complement formed by the missing edges of K4K_4, and redrawing the same 44-vertex chain as a U, Z, or N keeps its degree sequence and complement structure unchanged.

On four vertices, different drawings with the same connections share a degree sequence, and whichever of the six edges are missing form its complement.
6

The Isomorphism Checklist and Large Graphs

Now let's put the whole method together into one checklist for testing any pair of graphs, and see why comparing massive graphs is one of the famous open problems in computer science.

The Isomorphism Checklist and Large Graphs
AA
BB
CC
DD
EE
11
22
33
44
55
ABCDA0100B1010C0101D0010\begin{array}{c|cccc} & A & B & C & D \\ \hline A & 0 & \htmlClass{lc-green}{1} & 0 & 0 \\ B & \htmlClass{lc-green}{1} & 0 & \htmlClass{lc-green}{1} & 0 \\ C & 0 & \htmlClass{lc-green}{1} & 0 & \htmlClass{lc-green}{1} \\ D & 0 & 0 & \htmlClass{lc-green}{1} & 0 \end{array}
123410010200013100140110\begin{array}{c|cccc} & 1 & 2 & 3 & 4 \\ \hline 1 & 0 & 0 & \htmlClass{lc-green}{1} & 0 \\ 2 & 0 & 0 & 0 & \htmlClass{lc-green}{1} \\ 3 & \htmlClass{lc-green}{1} & 0 & 0 & \htmlClass{lc-green}{1} \\ 4 & 0 & \htmlClass{lc-green}{1} & \htmlClass{lc-green}{1} & 0 \end{array}

Key concepts

When you are asked whether two graphs are isomorphic, always work from the fastest checks to the most detailed ones so you don't waste time trying to match vertices on graphs that are actually different:

Start with counts and the sorted degree sequence

Count the vertices and edges (in an adjacency matrix, add each row to get the vertex degrees and use edges=sum of degrees2\text{edges} = \tfrac{\text{sum of degrees}}{2}), then list the degrees from largest to smallest, such as (3,3,2,1,1)\holds{(3, 3, 2, 1, 1)}. If the vertex count, edge count, or degree sequence differs, stop right there: they are not isomorphic.

When the degree sequences match, check neighbor degrees and loops before guessing a bijection

Look at the neighbors of high-degree vertices (for instance, whether the two degree-3\holds{3} vertices connect to each other), count triangles (3\walk{3}-step closed loops) versus 4\walk{4}-step loops, and check that both graphs have the same number of connected pieces. A single difference in any of these invariants proves the graphs are not isomorphic.

Switch to the complement when a graph is crowded with edges

If a graph has nearly all possible edges (such as 55 edges on 44 vertices, or 77 edges on 55 vertices where only 3\fails{3} of the 1010 possible edges are missing), compare the complements (the graphs formed by the missing edges) instead of untangling the full drawings.

When every check passes, lock in the bijection and verify the edges

Matching invariants never prove two graphs are isomorphic on their own. Match vertices with unique degrees first (C=2,E=5\matched{C = 2}, \matched{E = 5}), use neighbor degrees to break ties among equal-degree vertices (D=1\matched{D = 1}), and check that every edge on the left maps to an edge on the right (A-B→3-4\holds{A\text{-}B} \matched{\to} \holds{3\text{-}4}) with the same total number of edges. In an adjacency matrix, reorder both the rows and the columns in that matching order so the two matrices match entry for entry.

7

Practice

1

Graph GG has vertices A,B,C,D,EA, B, C, D, E and 66 edges: A-BA\text{-}B, A-CA\text{-}C, A-DA\text{-}D, B-CB\text{-}C, C-DC\text{-}D, and D-ED\text{-}E. Graph HH has vertices 1,2,3,4,51, 2, 3, 4, 5 and 66 edges: 1-31\text{-}3, 2-32\text{-}3, 2-42\text{-}4, 2-52\text{-}5, 3-53\text{-}5, and 4-54\text{-}5. Find all isomorphisms between GG and HH, and verify that your matching preserves adjacency.

Find the degree of every vertex in GG and HH to lock in the unique degrees first; then, among the three degree-33 vertices in each graph, ask which one is connected to the degree-11 vertex.

In GG, the vertex degrees are A:3A: \holds{3}, C:3C: \holds{3}, D:3D: \holds{3}, B:2B: \holds{2}, E:1E: \holds{1}. In HH, the degrees are 2:32: \holds{3}, 3:33: \holds{3}, 5:35: \holds{3}, 4:24: \holds{2}, 1:11: \holds{1}. Matching unique degrees forces E=1\matched{E = 1} (degree 1\holds{1}) and B=4\matched{B = 4} (degree 2\holds{2}). Watch out for the common slip of treating all three degree-3\holds{3} vertices (A,C,DA, C, D) as interchangeable; for instance, setting D=5\fails{D = 5} makes D-E→5-1D\text{-}E \to \fails{5\text{-}1}, which is not an edge in HH. Among the degree-3\holds{3} vertices in GG, only DD is adjacent to the degree-1\holds{1} vertex EE, and among the degree-3\holds{3} vertices in HH, only 33 is adjacent to the degree-1\holds{1} vertex 11, which forces D=3\matched{D = 3}. The remaining two degree-3\holds{3} vertices, AA and CC, both connect to B,D,B, D, and each other, so they can match 22 and 55 in either order (don't forget to list both!). Checking the 66 edges of GG under the first matching gives A-B→2-4\holds{A\text{-}B} \matched{\to} \holds{2\text{-}4}, A-C→2-5\holds{A\text{-}C} \matched{\to} \holds{2\text{-}5}, A-D→2-3\holds{A\text{-}D} \matched{\to} \holds{2\text{-}3}, B-C→4-5\holds{B\text{-}C} \matched{\to} \holds{4\text{-}5}, C-D→5-3\holds{C\text{-}D} \matched{\to} \holds{5\text{-}3}, and D-E→3-1\holds{D\text{-}E} \matched{\to} \holds{3\text{-}1}, which are the exact 66 edges of HH. Thus there are 22 isomorphisms: (A=2,B=4,C=5,D=3,E=1)\matched{(A = 2, B = 4, C = 5, D = 3, E = 1)} and (A=5,B=4,C=2,D=3,E=1)\matched{(A = 5, B = 4, C = 2, D = 3, E = 1)}.
2

Two 44-vertex graphs are given by their adjacency matrices. Graph 1 (vertices A,B,C,DA, B, C, D) has rows A:[0 1 1 1]A: [0\ 1\ 1\ 1], B:[1 0 1 0]B: [1\ 0\ 1\ 0], C:[1 1 0 0]C: [1\ 1\ 0\ 0], D:[1 0 0 0]D: [1\ 0\ 0\ 0]. Graph 2 (vertices 1,2,3,41, 2, 3, 4) has rows 1:[0 0 1 1]1: [0\ 0\ 1\ 1], 2:[0 0 1 0]2: [0\ 0\ 1\ 0], 3:[1 1 0 1]3: [1\ 1\ 0\ 1], 4:[1 0 1 0]4: [1\ 0\ 1\ 0]. Use row sums and neighbors to determine whether the graphs are isomorphic, and if so, give the row-and-column ordering of Graph 2 that makes its matrix identical to Graph 1's matrix.

Add across each row to find the vertex degrees, match the unique degree-33 and degree-11 vertices first, and remember what must move along with the rows when you reorder the matrix.

Summing the rows gives the degrees: in Graph 1, AA has degree 3\holds{3}, BB and CC have degree 2\holds{2}, and DD has degree 1\holds{1}; in Graph 2, 33 has degree 3\holds{3}, 11 and 44 have degree 2\holds{2}, and 22 has degree 1\holds{1} (both degree sums are 88, giving 82=4\tfrac{8}{2} = 4 edges). Matching unique degrees forces A=3\matched{A = 3} and D=2\matched{D = 2}. The two degree-2\holds{2} vertices BB and CC in Graph 1 are adjacent to AA and to each other, matching 11 and 44 in Graph 2 in either order (B=1,C=4\matched{B = 1, C = 4} or B=4,C=1\matched{B = 4, C = 1}). Be careful not to reorder only the rows of Graph 2 into (3,1,4,2)(3, 1, 4, 2) while leaving the columns in the original order (1,2,3,4)\fails{(1, 2, 3, 4)}, which leaves the top row as [1 1 0 1]\fails{[1\ 1\ 0\ 1]} instead of [0 1 1 1][0\ 1\ 1\ 1] and makes it look like the matrices don't match. Yes, the graphs are isomorphic, and reordering both the rows and the columns of Graph 2 into the order (3,1,4,2)\matched{(3, 1, 4, 2)} or (3,4,1,2)\matched{(3, 4, 1, 2)} makes its matrix identical to Graph 1's matrix.
3

Graph GG has 66 vertices A,B,C,D,E,FA, B, C, D, E, F and 55 edges: A-BA\text{-}B, A-CA\text{-}C, A-DA\text{-}D, B-EB\text{-}E, and C-FC\text{-}F. Graph HH has 66 vertices 1,2,3,4,5,61, 2, 3, 4, 5, 6 and 55 edges: 1-21\text{-}2, 1-41\text{-}4, 1-51\text{-}5, 2-32\text{-}3, and 3-63\text{-}6. Show that GG and HH have the same number of vertices, number of edges, and degree sequence, and prove whether or not they are isomorphic.

After verifying that the sorted degree sequences match, look at the unique degree-33 vertex in each graph and list the degrees of its three neighbors.

Both graphs have 66 vertices, 55 edges, and the exact same degree sequence (3,2,2,1,1,1)\holds{(3, 2, 2, 1, 1, 1)} (in GG, degrees are A:3A: \holds{3}, B:2B: \holds{2}, C:2C: \holds{2}, D:1D: \holds{1}, E:1E: \holds{1}, F:1F: \holds{1}; in HH, degrees are 1:31: \holds{3}, 2:22: \holds{2}, 3:23: \holds{2}, 4:14: \holds{1}, 5:15: \holds{1}, 6:16: \holds{1}). Don't stop at the matching degree sequence and conclude the graphs are isomorphic, or match the degree-2\holds{2} vertices B,CB, C to 2,32, 3 without checking that A-C\holds{A\text{-}C} is an edge in GG while 1-3\fails{1\text{-}3} is not an edge in HH. In GG, the unique degree-3\holds{3} vertex AA is adjacent to two degree-2\holds{2} vertices (BB and CC) and one degree-1\holds{1} vertex (DD), whereas in HH, the unique degree-3\holds{3} vertex 11 is adjacent to one degree-2\holds{2} vertex (22) and two degree-1\holds{1} vertices (44 and 55). Because AA would have to map to 11 and their neighbors do not have matching degrees, GG and HH are not isomorphic.
4

Graph GG has 66 vertices A,B,C,D,E,FA, B, C, D, E, F and 77 edges: A-BA\text{-}B, B-CB\text{-}C, C-AC\text{-}A, C-DC\text{-}D, D-ED\text{-}E, E-FE\text{-}F, and F-DF\text{-}D. Graph HH has 66 vertices 1,2,3,4,5,61, 2, 3, 4, 5, 6 and 77 edges: 1-21\text{-}2, 2-32\text{-}3, 3-43\text{-}4, 4-54\text{-}5, 5-65\text{-}6, 6-16\text{-}1, and 1-41\text{-}4. Verify that both graphs have the same degree sequence and the same neighbor degrees for every vertex, then prove they are not isomorphic.

Since the degree sequences and even the neighbor degrees match everywhere, count how many steps it takes to walk around the shortest closed loop in each graph.

Both GG and HH are connected in one piece, have 66 vertices and 77 edges, and share the degree sequence (3,3,2,2,2,2)\holds{(3, 3, 2, 2, 2, 2)} (CC and DD have degree 3\holds{3} in GG; 11 and 44 have degree 3\holds{3} in HH). Even the neighbor degrees match at every vertex: in both graphs, each degree-3\holds{3} vertex connects to one degree-3\holds{3} vertex and two degree-2\holds{2} vertices, and each degree-2\holds{2} vertex connects to one degree-3\holds{3} vertex and one degree-2\holds{2} vertex. Watch out for the trap of assuming that matching neighbor degrees guarantee an isomorphism (trying to match C=1\matched{C = 1} and its degree-2\holds{2} neighbors A,BA, B to 2,62, 6 fails because A-B\holds{A\text{-}B} is an edge in GG whereas 2-6\fails{2\text{-}6} is not an edge in HH). Graph GG has 2\holds{2} triangles (A-B-C-A\walk{A\text{-}B\text{-}C\text{-}A} and D-E-F-D\walk{D\text{-}E\text{-}F\text{-}D}, closed loops of 3\walk{3} steps), while Graph HH has 0\fails{0} triangles (its shortest closed loops, 1-2-3-4-1\walk{1\text{-}2\text{-}3\text{-}4\text{-}1} and 1-6-5-4-1\walk{1\text{-}6\text{-}5\text{-}4\text{-}1}, take 4\walk{4} steps), so GG and HH are not isomorphic.
5

Graph GG on vertices A,B,C,D,EA, B, C, D, E and Graph HH on vertices 1,2,3,4,51, 2, 3, 4, 5 each have 77 edges. In GG, every pair of vertices is connected except A-BA\text{-}B, B-CB\text{-}C, and C-DC\text{-}D. In HH, every pair of vertices is connected except 1-41\text{-}4, 4-24\text{-}2, and 2-52\text{-}5. Use the complements of GG and HH to find an isomorphism between them.

Draw only the 33 missing edges for each graph, remembering not to leave out the 55th vertex that has no missing edges, and match the resulting chains from one end to the other.

On 55 vertices there are 1010 possible edges, so each 77-edge graph is missing 3\fails{3} edges, and two graphs are isomorphic if and only if their complements are isomorphic. In the complement of GG, the 3\fails{3} missing edges form the 44-vertex chain A-B-C-D\fails{A\text{-}B\text{-}C\text{-}D} while EE sits isolated (degree 0\holds{0} in the complement, meaning degree 4\holds{4} in GG). In the complement of HH, the 3\fails{3} missing edges form the 44-vertex chain 1-4-2-5\fails{1\text{-}4\text{-}2\text{-}5} while 33 sits isolated. Matching the isolated vertices forces E=3\matched{E = 3}. Be careful not to match A,B,C,DA, B, C, D to the numbers 1,2,4,51, 2, 4, 5 in numerical order ((A=1,B=2,C=4,D=5,E=3)\fails{(A = 1, B = 2, C = 4, D = 5, E = 3)} swaps the middle vertices 22 and 44 of the chain 1-4-2-5\fails{1\text{-}4\text{-}2\text{-}5}). Matching the chain A-B-C-D\fails{A\text{-}B\text{-}C\text{-}D} along 1-4-2-5\fails{1\text{-}4\text{-}2\text{-}5} in either direction gives the 22 isomorphisms: (A=1,B=4,C=2,D=5,E=3)\matched{(A = 1, B = 4, C = 2, D = 5, E = 3)} and (A=5,B=2,C=4,D=1,E=3)\matched{(A = 5, B = 2, C = 4, D = 1, E = 3)}.
6

How many different simple graphs are there on 55 vertices with 33 edges, up to isomorphism? Use that result to state how many different simple graphs there are on 55 vertices with 77 edges, up to isomorphism.

Use the handshake lemma (55 degrees summing to 66) and classify by maximum degree as in the 44-vertex case, watching out for a 33-edge arrangement that uses all 55 vertices at once.

By the handshake lemma, 33 edges mean the 55 vertex degrees must sum to 2×3=62 \times 3 = 6. Classifying by maximum degree: (1) Maximum degree 3\holds{3} gives a 33-pointed star plus 11 isolated vertex, with degrees (3,1,1,1,0)\holds{(3, 1, 1, 1, 0)}. (2) Maximum degree 2\holds{2} gives three possibilities: a triangle plus 22 isolated vertices with degrees (2,2,2,0,0)\holds{(2, 2, 2, 0, 0)}; a 44-vertex chain plus 11 isolated vertex with degrees (2,2,1,1,0)\holds{(2, 2, 1, 1, 0)}; or a 33-vertex V-shape plus a separate edge on the remaining 22 vertices with degrees (2,1,1,1,1)\holds{(2, 1, 1, 1, 1)}. Avoid the common slip of getting only 3\fails{3} graphs by just adding an isolated 55th vertex to each of the three 44-vertex, 33-edge graphs, which misses (2,1,1,1,1)\holds{(2, 1, 1, 1, 1)} because that graph has no isolated vertex. (3) Maximum degree 1\holds{1} or 0\holds{0} is impossible because 55 vertices of degree at most 1\holds{1} have degree sum at most 5<6\fails{5 < 6}. Since all 44 possibilities have different degree sequences, none are isomorphic. Furthermore, because K5K_5 has 1010 edges and choosing 77 edges to draw is the same as choosing 10−7=310 - 7 = \fails{3} edges to erase (taking the complement), there are 44 simple graphs with 33 edges and 44 simple graphs with 77 edges.