Skip to main content

Section 3.5 Classifying Graphs

A common theme across the sciences is to classify objects of a particular type. For example, how might we classify all trees with seven vertices? Since there are only finitely many, we can create a list of trees having seven vertices so that any tree with seven vertices is isomorphic to a tree on our list and no two trees on our list are isomorphic. We begin by discussing how to show that two graphs are not isomorphic.

Subsection 3.5.A Nonisomorphic Graphs

Here is a not terribly useful definition of nonisomorphic graphs.

Definition 3.5.1 Nonisomorphic.

Two graphs \(G\) and \(H\) are nonisomorphic, denoted \(G \ncong H\text{,}\) if they are not isomorphic. That is, if it is impossible to label the vertices of \(G\) and the vertices of \(H\) in such a way that \(G\) and \(H\) have the same vertices and the same edges.
This definition is not useful in writing proofs because it is subtle to prove that something is impossible. We might not find a way to label the vertices that shows that two graphs are isomorphic, but that does not prove that there is no labeling. We might not be able to visualize how one graph can be transformed into the other, but that does not mean that there is no way to do so. Let’s look at an example.

Example 3.5.2 Showing \(G_1\) and \(G_3\) are nonisomorphic.

Although they share many common properties, the graphs \(G_1\) and \(G_3\) drawn in FigureΒ 3.4.1 are not isomorphic. Prove it.
Solution.
Let’s start with the labeling of \(G_1\) from FigureΒ 3.4.9. The only degree 3 vertex in \(G_1\) is labeled \(c\text{.}\) That means \(c\) is the only vertex that appears in exactly three edges. The graph \(G_3\) has one degree 3 vertex, and if we want to produce the same edge list as \(G_1\text{,}\) that vertex needs to be labeled \(c\) to match, as shown in FigureΒ 3.5.3.
Figure 3.5.3. Trying to label \(G_3\) to match \(G_1\) (and failing).
Next, in \(G_1\text{,}\) the vertex \(c\) has exactly one neighbor with degree one, and it is labeled \(x\text{.}\) But in \(G_3\text{,}\) the vertex \(c\) has two neighbors with degree one. If we label one of those neighbors \(x\text{,}\) the other cannot be labeled (?). We are stuck. There is no common labeling. Therefore, \(G\) and \(K\) are not isomorphic.
Notice that we have identified a property that distinguishes \(G_1\) from \(G_3\text{,}\) namely \(G_1\) has exactly one vertex with degree three and that vertex has exactly one neighbor with degree one, but \(G_3\) does not have that property. This observation gives us a shorter proof that \(G_1\) and \(G_3\) are not isomorphic. After all, if they were the same graph, then they would have shared all graph-theoretic properties.
We can make the type of argument we used in ExampleΒ 3.5.2 more formal. We start with another definition.

Definition 3.5.4 Graph invariant.

A graph invariant is a property \(\mathcal{P}\) that satisfies (\(\star\)) If a graph \(G\) has the property \(\mathcal{P}\) and \(G \cong H\text{,}\) then \(H\) also has the property \(\mathcal{P}\text{.}\) For example, β€œhaving exactly one degree three vertex” is a graph invariant.

Example 3.5.5 Examples of graph invariants.

List some examples of specific graph invariants.
Solution.
Here are some arbitrary examples.
Officially, we should prove that each of these properties is a graph invariant. Some properties that are not graph invariants are β€œis drawn as a 5-cycle plus edges” or β€œhas adjacent vertices labeled \(a\) and \(b\)”. More generally, any property that refers to how a graph is drawn or labeled is not a graph invariant.
We can use graph invariants to prove that two graphs are not isomorphic.

Remark 3.5.6 Using graph invariants to prove that two graphs are not isomorphic.

If two graphs are isomorphic, then they are the same graph, and therefore they must agree on all graph invariants. Equivalently
 1 
The statement \(\star\star\) is the contrapositive of \(\star\text{.}\) We will prove in SectionΒ 5.4 that a statement and its contrapositive are logically equivalent.
, for a graph invariant \(\mathcal{P}\text{,}\) (\(\star\star\)) If a graph \(G\) has the property \(\mathcal{P}\) but the graph \(H\) does not have the property \(\mathcal{P}\text{,}\) then \(G \ncong H\text{.}\) Therefore, to prove that graphs \(G\) and \(H\) are not isomorphic, we can find an invariant that \(G\) has but \(H\) does not or vice versa.
Let’s look at an example.

Example 3.5.7 Use a graph invariant to show not isomorphic.

Β 
  1. Show that the graphs \(D_1\) and \(D_2\) drawn in FigureΒ 3.5.8 are not isomorphic by finding a distinguishing graph invariant.
    Figure 3.5.8. Nonisomorphic graphs from ExampleΒ 3.5.7 (a).
    Solution.
    One reason \(D_1\) and \(D_2\) are nonisomorphic is that \(D_1\) has a vertex of degree one and \(D_2\) does not. Another reason is that they have different degree sequences: \(3,2,2,1\) for \(D_1\) versus \(2,2,2,2\) for \(D_2\text{.}\) Yet another reason is \(D_2\) contains a 4-cycle but \(D_1\) does not. And so on. Only one distinguishing graph invariant is needed. For any of these reasons, \(D_1 \ncong D_2\text{.}\)
  2. Show that the graphs \(E_1\) and \(E_2\) drawn in FigureΒ 3.5.9 are not isomorphic by finding a distinguishing graph invariant.
    Figure 3.5.9. The graphs \(E_1\) and \(E_2\) are not isomorphic.
    Solution.
    One reason \(E_1\) and \(E_2\) are nonisomorphic is that \(E_1\) contains two 5-cycles and \(E_2\) does not contain any 5-cycles. Another reason is that \(E_2\) can be 2-colored but \(E_1\) cannot, as shown in FigureΒ 3.5.10.
    Figure 3.5.10. The graph \(E_2\) can be 2-colored but the graph \(E_1\) cannot.
    Note that any 2-coloring of \(E_1\) would have to alternate around the 8-cycle but then the opposite end of the chord would have to be a third color. A different, quite complicated reason why \(E_1\) and \(E_2\) are nonisomorphic is that in \(E_2\) there is a pair of adjacent degree two vertices each of which has a degree three neighbor (the black vertex and white vertex to the right of the chord edge), but in \(E_1\) no pair of adjacent degree two both have degree three neighbors. For any of these reasons, \(E_1 \ncong E_2\text{.}\)
Your turn to practice showing graphs are not isomorphic and deciding whether or not two graphs are isomorphic.

Activity 3.5.A Show two graphs are not isomorphic.

Β 
  1. Check that the graphs drawn in FigureΒ 3.5.12 have the same number of vertices, the same number of edges, and the same degree sequence and find a 4-cycle in each graph.
    Figure 3.5.12. Nonisomorphic graphs for ActivityΒ 3.5.A (a) and (b).
  2. Show that the graphs drawn in FigureΒ 3.5.12 are nonisomorphic by finding a graph invariant that distinguishes the two graphs.
  3. Show the trees drawn in FigureΒ 3.5.13 are nonisomorphic by finding a graph invariant that distinguishes the two graphs.
    Figure 3.5.13. Nonisomorphic trees for ActivityΒ 3.5.A (c).
  4. Decide if the graphs drawn in FigureΒ 3.5.14 are isomorphic or not and justify your answer.
    Figure 3.5.14. Graphs for ActivityΒ 3.5.A (d).
  5. Decide whether the graphs drawn in FigureΒ 3.5.15 are isomorphic or not and justify your answer.
    Figure 3.5.15. Graphs for ActivityΒ 3.5.A (e).

Subsection 3.5.B Graph Classification

We are ready to return to classifying graphs.

Example 3.5.16 First example of classifying graphs.

Β 
  1. Classify all graphs with three vertices. That is, make a list of graphs having three vertices so that any graph with three vertices is isomorphic to a graph on our list and no two graphs on our list are isomorphic.
    Solution.
    There are four such graphs drawn in FigureΒ 3.5.17. No two of these graphs are isomorphic because they have a different number of edges. You can (and should) convince yourself that there are no other options.
    Figure 3.5.17. All graphs with three vertices.
  2. Classify all graphs with four vertices and three edges.
    Solution.
    There are three such graphs drawn in FigureΒ 3.5.18, labeled with their degree sequence. These graphs are not isomorphic because they have different degree sequences.
    To check that this list is complete, suppose that we have a graph with four vertices and three edges. By TheoremΒ 3.2.5, the sum of the degrees of the vertices is equal to twice the number of edges, which is \(2(3)=6\text{.}\) The degree sequence must be four nonnegative integers whose sum is equal to six. We consider the possibilities.
    Case 1: The max degree is three. Notice that every other vertex is adjacent to the degree three vertex, and so the degree sequence is \(3,1,1,1\text{.}\) We get \(K_{1,3}\text{,}\) which is the graph on the left in FigureΒ 3.5.18.
    Case 2: The max degree must be two and there is an isolated vertex. The degree sequence would have to be \(2,2,2,0\text{.}\) Moreover, none of the three vertices having degree two can be adjacent to the isolated vertex, so the vertices having degree two must form a 3-cycle, and so we get the graph in the middle in FigureΒ 3.5.18.
    Case 3: The max degree is two and there is no isolated vertices. Then, the degree sequence is \(2, 2, 1, 1\text{.}\) The two degree two vertices must be adjacent to each other, and so we obtain a copy of \(P_4\text{,}\) which is the graph on the right in the graph in the middle of FigureΒ 3.5.18.
    Notice that checking the graphs were non-isomorphic was much easier than checking that we found all such graphs.
    Figure 3.5.18. All graphs with four vertices and three edges.
It can be challenging to decide whether a classification is complete. One tool that can help is graph complements.

Example 3.5.19 Using complements to classify graphs.

Β 
  1. Classify all graphs with four vertices and two edges.
    Solution.
    If the two edges share a common endpoint, then we get a graph \(A\) that has the path \(P_3\) and an isolated fourth vertex. Otherwise, we get a graph \(B\) that has two separate copies of \(P_2\text{.}\) Both are drawn in FigureΒ 3.5.20.
  2. Use the result of (a) to classify all graphs with four vertices and four edges.
    Solution.
    Since the complete graph \(K_4\) has six edges, the complement of any graph with four vertices and four edges must have four vertices and two edges. That is, the complement must be one of the two graphs we found in (a). The two graphs with four vertices and four edges are, therefore, \(\overline{A}\) and \(\overline{B}\) which are also drawn in FigureΒ 3.5.20. We drew them without edge crossings just for fun, so look closely at the vertex labels.
    Figure 3.5.20. All graphs with four vertices and two or four edges.
Now, it is your turn to try classification.

Activity 3.5.B Classifying trees.

Β 
  1. What is a tree?
  2. Explain why the path \(P_3\) is the only tree with three vertices.
  3. There are two trees with four vertices. Draw them.
  4. Classify all trees with five vertices. That is, make a list of trees having five vertices so that any tree with five vertices is isomorphic to a tree on your list and no two trees on your list are isomorphic.
  5. Classify all trees with six vertices. Hint: Organize your work by drawing the longest possible path horizontally.
  6. Classify all trees with seven vertices. Hint: Organize your work by drawing the longest possible path horizontally.

Subsection 3.5.C Detour: Robots

We continue to practice classification.

Activity 3.5.C Robots.

For the sake of this activity, we invent the following definition.

Definition 3.5.23 Robot.

A connected graph is a robot if it contains one 3-cycle and no other cycles. For example, the graphs drawn in FigureΒ 3.5.24 are robots. The left robot has seven vertices, and the right robot has eight.
Figure 3.5.24. Two robots.
  1. The only robot with three vertices is a 3-cycle. There is only one robot with four vertices. Draw it and explain why it is the only one.
  2. There are three different robots with five vertices. Draw them.
  3. How many different robots are there with six vertices. Hint: Organize your work based on how many vertices of the 3-cycle have edges beyond the 3-cycle β€” all three, two of them, or only one of them.

Subsection 3.5.D Exercises

Subsubsection Exercises for 3.5.A Nonisomorphic Graphs

1. Practice.

Show that the graphs drawn in FigureΒ 3.5.26 are nonisomorphic by finding a graph invariant that distinguishes the two graphs.
Figure 3.5.26. Nonisomorphic graphs for Exercise 1.
Check.
Hint: One answer is that the graph on the left has the degree sequence \(4,3,3,3,3\text{,}\) but the graph on the right has a different degree sequence. Can you find an easier answer?

2. Practice.

Use complements to show that the graphs drawn in FigureΒ 3.5.28 are nonisomorphic by finding a graph invariant that distinguishes the complements of the two graphs.
Figure 3.5.28. Nonisomorphic graphs for Exercise 2.
Check.
The complement of the graph on the left is disconnected (it is two copies of \(C_3\)), but the graph on the right has a complement that is connected (it is isomorphic to \(C_6\)).

3. Practice.

Decide whether the graphs in FigureΒ 3.5.30 are isomorphic and carefully justify your answer.
Figure 3.5.30. The Harary graph \(H_{3,6}\) and the complete bipartite graph \(K_{3,3}\) for Exercise 3.
Check.
Hint: They are isomorphic. To prove that they are isomorphic, label the vertices so that they have the same vertices and the same edges. (It is not enough to show that they have many invariants in common.)

4. Practice.

Decide whether the graphs in FigureΒ 3.5.32 are isomorphic and carefully justify your answer.
Figure 3.5.32. The graphs for Exercise 4.
Check.
Hint: They are isomorphic. Label the vertices so that they have the same vertices and the same edges. Start with the degree two vertices, then their neighbors.

5. Practice.

Use complements to decide whether the graphs in FigureΒ 3.5.34 are isomorphic and carefully justify your answer.
Figure 3.5.34. The graphs for Exercise 5.
Check.
Hint: They are isomorphic. Their complements are a copy of \(P_2\) and two isolated vertices. Prove that the complements are isomorphic by labeling the vertices.

6. Understand.

Decide whether the graphs in FigureΒ 3.5.36 are isomorphic and carefully justify your answer.
Figure 3.5.36. The graphs for Exercise 6.
Check.
Hint: They are not isomorphic. You can find a distinguishing invariant based on the cyclic subgraphs.

7. Understand.

Use complements to decide whether the graphs in FigureΒ 3.5.38 are isomorphic and carefully justify your answer.
Figure 3.5.38. The graphs for Exercise 7.
Check.
Hint: Look closely at the complements. The complements are nonisomorphic. Explain why.

8. Recap.

Do you know …
  1. What a graph invariant is?
  2. Why finding a distinguishing invariant proves that two graphs are not isomorphic?
  3. What some examples of graph invariants are?
  4. How we can prove that two graphs are not isomorphic (by finding a distinguishing invariant)?
  5. How to use complements to prove that two graphs are isomorphic or nonisomorphic?
  6. How to use planarity-style moves to decide whether two graphs are isomorphic or not?

9. Explore.

Decide whether the graphs in FigureΒ 3.5.41 are isomorphic and carefully justify your answer.
Figure 3.5.41. The graphs for Exercise 9.
Check.
Hint: Look at the neighbors of the degree four vertex. How are they adjacent to one another?

Subsubsection Exercises for 3.5.B Graph Classification

In these classification exercises, no justification is required, but make sure that your list is complete and that no two graphs on your list are isomorphic.

10. Practice.

Classify all graphs with eight vertices and nine edges that contain an 8-cycle.

12. Understand.

Classify all connected graphs with five vertices and six edges.
Check.
Hint: Small graphs are often given names that describe what they look like. Four of the answers are named the house, the kite, the dart, and the bowtie. (Please figure these out yourself, without peeking at resources!) There is one more possibility, but I do not know if it has a name.

15. Explore.

Classify all regular graphs with six vertices. Recall that in a regular graph, all vertices have the same degree \(r\text{.}\) Consider the cases \(r=0\text{,}\) \(r=1\text{,}\) \(r=2\text{,}\) \(r=3\text{,}\) \(r=4\text{,}\) and \(r=5\text{.}\)
Check.
Hint: There are one 0-regular, one 1-regular, and two 2-regular graphs. You can check if you have the correct number of 3-regular, 4-regular, and 5-regular by considering their complements.

16. Explore.

Classify all trees with eight vertices. Hint: Organize your work by drawing the longest possible path horizontally. Another hint: there are 23 of them.

Subsection 3.5.E Exercises for 3.5.C Detour: Robots

17. Practice.

A connected graph is super-robot if it contains one 4-cycle and no other cycles. Draw a super-robot with six vertices, one with seven vertices, and one with eight vertices.

18. Explore.

Classify all robots with seven vertices. No justification is required, but make sure that your list is complete and that no two robots on your list are isomorphic.

19. Explore.

Super-robots were defined in Exercise 17. Draw all super-robots with eight vertices. No justification is required, but make sure that your list is complete and that no two super-robots on your list are isomorphic.