Section 4.1 Definitions
Investigate!
Which (if any) of the graphs below are the same?
The graphs above are unlabeled. Usually we think of a graph as having a specific set of vertices. Which (if any) of the graphs below are the same?
Actually, all the graphs we have seen above are just drawings of graphs. A graph is really an abstract mathematical object consisting of two sets \(V\) and \(E\) where \(E\) is a set of 2element subsets of \(V\text{.}\) Are the graphs below the same or different?
 Graph 1:

\(V = \{a, b, c, d, e\}\text{,}\)
\(E = \{\{a,b\}, \{a, c\}, \{a,d\}, \{a,e\}, \{b,c\}, \{d,e\}\}\text{.}\)
 Graph 2:

\(V = \{v_1, v_2, v_3, v_4, v_5\}\text{,}\)
\(E = \{\{v_1, v_3\}, \{v_1, v_5\}, \{v_2, v_4\}, \{v_2, v_5\}, \{v_3, v_5\}, \{v_4, v_5\}\}\text{.}\)
Before we start studying graphs, we need to agree upon what a graph is. While we almost always think of graphs as pictures (dots connected by lines) this is fairly ambiguous. Do the lines need to be straight? Does it matter how long the lines are or how large the dots are? Can there be two lines connecting the same pair of dots? Can one line connect three dots?
The way we avoid ambiguities in mathematics is to provide concrete and rigorous definitions. Crafting good definitions is not easy, but it is incredibly important. The definition is the agreed upon starting point from which all truths in mathematics proceed. Is there a graph with no edges? We have to look at the definition to see if this is possible.
We want our definition to be precise and unambiguous, but it also must agree with our intuition for the objects we are studying. It needs to be useful: we could define a graph to be a six legged mammal, but that would not let us solve any problems about bridges. Instead, here is the (now) standard definition of a graph.
Graph Definition.
A graph is an ordered pair \(G = (V, E)\) consisting of a nonempty set \(V\) (called the vertices) and a set \(E\) (called the edges) of twoelement subsets of \(V\text{.}\)
Strange. Nowhere in the definition is there talk of dots or lines. From the definition, a graph could be
Here we have a graph with four vertices (the letters \(a, b, c, d\)) and five edges (the pairs \(\{a,b\}, \{a,c\}, \{b,c\}, \{b,d\}, \{c,d\})\)).
Looking at sets and sets of 2element sets is difficult to process. That is why we often draw a representation of these sets. We put a dot down for each vertex, and connect two dots with a line precisely when those two vertices are one of the 2element subsets in our set of edges. Thus one way to draw the graph described above is this:
However we could also have drawn the graph differently. For example either of these:
We should be careful about what it means for two graphs to be “the same.” Actually, given our definition, this is easy: Are the vertex sets equal? Are the edge sets equal? We know what it means for sets to be equal, and graphs are nothing but a pair of two special sorts of sets.
Example 4.1.1.
Are the graphs below equal?
No. Here the vertex sets of each graph are equal, which is a good start. Also, both graphs have two edges. In the first graph, we have edges \(\{a,b\}\) and \(\{b,c\}\text{,}\) while in the second graph we have edges \(\{a,c\}\) and \(\{c,b\}\text{.}\) Now we do have \(\{b,c\} = \{c,b\}\text{,}\) so that is not the problem. The issue is that \(\{a,b\} \ne \{a,c\}\text{.}\) Since the edge sets of the two graphs are not equal (as sets), the graphs are not equal (as graphs).
Even if two graphs are not equal, they might be basically the same. The graphs in the previous example could be drawn like this:
Graphs that are basically the same (but perhaps not equal) are called isomorphic. We will give a precise definition of this term after a quick example:
Example 4.1.2.
Consider the graphs:
Are these graphs the same?
The two graphs are NOT equal. It is enough to notice that \(V_1 \ne V_2\) since \(a \in V_1\) but \(a \notin V_2\text{.}\) However, both of these graphs consist of three vertices with edges connecting every pair of vertices. We can draw them as follows:
Clearly we want to say these graphs are basically the same, so while they are not equal, they will be isomorphic. We can rename the vertices of one graph and get the second graph as the result.
Intuitively, graphs are isomorphic if they are basically the same, or better yet, if they are the same except for the names of the vertices. To make the concept of renaming vertices precise, we give the following definitions:
Isomorphic Graphs.
An isomorphism between two graphs \(G_1\) and \(G_2\) is a bijection \(f:V_1 \to V_2\) between the vertices of the graphs such that \(\{a,b\}\) is an edge in \(G_1\) if and only if \(\{f(a), f(b)\}\) is an edge in \(G_2\text{.}\)
Two graphs are isomorphic if there is an isomorphism between them. In this case we write \(G_1 \isom G_2\text{.}\)
An isomorphism is simply a function which renames the vertices. It must be a bijection so every vertex gets a new name. These newly named vertices must be connected by edges precisely when they were connected by edges with their old names.
Example 4.1.3.
Decide whether the graphs \(G_1 = (V_1, E_1)\) and \(G_2 = (V_2, E_2)\) are equal or isomorphic.
\(V_1 = \{a,b,c,d\}\text{,}\) \(E_1 = \{\{a,b\}, \{a,c\}, \{a,d\}, \{c,d\}\}\)
\(V_2 = \{a,b,c,d\}\text{,}\) \(E_2 = \{\{a,b\}, \{a,c\}, \{b,c\}, \{c,d\}\}\)
The graphs are NOT equal, since \(\{a,d\} \in E_1\) but \(\{a,d\} \notin E_2\text{.}\) However, since both graphs contain the same number of vertices and same number of edges, they might be isomorphic (this is not enough in most cases, but it is a good start).
We can try to build an isomorphism. How about we say \(f(a) = b\text{,}\) \(f(b) = c\text{,}\) \(f(c) = d\) and \(f(d) = a\text{.}\) This is definitely a bijection, but to make sure that the function is an isomorphism, we must make sure it respects the edge relation. In \(G_1\text{,}\) vertices \(a\) and \(b\) are connected by an edge. In \(G_2\text{,}\) \(f(a) = b\) and \(f(b) = c\) are connected by an edge. So far, so good, but we must check the other three edges. The edge \(\{a,c\}\) in \(G_1\) corresponds to \(\{f(a), f(c)\} = \{b,d\}\text{,}\) but here we have a problem. There is no edge between \(b\) and \(d\) in \(G_2\text{.}\) Thus \(f\) is NOT an isomorphism.
Not all hope is lost, however. Just because \(f\) is not an isomorphism does not mean that there is no isomorphism at all. We can try again. At this point it might be helpful to draw the graphs to see how they should match up.
Alternatively, notice that in \(G_1\text{,}\) the vertex \(a\) is adjacent to every other vertex. In \(G_2\text{,}\) there is also a vertex with this property: \(c\text{.}\) So build the bijection \(g:V_1 \to V_2\) by defining \(g(a) = c\) to start with. Next, where should we send \(b\text{?}\) In \(G_1\text{,}\) the vertex \(b\) is only adjacent to vertex \(a\text{.}\) There is exactly one vertex like this in \(G_2\text{,}\) namely \(d\text{.}\) So let \(g(b) = d\text{.}\) As for the last two, in this example, we have a free choice: let \(g(c) = b\) and \(g(d) = a\) (switching these would be fine as well).
We should check that this really is an isomorphism. It is definitely a bijection. We must make sure that the edges are respected. The four edges in \(G_1\) are
Under the proposed isomorphism these become
which are precisely the edges in \(G_2\text{.}\) Thus \(g\) is an isomorphism, so \(G_1 \cong G_2\)
Sometimes we will talk about a graph with a special name (like \(K_n\) or the Peterson graph) or perhaps draw a graph without any labels. In this case we are really referring to all graphs isomorphic to any copy of that particular graph. A collection of isomorphic graphs is often called an isomorphism class. ^{ 1 }
There are other relationships between graphs that we care about, other than equality and being isomorphic. For example, compare the following pair of graphs:
These are definitely not isomorphic, but notice that the graph on the right looks like it might be part of the graph on the left, especially if we draw it like this:
We would like to say that the smaller graph is a subgraph of the larger.
We should give a careful definition of this. In fact, there are two reasonable notions for what a subgraph should mean.
Subgraphs.
We say that \(G' = (V', E')\) is a subgraph of \(G = (V, E)\text{,}\) and write \(G' \subseteq G\text{,}\) provided \(V' \subseteq V\) and \(E' \subseteq E\text{.}\)
We say that \(G' = (V', E')\) is an induced subgraph of \(G = (V, E)\) provided \(V' \subseteq V\) and every edge in \(E\) whose vertices are still in \(V'\) is also an edge in \(E'\text{.}\)
Notice that every induced subgraph is also an ordinary subgraph, but not conversely. Think of a subgraph as the result of deleting some vertices and edges from the larger graph. For the subgraph to be an induced subgraph, we can still delete vertices, but now we only delete those edges that included the deleted vertices.
Example 4.1.4.
Consider the graphs:
Here both \(G_2\) and \(G_3\) are subgraphs of \(G_1\text{.}\) But only \(G_2\) is an induced subgraph. Every edge in \(G_1\) that connects vertices in \(G_2\) is also an edge in \(G_2\text{.}\) In \(G_3\text{,}\) the edge \(\{a,b\}\) is in \(E_1\) but not \(E_3\text{,}\) even though vertices \(a\) and \(b\) are in \(V_3\text{.}\)
The graph \(G_4\) is NOT a subgraph of \(G_1\text{,}\) even though it looks like all we did is remove vertex \(e\text{.}\) The reason is that in \(E_4\) we have the edge \(\{c,f\}\) but this is not an element of \(E_1\text{,}\) so we don't have the required \(E_4 \subseteq E_1\text{.}\)
Back to some basic graph theory definitions. Notice that all the graphs we have drawn above have the property that no pair of vertices is connected more than once, and no vertex is connected to itself. Graphs like these are sometimes called simple, although we will just call them graphs. This is because our definition for a graph says that the edges form a set of 2element subsets of the vertices. Remember that it doesn't make sense to say a set contains an element more than once. So no pair of vertices can be connected by an edge more than once. Also, since each edge must be a set containing two vertices, we cannot have a single vertex connected to itself by an edge.
That said, there are times we want to consider double (or more) edges and single edge loops. For example, the “graph” we drew for the Bridges of Königsberg problem had double edges because there really are two bridges connecting a particular island to the near shore. We will call these objects multigraphs. This is a good name: a multiset is a set in which we are allowed to include a single element multiple times.
The graphs above are also connected: you can get from any vertex to any other vertex by following some path of edges. A graph that is not connected can be thought of as two separate graphs drawn close together. For example, the following graph is NOT connected because there is no path from \(a\) to \(b\text{:}\)
Vertices in a graph do not always have edges between them. If we add all possible edges, then the resulting graph is called complete. That is, a graph is complete if every pair of vertices is connected by an edge. Since a graph is determined completely by which vertices are adjacent to which other vertices, there is only one complete graph with a given number of vertices. We give these a special name: \(K_n\) is the complete graph on \(n\) vertices.
Each vertex in \(K_n\) is adjacent to \(n1\) other vertices. We call the number of edges emanating from a given vertex the degree of that vertex. So every vertex in \(K_n\) has degree \(n1\text{.}\) How many edges does \(K_n\) have? One might think the answer should be \(n(n1)\text{,}\) since we count \(n1\) edges \(n\) times (once for each vertex). However, each edge is incident to 2 vertices, so we counted every edge exactly twice. Thus there are \(n(n1)/2\) edges in \(K_n\text{.}\) Alternatively, we can say there are \({n \choose 2}\) edges, since to draw an edge we must choose 2 of the \(n\) vertices.
In general, if we know the degrees of all the vertices in a graph, we can find the number of edges. The sum of the degrees of all vertices will always be twice the number of edges, since each edge adds to the degree of two vertices. Notice this means that the sum of the degrees of all vertices in any graph must be even!
This is our first example of a general result about all graphs. It seems innocent enough, but we will use it to prove all sorts of other statements. So let's give it a name and state it formally.
Lemma 4.1.5. Handshake Lemma.
In any graph, the sum of the degrees of vertices in the graph is always twice the number of edges.
The handshake lemma^{ 2 } is sometimes called the degree sum formula, and can be written symbolically as
Here we are using the notation \(d(v)\) for the degree of the vertex \(v\text{.}\)
One use for the lemma is to actually find the number of edges in a graph. To do this, you must be given the degree sequence for the graph (or be able to find it from other information). This is a list of every degree of every vertex in the graph, generally written in nonincreasing order.
Example 4.1.6.
How many vertices and edges must a graph have if its degree sequence is
The number of vertices is easy to find: it is the number of degrees in the sequence: 7. To find the number of edges, we compute the degree sum:
so the number of edges is half this: 10.
The handshake lemma also tells us what is not possible.
Example 4.1.7.
At a recent math seminar, 9 mathematicians greeted each other by shaking hands. Is it possible that each mathematician shook hands with exactly 7 people at the seminar?
It seems like this should be possible. Each mathematician chooses one person to not shake hands with. But this cannot happen. We are asking whether a graph with 9 vertices can have each vertex have degree 7. If such a graph existed, the sum of the degrees of the vertices would be \(9\cdot 7 = 63\text{.}\) This would be twice the number of edges (handshakes) resulting in a graph with \(31.5\) edges. That is impossible. Thus at least one (in fact an odd number) of the mathematicians must have shaken hands with an even number of people at the seminar.
We can generalize the previous example to get the following proposition.^{ 3 }
Proposition 4.1.8.
In any graph, the number of vertices with odd degree must be even.
Proof.
Suppose there were a graph with an odd number of vertices with odd degree. Then the sum of the degrees in the graph would be odd, which is impossible, by the handshake lemma.
We will consider further applications of the handshake lemma in the exercises.
One final definition: we say a graph is bipartite if the vertices can be divided into two sets, \(A\) and \(B\text{,}\) with no two vertices in \(A\) adjacent and no two vertices in \(B\) adjacent. The vertices in \(A\) can be adjacent to some or all of the vertices in \(B\text{.}\) If each vertex in \(A\) is adjacent to all the vertices in \(B\text{,}\) then the graph is a complete bipartite graph, and gets a special name: \(K_{m,n}\text{,}\) where \(A = m\) and \(B = n\text{.}\) The graph in the houses and utilities puzzle is \(K_{3,3}\text{.}\)
Named Graphs.
Some graphs are used more than others, and get special names.
 \(K_n\)
The complete graph on \(n\) vertices.
 \(K_{m,n}\)
The complete bipartite graph with sets of \(m\) and \(n\) vertices.
 \(C_n\)
The cycle on \(n\) vertices, just one big loop.
 \(P_n\)
The path on \(n+1\) vertices (so \(n\) edges), just one long path.
Graph Theory Definitions.
There are a lot of definitions to keep track of in graph theory. Here is a glossary of the terms we have already used and will soon encounter.
 Graph
A collection of vertices, some of which are connected by edges. More precisely, a pair of sets \(V\) and \(E\) where \(V\) is a set of vertices and \(E\) is a set of 2element subsets of \(V\text{.}\)
 Adjacent
Two vertices are adjacent if they are connected by an edge. Two edges are adjacent if they share a vertex.
 Bipartite graph
A graph for which it is possible to divide the vertices into two disjoint sets such that there are no edges between any two vertices in the same set.
 Complete bipartite graph
A bipartite graph for which every vertex in the first set is adjacent to every vertex in the second set.
 Complete graph
A graph in which every pair of vertices is adjacent.
 Connected
A graph is connected if there is a path from any vertex to any other vertex.
 Chromatic number
The minimum number of colors required in a proper vertex coloring of the graph.
 Cycle
A path (see below) that starts and stops at the same vertex, but contains no other repeated vertices.
 Degree of a vertex
The number of edges incident to a vertex.
 Euler path
A walk which uses each edge exactly once.
 Euler circuit
An Euler path which starts and stops at the same vertex.
 Multigraph
A multigraph is just like a graph but can contain multiple edges between two vertices as well as single edge loops (that is an edge from a vertex to itself).
 Path
A path is a walk that doesn't repeat any vertices (or edges) except perhaps the first and last. If a path starts and ends at the same vertex, it is called a cycle.
 Planar
A graph which can be drawn (in the plane) without any edges crossing.
 Subgraph
We say that \(H\) is a subgraph of \(G\) if every vertex and edge of \(H\) is also a vertex or edge of \(G\text{.}\) We say \(H\) is an induced subgraph of \(G\) if every vertex of \(H\) is a vertex of \(G\) and each pair of vertices in \(H\) are adjacent in \(H\) if and only if they are adjacent in \(G\text{.}\)
 Tree
A connected graph with no cycles. (If we remove the requirement that the graph is connected, the graph is called a forest.) The vertices in a tree with degree 1 are called leaves.
 Vertex coloring
An assignment of colors to each of the vertices of a graph. A vertex coloring is proper if adjacent vertices are always colored differently.
 Walk
A sequence of vertices such that consecutive vertices (in the sequence) are adjacent (in the graph). A walk in which no edge is repeated is called a trail, and a trail in which no vertex is repeated (except possibly the first and last) is called a path.
Exercises Exercises
1.
If 10 people each shake hands with each other, how many handshakes took place? What does this question have to do with graph theory?
2.
Among a group of 5 people, is it possible for everyone to be friends with exactly 2 of the people in the group? What about 3 of the people in the group?
3.
Is it possible for two different (nonisomorphic) graphs to have the same number of vertices and the same number of edges? What if the degrees of the vertices in the two graphs are the same (so both graphs have vertices with degrees 1, 2, 2, 3, and 4, for example)? Draw two such graphs or explain why not.
4.
Are the two graphs below equal? Are they isomorphic? If they are isomorphic, give the isomorphism. If not, explain.
Graph 1: \(V = \{a,b,c,d,e\}\text{,}\) \(E = \{\{a,b\}, \{a,c\}, \{a,e\}, \{b,d\}, \{b,e\}, \{c,d\}\}\text{.}\)
Graph 2:
5.
Consider the following two graphs:
 \(G_1\)

\(V_1=\{a,b,c,d,e,f,g\}\)
\(E_1=\{\{a,b\},\{a,d\},\{b,c\},\{b,d\},\{b,e\},\{b,f\},\{c,g\},\{d,e\}\text{,}\)
\(\{e,f\},\{f,g\}\}\text{.}\)
 \(G_2\)

\(V_2=\{v_1,v_2,v_3,v_4,v_5,v_6,v_7\}\text{,}\)
\(E_2=\{\{v_1,v_4\},\{v_1,v_5\},\{v_1,v_7\},\{v_2,v_3\},\{v_2,v_6\}\text{,}\)
\(\{v_3,v_5\},\{v_3,v_7\},\{v_4,v_5\},\{v_5,v_6\},\{v_5,v_7\}\}\)

Let \(f:G_1 \rightarrow G_2\) be a function that takes the vertices of Graph 1 to vertices of Graph 2. The function is given by the following table:
\(x\) \(a\) \(b\) \(c\) \(d\) \(e\) \(f\) \(g\) \(f(x)\) \(v_4\) \(v_5\) \(v_1\) \(v_6\) \(v_2\) \(v_3\) \(v_7\) Does \(f\) define an isomorphism between Graph 1 and Graph 2?
Define a new function \(g\) (with \(g \ne f\)) that defines an isomorphism between Graph 1 and Graph 2.

Is the graph pictured below isomorphic to Graph 1 and Graph 2? Explain.
6.
What is the largest number of edges possible in a graph with 10 vertices? What is the largest number of edges possible in a bipartite graph with 10 vertices? What is the largest number of edges possible in a tree with 10 vertices?
7.
Which of the graphs below are bipartite? Justify your answers.
8.
For which \(n \ge 3\) is the graph \(C_n\) bipartite?
9.
For each of the following, try to give two different unlabeled graphs with the given properties, or explain why doing so is impossible.
Two different trees with the same number of vertices and the same number of edges. A tree is a connected graph with no cycles.
Two different graphs with 8 vertices all of degree 2.
Two different graphs with 5 vertices all of degree 4.
Two different graphs with 5 vertices all of degree 3.
10.
Decide whether the statements below about subgraphs are true or false. For those that are true, briefly explain why (1 or 2 sentences). For any that are false, give a counterexample.
Any subgraph of a complete graph is also complete.
Any induced subgraph of a complete graph is also complete.
Any subgraph of a bipartite graph is bipartite.
Any subgraph of a tree is a tree.
11.
Let \(k_1, k_2, \ldots, k_j\) be a list of positive integers that sum to \(n\) (i.e., \(\sum_{i=1}^j k_i = n\)). Use two graphs containing \(n\) vertices to explain why
12.
We often define graph theory concepts using set theory. For example, given a graph \(G = (V, E)\) and a vertex \(v \in V\text{,}\) we define
We define \(N[v] = N(v) \cup \{v\}\text{.}\) The goal of this problem is to figure out what all this means.
Let \(G\) be the graph with \(V = \{a,b,c,d,e,f\}\) and \(E = \{\{a,b\}, \{a,e\},\{b, c\}, \{b,e\}, \{c,d\}, \{c, f\}, \{d, f\}, \{e,f\}\}\text{.}\) Find \(N(a)\text{,}\) \(N[a]\text{,}\) \(N(c)\text{,}\) and \(N[c]\text{.}\)
What is the largest and smallest possible values for \(N(v)\) and \(N[v]\) for the graph in part (a)? Explain.
Give an example of a graph \(G = (V, E)\) (probably different than the one above) for which \(N[v] = V\) for some vertex \(v \in V\text{.}\) Is there a graph for which \(N[v] = V\) for all \(v \in V\text{?}\) Explain.
Give an example of a graph \(G = (V,E)\) for which \(N(v) = \emptyset\) for some \(v \in V\text{.}\) Is there an example of such a graph for which \(N[u] = V\) for some other \(u \in V\) as well? Explain.
Describe in words what \(N(v)\) and \(N[v]\) mean in general.
13.
A graph is a way of representing the relationships between elements in a set: an edge between the vertices \(x\) and \(y\) tells us that \(x\) is related to \(y\) (which we can write as \(x \sim y\)). Not all sorts of relationships can be represented by a graph though. For each relationship described below, either draw the graph or explain why the relationship cannot be represented by a graph.
The set \(V = \{1,2, \ldots, 9\}\) and the relationship \(x \sim y\) when \(xy\) is a nonzero multiple of 3.
The set \(V = \{1,2, \ldots, 9\}\) and the relationship \(x \sim y\) when \(y\) is a multiple of \(x\text{.}\)
The set \(V = \{1,2,\ldots, 9\}\) and the relationship \(x \sim y\) when \(0 \lt xy \lt 3\text{.}\)
14.
Consider graphs with \(n\) vertices. Remember, graphs do not need to be connected.
How many edges must the graph have to guarantee at least one vertex has degree two or more? Prove your answer.
How many edges must the graph have to guarantee all vertices have degree two or more? Prove your answer.
15.
Prove that any graph with at least two vertices must have two vertices of the same degree.
16.
Suppose \(G\) is a connected graph with \(n > 1\) vertices and \(n1\) edges. Prove that \(G\) has a vertex of degree 1.