You are on page 1of 55

Graph Theory - Types of Graphs (tutorialspoint.

com)

Definition: A graph G = (V, E) consists of V, a non-empty set of vertices (or nodes) and E, a set
of edges. Each edge has either one or two vertices associated with it, called its endpoints. An
edge is said to connect its endpoints.

Null Graph

A graph having no edges is called a Null Graph.

Trivial Graph

A graph with only one vertex and no edge is called a Trivial Graph.
Remark:(i) Every Trivial Graph is a Null Graph but not conversely.

(ii) The set of vertices V of a graph G may be infinite. A graph with an infinite vertex set or an
infinite number of edges is called an infinite graph, and in comparison, a graph with a finite
vertex set and a finite edge set is called a finite graph.
A graph with no loop and no parallel edges or a graph in which each edge connects two
different vertices and where no two edges connect the same pair of vertices is called a simple
graph.

Graphs that may have multiple edges connecting the same vertices are called multigraphs.

Sometimes a communications link connects a data center with itself, perhaps a feedback loop
for diagnostic purposes. Such a network is illustrated in Figure 3. To model this network we
need to include edges that connect a vertex to itself. Such edges are called loops, and
sometimes we may even have more than one loop at a vertex.

Graphs that may include loops, and possibly multiple edges connecting the same pair of
vertices or a vertex to itself, are sometimes called pseudographs.

Definition: A directed graph (or digraph) (V, E) consists of a non-empty set of vertices V and a
set of directed edges (or arcs) E. Each directed edge is associated with an ordered pair of
vertices. The directed edge associated with the ordered pair (u, v) is said to start at u and end
at v.
Que: The given Niche overlap graph is a ………………….?

(a) Pseudograph (b) Multigraph (c) Simple Graph

It is A Simple Graph.

Definition: Two vertices u and v in an undirected graph G are called adjacent (or neighbors) in
G if u and v are endpoints of an edge ‘e’ of G. Such an edge ‘e’ is called incident with the
vertices u and v and ‘e’ is said to connect u and v.

Definition:(i)The set of all neighbors of a vertex vof G=(V , E) , denoted by N ( v), is called the
neighborhood of v.

Definition:(ii)If A is a subset of V , we denote by N ( A) the set of all vertices in G that are


adjacent to at least one vertex in A . So, N ( A )=¿ v ∈ A N (v ). i.e. N ( A) is the union of
neighborhood of all of its vertices.
Que. In graph G , N ( b )=?

(a) {a , c , f } (b) {a , c , d , f } (c) {a , c , e , f } (d) {a , b , c , d , e , f }

Que. In graph H , N ( b )=?

(a) {a , b , c } (b) {a , b , c , d } (c) {a , c , d , e } (d) {a , b , c , d , e }

Que. In graph G , if A=¿{a,b,c} then N ( A )=?

(a) {a , c , f } (b) {a , c , d , f } (c) {a , c , e , f } (d) {a , b , c , d , e , f }

Definition: The degree of a vertex in an undirected graph is the number of edges incident with
it, except that a loop at a vertex contributes twice to the degree of that vertex. The degree of
the vertex v is denoted by deg(v).
A vertex of degree zero is called isolated. It follows that an isolated vertex is not adjacent to
any vertex. Vertex g in graph G in Example 1 is isolated. A vertex is pendant if and only if it has
degree one. Consequently, a pendant vertex is adjacent to exactly one other vertex.

EXAMPLE: How many edges are there in a graph with 10 vertices each of degree six?

THEOREM: An undirected graph has an even number of vertices of odd degree.


Some Special Simple Graphs

Que: How many vertices are there in a complete graph K n ?


(a) n (b) n+1 (c) n−1 (d) 2 n

Que: How many edges are there in a complete graph K n ?


n ( n−1 )
(a) 2
(b) n+1 (c) n−1 (d) 2 n

Que: How many vertices are there in a cycle graph C n ?

(a) n (b) n+1 (c) n−1 (d) 2 n

Que: How many edges are there in a cycle graph C n ?

(a) n (b) n+1 (c) n−1 (d) 2 n

Que: How many vertices are there in a wheel graph W n ?

(a) n (b) n+1 (c) n−1 (d) 2 n

Que: How many edges are there in a wheel graph W n ?

(a) n (b) n+1 (c) n−1 (d) 2 n


n−1
n∗2

Que: How many vertices are there in a n-dimensional hypercube graph Qn ?

(a) n (b) n+1 (c)2n (d) 2 n

Que: How many edges are there in a 5-dimensional hypercube graph Q5 ?

(a) 32 (b) 80 (c) 16 (d) 160

Que: How many edges are there in a n-dimensional hypercube graph Qn ?

(a) 2
n
(b) n∗2n−1 (c) 2n−1 (d) n∗2n

EXAMPLE: Are the graphs G and H displayed in Figure 8 bipartite?


EXAMPLE: For what values of ‘ n ’ the following graphs are bipartite?
(a) K n (b) C n (c) W n (d) Qn .

( i ) K n is bipartite only for n=2, for n ≥3 , K n is not bipar tite .

( ii ) Cn is bipartite only whe n' n' is even

( iii ) W n is bipartite for no value o f ' n ' as∈W n there is a vertex which is
adjacent ¿ every other vetex .

( iv ) Qn isbipartite for ever y ' n' .∧( V 1 ,V 2 ) is thebipartition for the


vertex set of Q n where V 1 is the set ofvertices whose ∑ of the bits is odd∧¿
V 2 isthe set of vertices whose ∑ of the bits is even .

Remark:A graph having a cycle of length '3' cannot be bipartite. For example in the given
graph there is a cycle of length 3 (b,c,f,b) and this graph is not bipartite.
Remark:A graph having an odd cycle i.e. a cycle of odd length cannot be bipartite. For example
in the given graph there is a cycle of length 3 (b,c,f,b) and this graph is not bipartite.
Definition:
The degree sequenceof a graph is the sequence of the degreesof the vertices of the graph in
non-increasing order.
Question:How many vertices does a regular graph of degree four with 10 edges have?
(a) 6 (b) 5 (c) 4 (d) None of these.
(a) 7 (b) 6 (c) 8 (d) None of these.

Que: How many vertices are there in a complete bipartite graph K m , n ?

(a) mn (b) n m (c) m+n (d) mn


Que: How many edges are there in a complete bipartite graph K m , n ?

(a) mn (b) n m (c) m+n (d) mn


Que: A graph is having 15 edges with 4 vertices of degree 4, 2 vertices of degree 3 and rest of
degree 2. How many degree two vertices are there?

(a) 8 (b) 4 (c)10 (d) None of these.


Representing Graphs
Adjacency List: One way to represent a graph with no multiple edges is to use adjacency
lists, which specify the vertices that are adjacent to each vertex of the graph.
Adjacency Matrices

EXAMPLE: Use an adjacency matrix to represent the graph


shown in Figure 3.
EXAMPLE: Draw a graph with the adjacency matrix with respect to the ordering of vertices a,
b, c, d.

Remark (i):An adjacency matrix of a graph is based on the ordering chosen for the vertices.
Hence, there may be as many as n! different adjacency matrices for a graph with n vertices,
because there are n! different orderings of n vertices. And conversely also, corresponding to an
adjacency matrix there are n! ways to draw the graph.
Remark (ii):The adjacency matrix of a simple graph is symmetric, that is, a ij=a ji because both of
these entries are 1 when vi and v j are adjacent, and both are 0 otherwise. Furthermore, because a
simple graph has no loops, each entry a ii , i=1 ,2 , 3 , … ,n is 0.

EXAMPLE: Use an adjacency matrix to represent the pseudograph shown in Figure 5.


Incidence Matrices

EXAMPLE: Represent the graph shown in Figure 6 with an incidence matrix.


EXAMPLE: Represent the pseudograph shown in Figure 7 using an incidence matrix.
Isomorphism of Graphs
Two isomorphic graphs are the same graph but drawn differently or have their vertices or edges
marked differently. If two graphs G and H are isomorphic then every property of the graphs is
INVARIANT i.e. any property of the graphs possessed (or not possessed) by G will be
possessed (or not possessed) by H also and vice versa e.g.
(i) Number of vertices.
(ii) Number of edges.
(iii) Degree sequence.
(iv) Corresponding subgraphs.
(v) Corresponding cycles
(vi) Bipartite or not bipartite
(vii) Regular or not regular and so on.

EXAMPLE: Show that the graphs G = (V, E) and H = (W, F), displayed in the given Figure, are
isomorphic.
In other words, when two simple graphs are isomorphic, there is a one-to-one correspondence
between vertices of the two graphs that preserves the adjacency relationship. Isomorphism of
simple graphs is an equivalence relation.
Criterion to establish the one-one correspondence (i.e. the function ‘ f ’) between two
possibly isomorphic graphs.
(i) The degree of the corresponding vertices should be same.
(ii) The degrees of the vertices adjacent to the corresponding vertices should also
be same.
(iii) Adjacency should be preserved i.e. a and b are adjacent in G1 if and only if f(a)
and f(b) are adjacent in G2, for all a and b in V1.

f(u1)=v6, f(u2)=v3 ,f(u3)=v4 ,f(u4)=v5, f(u5)=v1, f(u6)=v2 is it also possible?

EXAMPLE: Determine whether the graphs G and H displayed in Figure 12 are isomorphic.
EXAMPLE: Determine whether the graphs G and H displayed in Figure 9 are isomorphic.
EXAMPLE: Determine whether the graphs G and H displayed in Figure 10 are isomorphic.
Remark: Two simple graphs G1 and G2 are isomorphic iff their complements G1 and G2 are
isomorphic i.e. G1 ≅ G2iff G1 ≅ G 2.
This remark can be used to check whether the two simple graphs G1 and G2are isomorphic or
not if G1 and G2 have more number of edges as compared to their complements e.g.
Definition: The chromatic number of a graph is the least number of colors needed for coloring
vertices of the graph so that no two adjacent vertices have the same color. The chromatic
number of a graph G is denoted by (G). (Here 𝜒 is the Greek letter chi.)
Remark: While finding the chromatic number of a graph, preference should be given to the
vertex with the highest degree.
EXAMPLE: What are the chromatic numbers of the graphs G and H shown in Figure 3?

Poll Que: What is the chromatic number of the graph H?


(a) 3 (b) 4 (c) 5 (d) 6
EXAMPLE: What is the chromatic number of
(a) Kn (b) Cn (c) Wn (d) Qn (e)Km,n.
𝜒 (Kn) = n
𝜒 (Cn) = 2 if n is an even positive integer with n ≥ 4 and 𝜒 (Cn) = 3 if n is an odd positive integer
with n ≥ 3.
𝜒 (Wn) = 3 if n is an even positive integer with n ≥ 4 and 𝜒 (Wn) = 4 if n is an odd positive
integer with n ≥ 3.
𝜒 (Qn) = 2 as Qn is bipartite for every ‘n’.
𝜒 (Km,n) = 2 as Km,n is bipartite for every ‘m,n’.

THEOREM: THE FOUR COLOR THEOREM: The chromatic number of a planar graph is no
greater than four.

Planar Graphs
DEFINITION: A graph is called planar if it can be drawn in the plane without any edges crossing
(where a crossing of edges is the intersection of the lines or arcs representing them at a point
other than their common endpoint). Such a drawing is called a planar representation of the
graph.
The graphs K4, Q3 are planar but K3,3 is not planar.
EXAMPLE: For what values of ‘n’ (‘m,n’) the following graphs are planar?
(a) Kn (b) Cn (c) Wn (d) Qn (e) Km,n.
1. A complete graph Kn is a planar if and only if n<5.
2. The complete bipartite graph Km,n is not planar if m>2 and n>2.
THEOREM: THE FOUR COLOR THEOREM: The chromatic number of a planar graph is no
greater than four.

Definition: An undirected graph is called connected if there is a path between every pair of
distinct vertices of the graph. An undirected graph that is not connected is called
disconnected.

THEOREM: EULER’S FORMULA: Let G be a connected planar simple graph with ‘e’ edges and ‘v’
vertices. Let ‘r’ be the number of regions in a planar representation of G. Then r = e − v + 2.
Remark: This EULER’S FORMULA holds only if the connected planar simple graph is in its planar
representation.
Que: A simple connected planar graph is having 15 edges with 4 vertices of degree 4, 2 vertices
of degree 3 and rest of degree 2. Into how many regions does the planar representation of this
planar graph split the plane?
(a) 6 (b) 5 (c) 8 (d) None of these.
Ans. is ‘7’.

EXAMPLE 4 Suppose that a connected planar simple graph has 20 vertices, each of degree 3.
Into how many regions does a representation of this planar graph split the plane?
COROLLARY 1: If G is a connected planar simple graph with ‘e’ edges and ‘v’ vertices, where v ≥
3, then e ≤ 3v – 6.
EXAMPLE: Show that K5 is non-planar using Corollary 1.
COROLLARY 2: If G is a connected planar simple graph, then G has a vertex of degree not
exceeding five.
Que: A simple connected graph is having 20 edges with 4 vertices of degree 5, 2 vertices of
degree 6 and rest of degree 4. The graph is………..?
(a) Planar (b) Not Planar (c) May be or may not be
Que: A simple connected graph is having 15 edges with 4 vertices of degree 4, 2 vertices of
degree 3 and rest of degree 2. The graph is………..?
(a) Planar (b) Not Planar (c) May be or may not be
COROLLARY 3: If a connected planar simple graph has ‘e’ edges and ‘v’ vertices with v ≥ 3 and
no circuits of length three, then e ≤ 2v – 4.
EXAMPLE: Use Corollary 3 to show that K3,3 is non-planar.

Que: A simple connected graph is having 32 edges with each vertex of degree 4 and with no
circuit of length three. The graph is………..?
(a) Planar (b) Not Planar (c) May be or may not be

Degree of a region is defined to be the number of edges on the boundary of this region. When
an edge occurs twice on the boundary (so that it is traced out twice when the boundary is
traced out), it contributes two to the degree. We denote the degree of a region R by deg(R).
Que. Suppose that a connected planar simple graph with ‘e’ edges and ‘v’ vertices contains no
simple circuits of length ‘4’ or less.
Show that e ≤ (5∕3)v − (10∕3) if v ≥ 4.
Definition: Let ‘n’ be a nonnegative integer and G an undirected graph. A path of length ‘n’
from u to v in G is a sequence of ‘n’ edges e1,e2, e3, … , en of G for which there exists a
sequence x0 = u, x1, … , xn−1, xn = v of vertices such that ei has, for i = 1, … , n, the endpoints
xi−1 and xi . When the graph is simple, we denote this path by its vertex sequence x0, x1, x2,
…… , xn (because listing these vertices uniquely determines the path).

The path is a circuit if it begins and ends at the same vertex, that is, if u = v, and has length
greater than zero.
The path or circuit is said to pass through the vertices x1, x2, … , xn−1 or traverse the edges e1,
e2, … , en.

A path or circuit is simple if it does not contain the same edge more than once.
Definition: Let ‘n’ be a nonnegative integer and G a directed graph. A path of length ‘n’ from u
to v in G is a sequence of edges e1, e2, … , en of G such that e1 is associated with (x0, x1), e2 is
associated with (x1, x2), and so on, with en associated with (xn−1, xn), where x0 = u and xn = v.
When there are no multiple edges in the directed graph, this path is denoted by its vertex
sequence x0, x1, x2, … , xn.
A path of length greater than zero that begins and ends at the same vertex is called a circuit or
cycle.
A path or circuit is called simple if it does not contain the same edge more than once.

Definition: An undirected graph is called connected if there is a path between every pair of
distinct vertices of the graph. An undirected graph that is not connected is called
disconnected.
THEOREM: There is a simple path between every pair of distinct vertices of a connected
undirected graph.

CONNECTED COMPONENTS:
A connected component of a graph G is a connected subgraph of G that is not a proper subgraph
of another connected subgraph of G.
That is, a connected component of a graph G is a maximal connected subgraph of G.
A graph G that is not connected has two or more connected components that are disjoint and
have G as their union.
EXAMPLE: What are the connected components of the graph H shown in Figure 3?
Connectedness in Directed Graphs
Definition: A directed graph is strongly connected if there is a path from ‘a’ to ‘b’ and from ‘b’
to ‘a’ whenever ‘a’ and ‘b’ are vertices in the graph.
Definition: A directed graph is weakly connected if there is a path between every two vertices
in the underlying undirected graph.

Sometimes the removal from a graph of a vertex and all incident edges produces a subgraph
with more connected components. Such vertices are called cut vertices (or articulation points).
The removal of a cut vertex from a connected graph produces a subgraph that is not connected.
Analogously, an edge whose removal produces a graph with more connected components than
in the original graph is called a cut edge or bridge.
EXAMPLE: Find the cut vertices and cut edges in the graph G1 shown in Figure.

Poll Que.: Which of the following is cut vertex of the graph G1?
(a) f (b) g (c) h (d) e
Que. Which of the following is correct for the given graph?
(a) It has a cut vertex but no cut edge.
(b) It has no cut vertex but has a cut edge.
(c) It has a cut vertex as well as a cut edge.
(d) It has neither a cut vertex nor a cut edge.
Ans is (a) ‘c’ is cut vertex, no cut edge.
EXAMPLE: Determine the cut vertices and cut edges (if any) of the following:
(a) Kn (b) Cn (c) Wn (d) Qn (e) Km,n.
Que. Show that each of the following graphs has no cut vertices. (a) Cn where n ≥ 3 (b) Wn
where n ≥ 3 (c) Km,n where m ≥ 2 and n ≥ 2 (d) Qn where n ≥ 2.
Que. Show that each of the graphs in the previous question has no cut edges.
A cut set of a connected graph is a set of the least number of edges which when removed from
the graph makes the graph disconnected.
Or
A cut set of a graph is a set of edges such that the removal of these edges produces a subgraph
with more connected components than in the original graph, but no proper subset of this set of
edges has this property.

Its cut set is E1 = {e1, e3, e5, e8}.


Similarly there are other cut sets that can disconnect the graph −

 E3 = {e9} – Smallest cut set of the graph.


 E4 = {e3, e4, e5}
 E5 = {e1, e2, e7}

If G does not have a cut edge, we look for the smallest set of edges that can be removed to
disconnect it. A set of edges E′ is called an edge cut of G if the subgraph G − E′ is disconnected.
The edge connectivity of a graph G, denoted by 𝜆 (G), is the minimum number of edges in an
edge cut of G. This defines 𝜆 (G) for all connected graphs with more than one vertex because it
is always possible to disconnect such a graph by removing all edges incident to one of its
vertices.

In other words, edge connectivity of a graph G is the number of edges in the smallest cut set
of the graph.

G1 has a cut edge, so 𝜆 (G1) = 1. The graph G2 has no cut edges, as the reader should verify, but
the removal of the two edges {a, b} and {a, c} disconnects it. Hence, 𝜆 (G2) = 2. Similarly, 𝜆 (G3)
= 2, because G3 has no cut edges, but the removal of the two edges {b, c} and {f, g} disconnects
it. The reader should verify that the removal of no two edges disconnects G 4, but the removal
of the three edges {b, c}, {a, f}, and {f, g} disconnects it. Hence, 𝜆 (G4) = 3.

Remark: (i) Note that 𝜆 (G) = 0 if G is not connected. We also specify that

𝜆 (G) = 0 if G is a graph consisting of a single vertex. It follows that if G is a graph with ‘n’
vertices, then 0 ≤ 𝜆 (G) ≤ n − 1.

Remark: (ii) 𝜆 (G) = n − 1 where G is a graph with ‘n’ vertices if and only if G = K n which is
equivalent to the statement that 𝜆 (G) ≤ n − 2 when G is not a complete graph.
A subset V′ (containing minimum number of vertices that can be removed to disconnect a
graph) of the vertex set V of G = (V, E) is a vertex cut, or separating set, if G − V′ is
disconnected.

We define the vertex connectivity of a non-complete graph G, denoted by (G), as the


minimum number of vertices in a vertex cut.
(G1) = 1. Similarly, (G2) = 1, because ‘c’ is a cut vertex of G2. G3 has no cut vertices, but that {b,
g} is a vertex cut. Hence, (G3) = 2. G4 has a vertex cut of size two, {c, f}, but no cut vertices. It
follows that (G4) = 2.
Every connected graph, except a complete graph, has a vertex cut.

When G is a complete graph, it has no vertex cuts, because removing any subset of its vertices
and all incident edges still leaves a complete graph. Consequently, we cannot define (G) as the
minimum number of vertices in a vertex cut when G is complete. Instead, we set (K n) = n − 1,
the number of vertices needed to be removed to produce a graph with a single vertex.
Consequently, for every graph G, (G) is minimum number of vertices that can be removed
from G to either disconnect G or produce a graph with a single vertex.
Remark: (i) 0 ≤ (G) ≤ n − 1 if G has n vertices, (G) = 0 if and only if G is disconnected or G = K 1,
and (G) = n − 1 if and only if G is complete.
(ii) The larger (G) is, the more connected we consider G to be.
(iii) Disconnected graphs and K1 have (G) = 0, connected graphs with cut vertices and K2 have
(G) = 1, graphs without cut vertices that can be disconnected by removing two vertices and K 3
have (G) = 2, and so on.

We say that a graph is k-connected (or k-vertex-connected), if (G) ≥ k. A graph G is 1-


connected if it is connected and not a graph containing a single vertex; a graph is 2-connected,
or bi-connected, if it is non-separable and has at least three vertices. Note that if G is a k-
connected graph, then G is a j-connected graph for all j with 0 ≤ j ≤ k.

DEFINITION: An Euler circuit in a graph G is a simple circuit containing every edge of G.

DEFINITION: An Euler path in G is a simple path containing every edge of G.

NECESSARY AND SUFFICIENT CONDITIONS FOR EULER CIRCUITS AND PATHS


THEOREM: A connected multigraph with at least two vertices has an Euler circuit if and only if
each of its vertices has even degree.
THEOREM: A connected multigraph has an Euler path but not an Euler circuit if and only if it
has exactly two vertices of odd degree.
Que. Which of the following is correct for the given graph?
(a) It has an Euler Circuit but no Euler Path.
(b) It has no Euler Circuit but has an Euler Path.
(c) It has an Euler Circuit as well as an Euler Path.
(d) It has neither an Euler Circuit nor an Euler Path.

No Euler Circuit but Euler Path is b,c,i,b,a,i,d,g,i,h,a,d,e,f,d,c.

Que. For which values of 'n' (or 'm', 'n') do these graphs have an Euler circuit/Euler path?
(a) Kn (b) Cn (c) Wn (d) Qn (e) Km,n
DEFINITION: A simple circuit in a graph G that passes through every vertex exactly once is
called a Hamilton circuit.
DEFINITION: A simple path in a graph G that passes through every vertex exactly once is called
a Hamilton path.
Remark: A graph with a vertex of degree one cannot have a Hamilton circuit.

Que. For which values of 'n' (or 'm', 'n') do these graphs have a Hamilton circuit?
(a) Kn (b) Cn (c) Wn (d) Qn (e) Km,n
Remark: (i) Kn has a Hamilton circuit whenever n ≥ 3.
(ii) Cn has a Hamilton circuit for all n ≥ 3.
(iii) Wn has a Hamilton circuit for all n ≥ 3.
(iv) Qn has a Hamilton circuit for all n ≥ 2.
(v) Km,n has a Hamilton circuit for all m=n ≥ 2.

SUFFICIENT CONDITIONS FOR HAMILTON CIRCUITS


THEOREM: DIRAC’S THEOREM: If G is a simple graph with ‘n’ vertices with n ≥ 3 such that the
degree of every vertex in G is at least n/2, then G has a Hamilton circuit.
THEOREM: ORE’S THEOREM: If G is a simple graph with ‘n’ vertices with n ≥ 3 such that deg(u)
+ deg(v) ≥ n for every pair of nonadjacent vertices u and v in G, then G has a Hamilton circuit.
Shortest-Path Problems
A Shortest-Path Algorithm: Dijkstra’s algorithm

You might also like