0% found this document useful (0 votes)
23 views101 pages

Graph Theory - DM

Graph theory Discrete Mathematics First year engineering level

Uploaded by

yashpande4488
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views101 pages

Graph Theory - DM

Graph theory Discrete Mathematics First year engineering level

Uploaded by

yashpande4488
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 101

Graph Theory

By Prof Dr R.S. Deshpande


Graph Models
Computer Network

Computer Network
with Multiple Links
between Data Centers

Computer Network
with Diagnostic
Links
Communications
Network with One-
Way
Communications
Links

Computer Network with


Multiple One-Way Links
SOCIAL NETWORKS Collaboration Graphs

An Acquaintance-
ship Graph

Hollywood
graph

An Influence Graph

Friendship Graphs
COMMUNICATION and INFORMATION NETWORKS
The Web Graph

Citation Graphs

SOFTWARE DESIGN APPLICATIONS


Module Dependency Graphs

Precedence Graphs and Concurrent Processing

Call Graphs
BIOLOGICAL NETWORKS
TRANSPORTATION NETWORKS

Airline Routes Niche Overlap Graphs in Ecology


Protein Interaction Graphs
Road Networks
A Single-Elimination Tournament
Graph G =(V, E) consists set of vertices
denoted by V, or by V(G) and set of edges
E, or E(G).
Finite Graph :: Vertex set V is finite set
Infinite Graph :: Vertex set V is infinite

Cardinality of V, |V| is known as order of G.


Cardinality of E, |E| is known as size of G.
Directed Edge : Directed arrow between pair of
vertices u and v. Represented as (u, v) directed from
vertex u to v.

Undirected Edge : Pair of vertices connected by


straight line (Unordered pair of vertices).
Represented as {u, v}. Disregards any sense of
direction and treats both end vertices
interchangeably.
Loop : A loop is an edge whose starting and end
vertices are equal i.e., an edge joining a vertex to
it self is called a loop. Represented as {u, u} = {u}

Multiple Edges: Two or more edges joining the


same pair of vertices.
Simple (Undirected) Graph: consists of V, a
nonempty set of vertices, and E, a set of unordered
pairs of distinct elements of V called edges
(undirected)
Multigraph: G(V, E), consists of set of vertices V,
set of Edges E and a function f from E to
{{u, v}| u,v in V, u ≠ v}. The edges e1 and e2 are
called multiple or parallel edges if f (e1) = f (e2).
Pseudograph: G(V, E), consists of set of vertices
V, set of Edges E and a function F from E to
{{u, v}| u, v in V}. Parallel edges as well as Loops
allowed in such a graph.
Directed Graph : G(V, E), set of vertices V,
and set of Edges E, that are ordered pair of
elements of V (directed edges)
Directed Multigraph : G(V,E), consists of set of
vertices V, set of Edges E and a function f from E to
{{u, v}| u, v in V}. The edges e1 and e2 are multiple
edges if f(e1) = f(e2)
Undirected graphs

 u and v are adjacent if {u, v} is an edge, e is


called incident with u and v. u and v are called
end points of {u, v}

 Degree of Vertex (deg (v)): the number of


edges incident on a vertex. A loop contributes
twice to the degree.
Pendant Vertex : Degree of vertex is 0ne , i. e.,
deg (v) =1

Isolated Vertex : Degree of vertex Zero i. e.


deg (v) = 0
Directed graphs

For the edge (u, v),u is adjacent to v OR v is


adjacent from u, u –Initial vertex, v –Terminal vertex

In-degree (deg-(u)): number of edges for which u is


terminal vertex

Out-degree (deg+(u)): number of edges for which


u is initial vertex

Note : A loop contributes 1 to both in-degree and


out-degree
Handshaking Lemma
n

 d ( v )  2e
i 1
i

An undirected graph has even number of vertices


with odd degree
For directed graph,

d (vi ) 

d (vi ) | E |

i i
Degree Sequence
The degree sequence of a graph is the
sequence of the degrees of the vertices in
decreasing order of degrees, with repetitions as
needed.
e. g. For the following graph degree
sequence is 4,4,4,3,2,1,0
Simple graphs
Complete graph : Kn, is the simple graph that
contains exactly one edge between each pair of
distinct vertices.
Regular graph

A regular graph is a graph where each vertex is of


same degree

A regular graph with vertices of degree r is called


a r-regular graph

A regular directed graph must also satisfy the


stronger condition that the in degree and out
degree of each vertex are equal to each other
1-regular

0-regular
3-regular

2-regular
Cycle: Cn, n ≥ 3 consists of n vertices v1, v2, v3…
vn and edges {v1, v2}, {v2, v3}, {v3, v4} … {vn-1,
vn}, {vn, v1}
Wheels : Wn, obtained by adding additional
vertex to Cn and connecting all vertices to this
new vertex by new edges.
N-cubes: Q n ,
n
Vertices represented by 2 bit strings of length n.
Two vertices are adjacent if and only if the bit
strings that they represent differ by exactly one
bit positions.
Q1

Q2
Q3
Bipartite graphs

V can be partitioned into two disjoint


sets V1 and V2 such that every edge in
the graph connects a vertex in V1 and a
vertex V2 (so that no edge in G connects
either two vertices in V1 or two vertices in
V2)
Criterion to check graph is bipartite

A simple graph is bipartite if and only if


it is possible to assign one of two different
colours to each vertex of the graph so that
no two adjacent vertices are assigned the
same colour.
Complete Bipartite Km,n

The graph that has its vertex set partitioned


into two subsets of m and n vertices,
respectively. There is an edge between two
vertices if and only if one vertex is in the first
subset and the other vertex is in the second
subset.
The graph Km,n has mn edges.
Are the graphs H and G bipartite?
How many edges are there in a graph with 10 vertices
each of degree 6?

For which values of n the following graphs are regular?


1) K n 2) Cn 3) Wn

How many vertices does a regular graph of degree


four with 10 edges have?

Draw the following graphs.


1) K 7 2) K1,8 3) K 4,4 4) C7 5) W7 6) Q4
Which of the following graphs are bipartite?
1) K n 2) Cn 3) Wn 4) Q3 5) W7 6) Q4

Find the degree sequence following graphs.


1) K 4 2) K1,8 3) K 2,3 4) C4 5) Q3

How many edges does a graph have if its


degree sequence is 4, 3, 3, 2, 2? Draw such a
graph.
Determine whether the graph is bipartite
Representing Graphs

A graph without multiple edges is to list all the


edges of the graph.
Another 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 List
An Adjacency List for a Directed Graph.
Adjacency Matrices

Suppose that G =  V,E  is a simple graph where V  n.


Suppose that the vertices of G are listed arbitrarily as
v1 , v2 , . . . , vn . The adjacency matrix A  or AG  of G,
with respect to this listing of the vertices, is the n  n
zero–one matrix with 1 as its (i , j ) th entry when vi and v j
are adjacent, and 0 as its (i , j ) th entry when they are not adjacent

If a graph has adjacency matrix is A = [aij ], then


Simple Graph

adjacency matrix
Pseudograph

adjacency matrix
Incidence Matrices

Let G =  V, E  be an undirected graph. Suppose that


v1 , v2 , . . . , vn are the vertices and e1 , e2 , . . . , em are
the edges of G. Then the incidence matrix with respect
to this ordering of V and E is the n  m matrix M = [mij ], where
Simple graph

Incidence Matrices
Pseudograph

Incidence Matrices
Subgraph

A subgraph of a graph G = (V, E) is a graph H =(V’, E’)


where V’ is a subset of V and E’ is a subset of E

A spanning subgraph is a subgraph that contains all


the vertices of the original graph.
Vertex Deleted Subgraph: Graph obtained by deleting
a vertex.
Notation :: G-v

Edge Deleted Subgraph: Graph obtained by deleting


an edge.
Notation :: G-e
Union of Two graphs :
G = G1 U G2 wherein E = E1 U E2 and V = V1 U V2, G, G1
and G2 are simple graphs of G
Intersection of Two graphs :

The vertex set of the intersection graph


G is intersection V1  V2 of vertex set V1 of G1
and vertex set V2 of G 2 .The edge of G is
the intersection E1  E 2 of vertex set E1 of G1
and vertex set E 2 of G 2 .
Ring Sum of Two graphs :

The vertex set of the ring sum graph G


is union V1  V2 of vertex set V1 of G1
and vertex set V2 of G 2 .The edge of G is
 E1  E 2    E1  E 2  , i.e., edges of G are
those edges which are either in E1 or in E 2
but not in both E1 and E 2 .
Find the union of the given pair of simple graphs
Complementary graph:
The complementary graph G of a simple graph G
has the same vertices as that of G.
Two vertices are adjacent in G if and only if they are
not adjacent in G.
If the degree sequence of the simple graph G
is 4, 3, 3, 2, 2, what is the degree sequence of
complement of G?

The converse of a directed graph G =  V, E  ,


denoted by G conv
, is the directed graph  V, F ,
conv
where the set F of edges of G is obtained by
reversing the direction of each edge in E.
A walk is defined to be an alternating sequence
of vertices and edges of a graph,
V0 , e1 , V1 , e2 , ... , Vn-1 , en , Vn , where Vi 1 and Vi
are the end points of ei for i  1 , 2, ... , n.

A closed walk is a walk that begins and ends


at the same vertex.

A trail is a walk that has no repeated edges.


Path : Undirected graph

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, . . . , en of G for which there exists a
sequence x0 = u, x1, . . . , xn−1, xn = v of vertices such
that ei is an edge which join xi−1 to xi , for i = 1, . . . , n.
When the graph is simple, we denote this path
by its vertex sequence x0, x1, . . . , 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.
Path : Directed graph

G be 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.
Note that
 The terminal vertex of an edge in a path is the initial
vertex of the next edge in the path.
 When it is not necessary to distinguish between multiple
edges, we will denote a path e1, e2, . . . , en, where ei is
associated with (xi−1, xi) for i = 1, 2, . . . , n, by its vertex
sequence x0, x1, . . . , xn.
The notation identifies a path only as far as which the
vertices it passes through.
There may be more than one path that passes through this
sequence of vertices, which will happen if and only if there are
multiple edges between two successive vertices in the list.
The total number of edges in a path connecting
a pair of vertices (u , v )is known as length of the path.
The length of the shortest path between a pair of
vertices (u , v) is defined as distance between u and v,
denoted as d (u , v )
i.e., d (u , v)  minimum of lengths of all paths joining
u and v.
The maximum distance , i.e.,length of the longest
path between a vertex to all the other vertices is
defined as eccentricity of v, denoted as e(v ).
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.

Connected graph Disconnected graph


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.

A disconnected graph H and


its connected components are
H1, H2, and H3
Removal of a vertex and all edges incident on it from a
graph produces a subgraph with more connected components.
Such vertex is called cut vertices.
The removal of a cut vertex from a connected graph
produces a subgraph that is not connected.
An edge whose removal from a graph produces a graph
with more connected components than in the original graph is
called a cut edge or bridge or isthmus.
The cut vertices of G1 are
b, c, and e.
The cut edges are
{a, b} and {c, e}.

The cut vertices of G2 is


c,
There is no cut edge
VERTEX CONNECTIVITY

A subset W of the vertex set V of G = (V ,E) is a


vertex cut set, or separating set, if G − W is disconnected.
The vertex connectivity of a non complete graph G,
denoted by κ(G), is defined as the minimum number of
vertices in a vertex cut.

κ(G)=2
κ(G)=1
EDGE CONNECTIVITY

The edge connectivity of a graph G, denoted by λ(G),


is the minimum number of edges in G whose removal
disconnect G.

Graph has cut edge, i. e. bridge, hence


λ(G)=1

Graph has no cut edge, i. e. bridge,


λ(G)=3
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.

A directed graph is weakly connected if there is a


path between every two vertices in the underlying
undirected graph.

A directed graph is weakly connected if and only if


there is always a path between two vertices when the
directions of the edges are disregarded.
Isomorphism of Graphs

The simple graphs G1 = (V1,E1) and G2 = (V2,E2)


are isomorphic if there exists a one to one and onto
function f from V1 to V2 with the property that 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. Such a function f is
called an isomorphism. Two simple graphs that are not
isomorphic are called non isomorphic
If two graphs G1 and G 2 are isomorphic then
1. Number of vertices is invariant characteristic.
2. Number of edges is invariant characteristic.
3. Number of vertices of a particular degree is
invariant characteristic.
The existence of a simple circuit of length
k, where k is a positive integer greater
than 2, is an isomorphic invariant.

H has a simple circuit of length three

G has no simple circuit of length three


Three vertices of degree two, and both have a simple
circuit of length three, a simple circuit of length four,
and a simple circuit of length five.
Euler Graph

An Euler circuit in a graph G is a simple circuit


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

A graph G which contains a Euler circuit is known as


Euler graph.
A connected multigraph with at least
two vertices has an Euler circuit if and only
if each of its vertices has even degree.

A connected multigraph has an Euler


path but not an Euler circuit if and only if it
has exactly two vertices of odd degree.
This is not
a Euler graph
But has a Euler
path

Euler graph

This graph contains


Neither Euler path nor
Euler circuit
Hamilton Graph

A simple path in a graph G that passes through every


vertex exactly once is called a Hamilton path,
A simple circuit in a graph G that passes through every
vertex exactly once is called a Hamilton circuit.
The simple path x0, x1, . . . , xn−1, xn in the graph G = (V ,E) is a
Hamilton path if V = {x0, x1, . . . , xn−1, xn} and xi not equal to xj
for 0 ≤ i < j ≤ n,
The simple circuit x0, x1, . . . , xn−1, xn, x0 (with n > 0) is a
Hamilton circuit if x0, x1, . . . , xn−1, xn is a Hamilton path.
A graph which contains Hamilton circuit is known as
Hamilton graph.

G1 has a Hamilton circuit:


a, b, c, d, e, a. Hence
This is a Hamilton graph.

G2 has no Hamilton circuit:


But it has Hamilton path
Graph is not Hamilton graph
G3 has neither a Hamilton path nor a Hamilton path
Graph is not Hamilton graph
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.

O R E 'S T H E O R E M ::
If G is a s im p le g ra p h w ith n v e r tic e s w ith
n  3 s u c h t h a t d e g u  deg  v n fo r
e v e ry p a ir o f n o n a d ja c e n t v e rtic e s u a n d v
in G , th e n G h a s a H a m ilto n c ir c u it.
Planar Graph

A graph is called planar if it can be drawn in the


plane without crossing of edges.
A crossing of edges is the intersection of the
lines or arcs representing them at a point other
than their common endpoint(vertex).
Such a drawing is called a planar
representation of the graph.
A graph may be planar even if it is usually
drawn with crossings, because it may be possible
to draw it in a different way without crossings.

Complete graph Complete graph K4 on


K4 on four vertices four vertices drawn
without crossing
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.
Cube Q3 drawn
Cube Q3 without crossing
Utility Supply
A tree is a connected undirected graph
with no simple circuits.

An undirected graph is a tree if and only


if there is a unique simple path between any
two of its vertices.

A rooted tree is a tree in which one


vertex has been designated as the root and
every edge is directed away from the root.
Suppose that T is a rooted tree. If v is a vertex in T
other than the root, the parent of v is the unique vertex u
such that there is a directed edge from u to v.
When u is the parent of v, v is called a child of u.
Vertices with the same parent are called siblings.
The ancestors of a vertex other than the root are
the vertices in the path from the root to this vertex,
excluding the vertex itself and including the root (that is, its
parent, its parent’s parent, and soon, until the root is reached).
The descendants of a vertex v are those vertices
that have v as an ancestor.
A vertex of a rooted tree is called a leaf if it has no
children.
Vertices that have children are called internal vertices.
The root is an internal vertex unless it is the only
vertex in the graph, in which case it is a leaf.

A rooted tree is called an m-ary tree if every internal


vertex has no more than m children. The tree is called a full
m-ary tree if every internal vertex has exactly m children.
An m-ary tree with m = 2 is called a binary tree.
Let G be a simple graph. A spanning tree of G
is a subgraph of G that is a tree containing
every vertex of G.
Other possible spanning tress of
previous graph
A simple graph is connected if and only if it has a spanning
tree.

A minimum spanning tree in a connected weighted


graph is a spanning tree that has the
smallest possible sum of weights of its edges.
A Shortest-Path Algorithm : Dijkstra's algorithm
Let G be a graph with n vertices.
Vertex Set V= v1 , v2 , , vn  .
Step 1:Let P= v1 and A=V-P.
Set label of source l (v1 )  0 and l (vi )    vi  A.
Step 2:Let the source be denoted as a =v1
Find new labels of all vertices in A by
newlabel l (vi )  min old l (vi ), l ( a)  d (a, vi )
Select a vertex in A with minimum label.
Step 3:Let the new sourse be denoted as b
Find new labels of all remaining vertices in A by
newlabel l (vi )  min old l (vi ), l (b)  d (b, vi ) .
Select a vertex in A with minimum label.
Continue step 3 till the last vertex get covered.
GRAPH COLORINGS

Consider a graph G. A vertex coloring, or simply a


coloring of G is an assignment of colors to the vertices
of G such that adjacent vertices have different colors.
We say that G is n-colorable if there exists a coloring
of G which uses n colors.

The minimum number of colors needed to paint G is


called the chromatic number of G and is denoted by
 (G )
The Four-color theorem:
The chromatic number of a planar graph is no
greater than 4.

You might also like