Graph Theory notes
Graph Theory notes
Graph theory originated from the Konigsberg Bridge Problem where two islands linked to each
other and the banks of the Pregel River by seven bridges.
Land Area C
River
Pregel
Land Area B
The problem was, to begin at any of the four land areas, (Land area A, B, C, D as shown in Figure
1) walk across each bridge exactly once and return to the initial land area. This problem was
solved in 1736 by Euler. The Graph theory was first introduced by Euler. Mathematician L. Euler
solved the Konigsberg Bridge problem. His theorem is known as the first theorem in Graph
theory.
Graph theory has lot of applications in Making a timetable, Register allocation, Google maps,
Facebook/LinkedIn, WWW, GPS etc.
Graph
A graph 𝐺 consists of a finite nonempty set 𝑉(𝐺) of 𝑛 elements called vertices (or points) together
with a prescribed set 𝐸(𝐺) of 𝑚 unordered pairs of different elements of 𝑉(𝐺)(called as edges).
We use the notations 𝑉 and 𝐸 for 𝑉(𝐺) and 𝐸(𝐺), respectively. Each pair 𝑒 = {𝑢, 𝑣} of elements
in 𝐸(𝐺) is an edge (or line) of 𝐺, and 𝑒 is said to join 𝑢 and 𝑣. Here, vertex 𝑢 and edge 𝑒 are said
to be incident with each other, as 𝑣 and 𝑒 are. We say that 𝑢 and 𝑣 are adjacent vertices. A graph
with 𝑛 vertices and 𝑚 edges is referred to as an (𝑛, 𝑚) graph.
U e1 V e2 W
e e3
4 Vertex
X e5 Y
Edge
Figure 2: A Graph with 5 Vertices and 5 Edges
Each vertex is represented by a small dot, and each edge is represented by a line segment joining
the two vertices with which the edge is incident. In figure 2, u, v, w, x, y are vertices and
𝑒1 , 𝑒2 , 𝑒3 , 𝑒4 , 𝑒5 are edges. In figure 2, vertex u and vertex v are adjacent.
If two distinct edges 𝑒 and 𝑓 are incident with a common vertex, then they are said to be adjacent
edges. In figure 2, edges 𝑒1 and 𝑒3 adjacent but 𝑒3 and 𝑒4 are not adjacent edges.
An edge with identical ends is called a loop and two edges with the same end vertices are called
parallel (multiple) edges. In Figure 3, edge 𝑒3 is a loop and edges 𝑒2 and 𝑒5 are parallel. A graph
is simple if it contains neither loops nor parallel edges. In a multigraph, no loops are allowed but
parallel edges are permitted. If both loops and parallel edges are permitted, then we have a pseudo
graph.
V1
e1
V2
e6
e4
V5 e5
e2
e8
e7 Loop V3
e3
V4
Figure 3: Pseudo Graph
The number of edges incident with 𝑣 is the degree of a vertex 𝑣 in a graph G. The degree of 𝑣 is
represented by deg(𝑣).
v2 v4
v1
v5
Isolated v v6
3 Pendant
Figure 4: A (5,6) Graph
In Figure 4, 𝑣4 is a vertex with a maximum degree and 𝑣1 is a vertex with a minimum degree. Hence for
the above graph 𝛿(𝐺) = 0 and ∆(𝐺) = 4. Vertex 𝑣1 is isolated and vertex 𝑣5 is pendant for the
graph as shown in Figure 4.
A graph is finite when both its vertex set, and edge set are finite. The (1, 0) graph is trivial, i.e., a
graph with a single vertex and no edge is called trivial. A graph whose edge set is empty, is
termed a null graph or a totally disconnected graph.
For a graph 𝐺, the number of elements in 𝑉(𝐺) is called order of the graph 𝐺 and denoted by
|𝑉(𝐺)| and the number of elements in 𝐸(𝐺) is called the size of the graph G denoted by |𝐸(𝐺)|.
NOTE: While drawing a graph, it is immaterial whether the edges are drawn straight or curved,
long or short. Thus, a diagram of the graph depicts the incidence relation holding between its
vertices and edges.
Theorem 1: The sum of the degrees of the vertices of a graph 𝐺 is twice the number of edges.
Proof: Every edge of G is incident with two vertices. Hence every edge contributes 2 to the sum
of the degrees of the vertices. Hence the result follows.
Question: If possible, draw a graph with degree sequence (1,1,2,2,3). If not, justify your answer.
Theorem 2: In any graph 𝐺, the number of vertices of odd degrees is even.
Proof: We know ∑𝑣∈𝑉 deg(𝑣) = twice the number of edges. The sum of degrees of the vertices
of odd degree (𝑆𝑂 ) and even degree (𝑆𝐸 )equals the sum of the degrees of all the vertices of G
which is twice the number of edges (an even number).
Thus, the sum of the degrees of the vertices of odd degree (𝑆𝑂 ) must be an even number and hence
the number of such vertices must be even.
u
e a
f
y v
g
d b
c
w
x
Figure 5: A (5,7) Graph
Perfect Graph: A graph is perfect if no two vertices are of the same degree.
Theorem 3: No graph is perfect or in a (𝑛, 𝑚) graph 𝐺, there exists at least 2 vertices with same
degree.
We note that in a (𝑛, 𝑚) graph, 0 ≤ deg(𝑣) ≤ 𝑛 − 1. Suppose there is a vertex with degree 0 in
G, then there cannot exist a vertex with degree n-1 and vice versa. Hence n vertices will have n-1
choices. Hence the result follows.
Subgraph
A graph 𝐻 = (𝑉1 , 𝐸1 ) is called a subgraph of 𝐺 = (𝑉, 𝐸), if 𝑉1 ⊆ 𝑉 and 𝐸1 ⊆ 𝐸.
Figure 6: A Graph G
Figure 9 shows a graph G, induced subgraph 𝐻1 induced by the set 𝑉1 = {𝐴, 𝐺, 𝐽, 𝐷, 𝐶} and a
spanning subgraph 𝐻2 .
Figure 9: Graphs 𝐺, 𝐻1 , 𝐻2
The removal of a vertex 𝑣 from a graph G results in that subgraph 𝐺 − 𝑣 of G consisting of all
vertices of G except 𝑣 and all edges not incident with 𝑣 (Figure 10).
The removal of an edge e from G yields the spanning subgraph G − e containing all edges of G
except e (Figure 10)
Figure 10: Graph G, G-v, G-e
Similarly, removal of vertices and removal of edges can be defined. Figure 11 shows Graph G
along with 𝐺 − {𝑏, 𝑔, 𝑒} and 𝐺 − {𝑣7 , 𝑣4 }.
Types of Graphs
Regular Graph
A graph 𝐺 in which all the vertices have the same degree is called a regular graph of degree 𝑟.
Figure 12 represents a regular graph of degree 2.
𝑣1
𝑣6 𝑣2
𝑣5 𝑣3
𝑣4
Figure 12: A Regular Graph of Degree 2
Question: Construct a cubic graph (if possible) (i) on 5 vertices (ii) 6 vertices. If that is not possible
then give a reason.
Complete Graph
A graph in which any two distinct vertices are adjacent is called a complete graph. The complete
graph with 𝑛 vertices is denoted by 𝐾𝑛 . Figure 13 represents a Complete graph on 6 vertices.
𝑣1 𝑣2
𝑣6 𝑣3
𝑣5 𝑣4
Figure 13: A Complete Graph on 6 Vertices Denoted by 𝐾6
A labelled graph is a graph in which every vertex and every edge is labelled. We consider a graph
always as a labelled graph.
For the graph below the clique of G is 𝐾3 . (Induced subgraph with 𝑆 = {𝑣1 , 𝑣2 , 𝑣3 } forms a
complete subgraph)
Question 1: Draw a labelled graph G having (4, 3, 2, 2, 2, 1) as degree sequence.
Question 2: Draw graph G having (2, 2, 2, 2, 2, 2) as degree sequence. Is there more than one
graph on a given degree sequence?
Question 3: Draw graph G having (4, 4, 3, 3, 2) as degree sequence. How many edges can this
graph contain?
Weighted Graph
A weighted graph is a graph consisting of weight, or a number associated with each edge.
Directed Graph
A directed graph (or digraph) is a triplet containing a vertex set 𝑉(𝐺), an edge set 𝐸(𝐺) and
function assigning each edge, an ordered pair of vertices (Figure 15).
For the graph in Figure 15, there is a directed edge from vertex 𝑣2 to 𝑣4 . But to travel from 𝑣4 to
𝑣2 , we have to travel via 𝑣5 .
Application: Given a list of cities and the distances between each pair of them.
We need to find the shortest probable route to visit each city exactly once and return to the original
city. For the graph in Figure 16, to travel from B to E instead of a direct road (distance 10), if we
travel from C, we will reach E with minimum distance (5+3).
Complement of a graph
Let 𝐺 = (𝑉, 𝐸) be a Graph. The complement 𝐺̅ of 𝐺 is defined to be the graph which has 𝑉 as its set of
vertices and two vertices are adjacent in 𝐺̅ only when they are not adjacent in 𝐺
In graph G (Figure 19) there is an edge from 𝑣1 to 𝑣4 , but in 𝐺̅ , the edge between 𝑣1 to 𝑣4 is not there. G̅ is
disconnected graph with 2 components.
Question: Find the complement of the graph G.
Theorem 4: For any Graph G with six vertices, G or 𝐺̅ contains a triangle.
Proof: Let G be a graph with six vertices. Let v be any vertex in G. Since v is adjacent to other five
vertices either in G or in 𝐺̅ . We assume that v is adjacent with v1, v2, v3 in G. If any 2 of these
vertices say v1, v2 are adjacent then v1, v2, v forms a triangle in G. If no two of them are adjacent
Figure 20:
At any party of 6 people, there are 3 mutual friends or there are 3 people who do not know each
other. In other words, there is no induced subgraph which is either a 𝐾3 or a ̅̅̅
𝐾3 .
Question: In any group of 7 people make connections in such a way that there are no 3 people
who know each other and there are no 4 people who do not know each other. (Draw a graph with
7 vertices that contains no induced subgraph which is either 𝐾3 or 4 isolated vertices).
Isomorphism: Two graphs G and H are isomorphic (written 𝐺 ≅ 𝐻 or sometimes G =H) if there exists a
one-to-one correspondence between their vertices and between their edges such that structure is preserved.
Example:
Theorem 5: Let G be a self-complementary graph. Show that the number of vertices in G is of the
form 4n or 4n + 1.
𝑝(𝑝 − 1)
Proof: Let G be a (p, q) graph. Number of edges in 𝐾𝑝 = = 𝑝 𝐶2
2
Since G is self-complementary, number of edges in G = number of edges in G = q.
Number of edges in Kp = number of edges in G + number of edges in G.
𝑝(𝑝 − 1)
Number of edges in G = 2
− 𝑞
𝑝(𝑝 − 1)
𝑞 = − 𝑞,
2
4𝑞 = 𝑝(𝑝 − 1)
𝑝(𝑝−1)
Therefore, 𝑞 = 4
4 4
⇒ 𝑝 𝑜𝑟 𝑝 − 1
𝑝 = 4𝑛 𝑜𝑟 𝑝 − 1 = 4𝑛
𝑝 = 4𝑛 𝑜𝑟 𝑝 = 4𝑛 + 1
Walk, trail, path, cycle
In a simple graph, the walk is denoted by 𝑣0 , 𝑣1 ,· · · , 𝑣𝑛 . The number of edges in the walk is
called the length of this walk. A single vertex is taken as a walk of length 0.
A walk should begin and end with a vertex only. It cannot start or end at an edge.
A walk is called a trail if all its edges are distinct and is called a path if all its vertices are distinct.
Two vertices 𝑢 and 𝑣 of a graph 𝐺 are said to be connected if there exists a 𝑢 − 𝑣 path in 𝐺. A
graph 𝐺 is said to be connected if every pair of its vertices are connected. A graph that is not connected is
said to be disconnected.
A Path graph denoted by 𝑃𝑛 on n vertices is a graph with vertices {𝑣1 , 𝑣2 , . . , 𝑣𝑛 } and edges are
(𝑣𝑖 , 𝑣𝑖+1 ), 1 ≤ 𝑖 ≤ 𝑛 − 1.
𝑃𝑛 has n-1 edges.
Theorem 6: If a graph has exactly 2 vertices of odd degree, then there must be a path joining the
2 vertices.
Suppose the graph is connected, then there exists a path joining u and v. Suppose G is disconnected,
then there exist at least 2 components. Now if both the vertices u and v are in one of the
components, then as component is connected, there exists a path between u and v.
We note that u and v cannot be in 2 different components as in G there are exactly 2 vertices with
odd degrees. If u is in one component, then in that component we get only one vertex of odd degree
which is not possible.
Hence u and v be in one of the components and there exists a path between them.
Suppose that graph G is disconnected and has two components C1 and C2. Let u and v be any
two vertices, we have the following cases.
If u and v are in different components and are not adjacent in G. Then u and v are adjacent in G.
We have, uv path, hence G is connected.
If u and v belong to the same component but they are not adjacent in G. Hence, they are adjacent
in G. Hence, we have uv path.
Suppose that u and v are adjacent in G (Obviously, they belong to the same component). Then
we can find w in another component (which does not contain u and v). We have a uv path via w
in G. That is, u w and v w.
𝑝−1
Theorem 8: Show that if G has p vertices and minimum degree 𝛿(𝐺) ≥ 2
, then G is connected.
Proof: Suppose that graph G is disconnected. Let us assume that G has two (or more) components, say C1
and C2. Suppose that a component C1 has a vertex of minimum degree (p − 1)/2. Then, C1 must contain at
least [(p−1)/2+1] vertices. Similarly, suppose that a component C2 has a vertex of minimum degree (p−1)/2.
Then, C2 must contain at least [(p−1)/2+1] vertices. Now, the total number of vertices in G is equal to [(p
− 1)/2 + 1 + (p −1)/2+1] = p −1+2 =p +1 which is a contradiction to the fact that G has p vertices. Hence,
G is connected.
Distance
Let 𝐺 be a connected graph and let 𝑢, 𝑣 be two vertices in 𝐺.
The shortest path between 𝑢 and 𝑣 in 𝐺 is a (𝑢, 𝑣) − path with the minimum number of edges in it. The
distance between 𝑢 and 𝑣 in 𝐺 is denoted by 𝑑(𝑢, 𝑣) is the length of a shortest path between them.
For the graph in Figure 21, 𝑑(𝑣3 , 𝑣1 ) = 2, 𝑑(𝑣3 , 𝑣2 ) = 1, 𝑑(𝑣3 , 𝑣4 ) = 1, 𝑑(𝑣3 , 𝑣5 ) = 2, 𝑑(𝑣3 , 𝑣6 ) =
3, 𝑑(𝑣3 , 𝑣7 ) = 2, 𝑑(𝑣3 , 𝑣8 ) = 1.
The minimum and maximum of the eccentricities of vertices of 𝐺 are radius and diameter of the
graph 𝐺. A vertex 𝑣 in 𝐺 with minimum eccentricity is called a central vertex and set of all central
vertices in 𝐺 is called the centre of 𝐺.
For the graph in Figure 21, 𝑒(𝑣1 ) = 5, 𝑒(𝑣2 ) = 4, 𝑒(𝑣3 ) = 3, 𝑒(𝑣4 ) = 3, 𝑒(𝑣5 ) = 4, 𝑒(𝑣6 ) = 5,
𝑒(𝑣7 ) = 3, 𝑒(𝑣8 ) = 3.
A graph 𝐺 is said to be self-centered if every vertex of 𝐺 has the same eccentricity. In such a
graph, the radius is equal to the diameter.
The cycle graph 𝐶𝑛 is a self-centered graph and is the complete graph 𝐾𝑛 .
Diameter and radius of 𝐾𝑛 is 1
𝑛
Diameter and radius of 𝐶𝑛 is ⌊2 ⌋.
In graph, it is not essential that the relation 𝑑𝑖𝑎𝑚𝑒𝑡𝑒(𝐺) = 2. 𝑟𝑎𝑑𝑖𝑢𝑠(𝐺) gets satisfied.
Example: In complete graph 𝐾𝑛 , 𝑑𝑖𝑎𝑚𝑒𝑡𝑒𝑟(𝐺) = 𝑟𝑎𝑑𝑖𝑢𝑠(𝐺).
The Girth of a graph G is the length of the smallest cycle (if any) in G and is denoted by 𝑔(𝐺).
The circumference of graph G is the length of the longest cycle (if any) in G and is denoted by
𝑐(𝐺).
Since u and v have no common neighbors in G, both x and y are each adjacent to u or v in G. It follows that
𝑑𝑖𝑎𝑚(𝑥, 𝑦) ≤ 3 in G and hence 𝑑𝑖𝑎𝑚(𝐺) ≤ 3.
The Konigsberg Bridge problem has no solution. Figure 22 represents the Konigsberg Bridge.
Theorem 10: A non-empty connected graph is Eulerian if and only if all of its vertices of even
degree.
Proof: Suppose that G is connected and Eulerian. Since G has an Eulerian trail which passes
through each edge exactly once, goes through all vertices.
Hence, all of its vertices are of even degree.
Conversely, Let G be a connected graph such that every vertex of G is of even degree. Since, G is
connected, no vertex can be of degree zero. Thus, every vertex of degree ≥ 2, so G contains a
cycle. Let C be a cycle in a graph G. Remove edges of the cycle C from the graph G. The resulting
graph (say G1) may not be connected, but every vertex of the resulting graph is of even degree.
Suppose G consists only of this cycle C, then G is obviously Eulerian. Otherwise, there is another
cycle C1 with a vertex v in common with C. The walk beginning at v and consisting of the cycles
C and C1 in succession is a closed trial containing the edges of these two cycles. By continuing
this process, we can construct a closed trial containing all edges of G, hence G is Eulerian.
Questions:
1. The number of edges in a complete graph on 7 vertices is _____________.
2. State True or False: There exists a regular graph of degree 3 with 5 vertices.
Justify your answer.
3. Let G be a simple graph with 5 vertices and degrees of these 5 vertices be
2,3,3,4,4. Then number of edges in G = _____________.
4. State True or False: There exists a simple graph with degrees of its 5 vertices be
1,2,3,4,4.
5. The number of edges in a regular graph of degree 3 with 6 vertices is
_____________.
6. Draw a complete graph on 5 vertices.
7. The number of edges in the complement of a cycle graph on 7 vertices is ---.
8. Draw a cycle graph on 8 vertices.
9. The diameter of a cycle graph on 9 vertices is ---.
10. The number of edges in a cycle graph on 50 vertices is ---
11. Girth of 𝑃20 is
12. Circumference of 𝐶50 is
Hamiltonian Graph:
Around the World Game: A game invented by William Hamilton in 1859, uses a regular
solid dodecahedron, whose 20 vertices are labelled with the names of famous cities.
The player is challenged to travel "around the world" by finding a closed cycle
along the edges which passes through each vertex exactly once.
The object of the game is to find a spanning cycle in the graph of the
dodecahedron. The points of the graph are marked 1,2, • • •, 20 (rather than cities’
name) so that the existence of a spanning cycle is evident.
Cities are numbered as 1,2,..,20 (figure 23) to find a closed cycle that passes
through each city exactly once.
Hamiltonian Graph: A graph which contains a closed path that traverses each vertex of
the graph is a Hamiltonian graph. In a Hamiltonian graph it is not required that the
closed path should cover all the edges.
The edges which are not numbered (red coloured) in the figure 24 are not covered
in the closed path that traverses through all the vertices.
Figure 24 : Hamiltonian graph G
The complete graph and cycle graph are examples for Hamiltonian graph.
There is no closed path which traverses all the vertices of the graph shown in Figure 25.
Bipartite Graph:
A bipartite graph is one whose vertex set can be partitioned into 2 subsets X and Y so that each
edge has one end vertex in X and one end vertex in Y . Such a partition (X, Y ) is called a bipartition
of the graph G.
A complete bipartite graph is a bipartite graph with bipartition (X, Y ) in which each vertex of X is
joined to each vertex of Y ; if |X| = m and |Y | = n, such a graph is denoted by 𝐾𝑚,𝑛 .
The graphs (a) and (b) below are complete bipartite 𝐾3,3 and 𝐾2,4 respectively.
Theorem 11: A graph is bipartite if and only if all its cycles are even.
Proof: Let G be a connected bipartite graph. Then its vertex set V can be partitioned into two sets
V1 and V2 such that every edge of G joins a vertex of V1 with a vertex of V2. Thus, every cycle
𝑣1 , 𝑣2 , . . . , 𝑣𝑛 , 𝑣1 in G necessarily has its oddly subscripted vertices in V1(say), i.e, 𝑣1 , 𝑣3 , . . . , ∈
𝑉1 and other vertices 𝑣2 , 𝑣4 , . . . ∈ 𝑉2 . In a cycle 𝑣1 , 𝑣2 , . . . , 𝑣𝑛 , 𝑣1 : 𝑣𝑛 , 𝑣1 is an edge in G.
Since, 𝑣1 ∈ 𝑉1 we must have 𝑣𝑛 ∈ 𝑉2. This implies n is even. Hence, the length of the cycle is
even.
Conversely, suppose that G is a connected graph with no odd cycles. Let 𝑢 ∈ 𝑉(𝐺) be any vertex.
Let 𝑉1 = {𝑣 ∈ 𝑉(𝐺)|𝑑(𝑢, 𝑣) = 𝑒𝑣𝑒𝑛}, 𝑉2 = {𝑣 ∈ 𝑉(𝐺)|𝑑(𝑢, 𝑣) = 𝑜𝑑𝑑}.
Then, 𝑉 = 𝑉1 ∪ 𝑉2 , 𝑉1 ∩ 𝑉2 = 𝜙
We must prove that no two vertices in 𝑉1 and 𝑉2 are adjacent. Suppose that 𝑥, 𝑤 ∈ 𝑉1 be adjacent.
Then, 𝑑(𝑢, 𝑤) = 2𝑘 and 𝑑(𝑢, 𝑥) = 2𝑙. Thus, the path u − w − x − u forms a cycle of length 2k +
2l + 1, odd a contradiction. Therefore, x and w cannot be adjacent. No two vertices in 𝑉1 are
adjacent. Similarly, we can prove that no two vertices in 𝑉2 are adjacent. Hence, the graph is
bipartite.