0% found this document useful (0 votes)
197 views50 pages

DM Unit - 3 Graphs

Graphs are discrete structures made up of vertices and edges, used in various applications such as computer graphics, data organization, and networking. Different types of graphs include simple graphs, multigraphs, directed graphs, and weighted graphs, each with specific characteristics and uses. Key concepts in graph theory include vertex degree, adjacency, and special graph types like complete and bipartite graphs.

Uploaded by

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

DM Unit - 3 Graphs

Graphs are discrete structures made up of vertices and edges, used in various applications such as computer graphics, data organization, and networking. Different types of graphs include simple graphs, multigraphs, directed graphs, and weighted graphs, each with specific characteristics and uses. Key concepts in graph theory include vertex degree, adjacency, and special graph types like complete and bipartite graphs.

Uploaded by

jothika
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd

UNIT -3 GRAPHS

INTRODUCTION TO GRAPHS

Graphs are discrete structures consisting of vertices and edges that connect
these vertices.

1) Graph theory deals with the techniques for solving problems that can be stated
using graphs.
2) Although graph theory was once regarded as pure mathematics, the
introduction of computers has brought it into the realm of the applied. This is
because of such applications as:
 Computer graphics which uses adjacency matrices.
 Data organization which relies heavily on the class of graphs called trees.
 Finite state machines used in compiler construction which utilize directed
graphs.
 Circuit board design where it may be necessary to determine whether a
circuit can be implemented on a planar circuit board.
Computer networking (e.g. determining whether two computers are
connected by a communication link or finding the shortest path between two
computers in a network

Graphs
A graph is the same as a relation, only with different terminology. Graph
terminology (instead of relation terminology) tends to be used with applications to
real world situations.

Uses:

 To determine whether a circuit can be implemented on a planar


circuit board.
 To distinguish between two chemical components with the same
molecular formula but different structures.
 To determine whether two computers are connected by a
communication link using graph models of computer networks.
 To schedule examination.
 To assign channels to Television stations.
 Graph with weights assigned to their edges can be used to solve
problems such as finding the shortest path between two cities in a
transportation network.

3) There are several different types of graphs that differ with respect to the kind
and number of edges that connect pairs of vertices.

Simple graph - an undirected graph with no multiple edges or loops.

Multigraphs - an undirected graph that may contain multiple edges but no


loops.

Pseudograph - an undirected graph that may contain multiple edges and loops.

Directed graph - a set of vertices together with a set of directed edges that
connect these vertices. Multiple edges in the same direction between two
vertices are not allowed.

Directed multigraph - a graph with directed edges that may contain multiple
directed edges.

Directed graph Directed multigraph

Definition 1. A graph (or undirected graph) G = (V, E) consists of the following.

1. a set V of vertices (or nodes)


2. a set of edges E. Each edge joins a pair of vertices.

Definitions and Terminology


A graph G consists of two sets—V a set of vertices or nodes, and E a set of edges

each of which connects two elements of V.

e f
a b
c

GRAPH :A graph G = (V, E) consists of a set of objects V = {v 1, v2, …} called vertices, and another
set E = {e1, e2, …} whose elements are called edges. Each edge e k in E is identified with an
unordered pair (vi, vj) of vertices. The vertices v i, vj associated with edge ek are called the end
vertices of ek. The most common representation of graph is by means of a diagram, in which
the vertices are represented as points and each edge as a line segment joining its end vertices.
Often this diagram itself is referred to as a graph.
Example 1. Consider the graph with four vertices A, B, C and D and four edges e1,
e2, e3 and e4 where

i. e1 joins A and B e1

e2
A e4 Be
ii. e2 joins A and D 3

iii. e3 joins B and C D C

iv. e4 joins B and D

Thus V = {A, B, C, D} and E = {e1, e2, e3, e4}. We often represent an edge by the
set of the two vertices that it joins, so e1 = {A, B}, e2 = {A, D}, e3 = {B, C} and e4 =
{B, D} and E = {{A, B}, {A, D}, {B, C}, {B, D}}. A "picture" of this graph is
shown at the right.

Definition 2. A directed graph G = (V, E) consists of the following.

1. a set V of vertices (or nodes)

2. a set of edges E. Each edge goes from one vertex to another.

Example 2. Consider the graph with four vertices A, B, C and D and four edges e1,
e2, e3 and e4 where

i. e1 goes from A to B e1

e2
A e4 Be
3
ii. e2 goes from D to A
D C
iii. e3 goes from C to B

iv. e4 goes from B to D

Here V = {A, B, C, D} and E = {e1, e2, e3, e4}. For a directed graph we often
represent an edge from a vertex v to a vertex w by the ordered pair (v, w), so e1 =
(A, B), e2 = (D, A), e3 = (C, B) and e4 = (B, D) and E = {(A, B), (D, A)}, (C, B), (B,
D)}. A picture is shown at the right.
Definition 3. A weighted graph (either undirected or directed) is a graph where
each edge has a weight associated with it.

Example 3. Consider the weighted (undirected) graph with four vertices A, B, C


and D and four edges e1, e2, e3 and e4 where

i. e1 joins A and B and has weight 7 7


A B
9
ii. e2 joins A and D and has weight 9 6
10

iii. e3 joins B and C and has weight 6 D C


iv. e4 joins B and D and has weight 10

Under lying simple graph :

A graph obtained by deleting all the loops and parallel edges from a given
graph is called an under lying graph.

Mixed graph :

If some edges are directed and some edges are not directed is called as
mixed graph.

Adjacency and Incidency:

Two vertices u and v in an undirected graph G are said to be adjacent in G,


if u and v are endpoints of an edge G

If e is associated with {u,v} then the edge e is said to be incident with the
vertices u and [Link] edge e is also said to connect u and v.

Degree of a vertex:

Undirected graph:

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.

Figure: 1
Degree (v1) = 3 , Degree (v2) = 4, Degree (v3) = 3, Degree (v4) = 3,

Degree (v5) = 1

Figure: 2

Degree (a) = 2 , Degree (b) = 3, Degree (c) = 2, Degree (d) = 2,

Degree (e) = 2 and Degree (f) = 3

Note:

 A vertex of degree zero is called isolated vertex.


 A vertex of degree one is called pendant vertex.

Directed graph:

When (u,v) is the edge of a graph G with directed edges u is said to be


adjacent to v and v is said to be adjacent from u. The vertex u is called as initial
vertex and v is the terminal vertex.

The initial and terminal vertex of a loop are the same.

In a graph with directed edges,

The in degree of a vertex v is the number of edges with v as their


terminal vertex.

The out degree of v is the number of edges with v as their initial


vertex
A loop at a vertex contributes 1 to both the in degree and the out
degree of the vertex.

Degree of a directed graph :

In a directed graph terminology reflects the fact that each edge has a
direction. In a directed graph vertex v is adjacent to u, if there is an edge leaving v
and coming to u.

In-degree: In a directed graph the in-degree of a vertex denotes the number of


edges coming to this vertex. (deg- =in-degree)

Out-degree: The out-degree of a vertex is the number of edges leaving the vertex.

(deg+ = out-degree)

Example: Find the indgree and out degree of each vertex of the given directed
graph.

In-degree = deg- deg+ = out-degree

deg- (0) =2 deg+ (0) =4

deg- (1) =3 deg+ (1) =3

deg- (2) =2 deg+ (2) =2

deg- (3) =3 deg+ (3) =2

deg- (4) =2 deg+ (4) =1

Total = 12 Total = 12
In degree = out degree

Since, each edge has an initial vertex and terminal vertex the sum of the indegree
and the outdegree of all vertices are the same and it is equal to number o edges.

Theorem 1: Hand shaking Theorem:

Let G = ( V, E ) be an undirected graph e edges. Then

Proof: Each edge contributes two to the sum of the degree’s of the vertices
since an edge is incident with exactly two vertices. Therefore the sum of the degree
of the vertices is twice the number of edges.

Example: How many edges are there in a graph with 10 vertices each of
degree 6.

Solution: Sum of the degrees of vertices = 6x10 = 60

2e = 60 = > e = 30 No. of edges = 30.

Theorem 2: An undirected graph has an even number of vertices of odd


degree.

Proof: Let V1 , V2 be set of vertices of even degree and the set of vertices of
odd degree respectively in an undirected graph G =(V,E) then

---------(1)

Since the L.H.S is even .Therefore R.H.S is also even.

Since degree of v is even for . In the R.H .S of (1) is even.

But the sum of two terms in (1) is 2e . Therefore the second term on the
R.H.S of (1) should also be even. Since all the terms in this sum are odd, there
must be an even number of such terms. Thus there an even number of vertices of
odd degree.

Theorem: In an undirected simple graph with N vertices, there are


at most

edges.

Proof: By induction on the number of vertices.

V = 1, there are no edges

V = n, there are edges

We need to prove that if V =n+ 1 then a graph has edges

edges.

Therefore , In an undirected simple graph with N vertices, there


are at most

edges.

Theorem :3 Let G= (V,E) be a graph with directed edges, then


Proof : Each edge has an initial and terminal vertex, that is each
edge contributes one out degree to its initial vertex and one indegree
to its terminal vertex. Thus the sum of indegree and the sum of
outdegree of all the vertices in a digraph are same.

Problem: Determine whether the sequence of degree’s 54321 is a


graph?

Ans: Number of vertices = 5

Deg(v1)+ Deg(v2)+ Deg(v3)+ Deg(v4)+ Deg(v5)= 2e

5+4+3+2+1 = 2e

15 = 2e => e = 15/2 = 7.5

So,as we are getting edges in fraction. We can’t form a graph.

Theorem: If all the vertices of an undirected graph are each of


odd degree k. show that the number of edges of the graph is a multiple
of k.

Proof: we know from the previous theorem that number of


vertices of odd degree in an undirected graph is even.

Let us denote the even as 2n. Let the number f edges be ne. By
Handshaking theorem
K+ k+ k+ k+…..+K = => 2nk = =>

Finite graph:

A graph is finite iff both the vertex set and edge set are finite otherwise the
graph is infinite.

Some special simple graph

Complete graphs: Denoted by Kn.


 Contains exactly one edge between each pair of distinct vertices.
 Note: Kn is planar for n = 1, 2, 3 and 4 but non-planar for k  5.

K1 K2 K3 K4 K5

Cycles: The cycle Cn, n  3 consists of n vertices v1, v2, …, vn and edges {v1, v2}, {v2,
v3}, …, {vn-1, vn}.

C3 C4 C5

Wheels: The wheel Wn can be obtained by adding an additional vertex to the

cycle Cn
W3 W4 W5

n-cube
The n cubes denoted by Qn is the graph that has vertices representing the 2n
bit strings of length n. Two vertices are adjacent if and only if the bit strings that
they represent differ in exactly one bit position.

Regular graph :

A graph in which every vertex has the same degree is called a regular graph.

Here is an example of two regular graphs with four vertices that are of degree 3
and 2 respectively.
Petersen graph :

The following graph of degree 3 with 10 vertices is called the Petersen graph

Bipartite graph:

A graph G = (V, E) is bipartite iff its vertex set V can be partitioned


into two disjoint non empty sets V1 and V2 such that every edge in the
graph connects a vertex in V1 and a vertex in V2 and no edge in G
connects either two vertices in V1 or V2 .

 bipartite graph : An undirected graph G=(V,E) is bipartite if its


vertices can be partitioned into two disjoint stable sets V=S1+S2.

Example :
V = { a, b, c, d } Here V1 = { a, d } and V2 = { b, c }

Problem 1: How many vertices does a regular graph with degree 4 and
edges 10 have.?

Solution: Given degree = r = 4 and edges e = 10

Therefore 4 regular graph : e = nr/2 => 10 = 4n/2 => n = 5 vertices.

Problem 2: Are the graph G1 and G2 has shown below are biparted.

Solution: Graph 1 V = { a, b, c, d, e f, g } can be splitted into two


partitions V1 and V2 , where V1 = { a, b, d } and V2 = { c, e, f, g } edge = 9

Graph 1 is a bipartited graph.


The vertex set of graph Graph 2 V = { a, b, c, d, e, f } which cannot be
partitioned into two non empty disjoint set . Therefore graph 2 is not a
bipatited graph.

A complete bipartite graph :

The complete Bipartite graph Km,n is the graph that has its vertex
set partitioned into two subsets of m & n vertices respectively. There is
an edge between two vertices iff one vertex is in first subset and the
other vertex is in the second subset.

complete bipartite graph : A bipartite graph G=(S1,S2,E) is complete if


for every xÎS1 and yÎS2 we have xyÎE, i.e., every possible edge that
could exist does exist.

Notation: Ki,j A star is

K2,2 K3,3 K1,6


Note : There are m+n vertices and mn edges.

Some notations
Kn : the complete graph on n vertices or n-clique.
Cn : the chordless cycle on n vertices or n-cycle.
Pn : the chordless path graph on n vertices or n-path.
Km,n : the complete bipartite graph on m+n vertices
partitioned into an m-stable set and an n-stable set.
K1,n : the star graph on n+1 vertices.
mKn : m disjoint copies of Kn.

Example:

Graph colouring :

The assign of colours to the vertices of the graph G. one colour to


each vertex, so that the adjacent vertices are assigned with different
colours is called the proper colouring of G or simple vertex colouring.

Note:If G has n colouring then G is said to be n colourable.

Theorem:

A simple graph is bipartite, iff it is possible to assign one of two


different colours to each vertex of the graph. So, that no two adjacent
vertices are assigned with the same colour.

Proof: Let G { V , E } be a simple bipartited graph, then V = V1UV2,


where V1 and V2 are disjoint and every edge in E connects a vertex in V1
to a vertex in V2. If we assign one colour to each vertex in V1 and
another colour to the vertex V2. Then no two adjacent vertices will have
the same colour.

Converse : Suppose that it is possible to assign colour to the


vertices of the graph using just two clours so that no two adjacent
vertices are assigned with the same colour. Let V1 be the set of vertices
assigned one colour. V2 is the set of vertices assigned with another
colour. Then V1 and V2 are disjoint under V = V1UV2. Hence the graph G
is bipartited.

Union of Two Simple Graphs:

The union of two simple graph, G1 = { V1 , E1 } & G2 = { V2 , E2 } is the


simple graph with vertex set & edge set. It is denoted as

G = G1UG2 = { V1UV2, E1UE2} : Example

Intersection of two graphs :

G1 = { V1 , E1 } & G2 = { V2 , E2 } is the simple graph with vertex set &


edge set. It is denoted as

G = G1 G2 = { V1 V2, E1 E2} : Example


Complement of Graph :

Complement of Graph G = { V , E } is the graph where any two


vertices adjacent in G then the complement graph those two vertices
are not adjacent. It is denoted as G’

Note: Complement of Kn is null graph with n vertices.


Subgraph of a graph G = (V, E) - a graph (W, F) where W is a subset
of V and F is a subset of E, i.e. edges and vertices are removed from the
original graph and no new vertices or edges are added.
G W

Example : Draw all possible complete subgraph on 4 vertices for K5.

Complete subgraph with 4 vertices.


Representation of a Graph:

Adjacency List:

One way to represent a graph without edges is to list all the


vertices together with its adjacent vertices.

Example : Simple graph


Vertex adjacent vertices

a b

b c,d,a

c b , e, d

d b, c, e

e c, d

For digraph
Vertex adjacent vertices

a b

b _

c a,d

d b, e

e _

Adjacency matrix representation:

Let G = {V, E} be a simple graph with n vertices V1 , V2 , …., Vn


Its adjacency matrix is denoted as AG and it is defined as

AG =(aij)mxn =

If there exists an edge between vi and vj.

Note :

1. The adjacency matrix of a simple graph is symmetric aij= aji

2. Sum of all the entries in any row is equal to the degree of the
vertex corresponding to that row.

3. All the entries along the leading diagonal are zero iff the graph
has no self loop.

4. A pseudograph can be represented by an adjacency matrix in


this case the loop at the vertex vi is represented by one at i,i position
and j, j entries equals the number of edges that are incident on vi and vj
Adjacency matrix for digraph :

AG =(aij)mxn =

Example :
Note : Sum of the row = number of outdegree of the vertex.

[Link] the graph of the adjacency matrix

Solution : Given matrix is not a symmetric matrix. Graph is a


directed graph.

Pseudo graph

Incidence matrix:

Let G = { V,E } be an undirected graph with n vertices (v1,v2,….,vn)


with m edges (e1,e2,….em) then the incidence matrix of G is denoted as
IG =

Example :Undirected simple graph

Incidence matrix representation for a digraph:

Example:
Incidence Matrix

Let G be a graph with n vertices, e edges, and no self-loops. Define an n by e matrix A =[a ij],
whose n rows correspond to the n vertices and the e columns correspond to the e edges, as
follows:

The matrix element

Aij = 1, if jth edge ej is incident on ith vertex vi, and

= 0, otherwise.
a b c d e f g h
v1 0 0 0 1 0 1 0 0
v2 0 0 0 0 1 1 1 1
v3 0 0 0 0 0 0 0 1
v4 1 1 1 0 1 0 0 0
v5 0 0 1 1 0 0 1 0
v6 1 1 0 0 0 0 0 0

Graph ISOMORPHISM: Two graphs G1 and G2 are said be isomorphic to


each other if there exists one to one correspondence between vertex
set which preserves adjacency of the vertices.

Note: If G1 and G2 are isomorphic , if

(i)They have the same number of vertices.(ii)They have the


same number of edges.(iii)They have equal number of vertices
with the given degree.
Isomorphic simple graphs –
The simple graphs G1 = (V1, E1) and G2 = (V2, E2) are isomorphic if there is a 1-
to-1 correspondence such that {f(v1), f(v2)}  E2 iff {v1, v2}  E1 for all v1 and v2
in V1.
 Isomorphism tries to capture the idea that all that matters in a graph is the
adjacency structure.
 If we can manipulate the adjacency structures of two graphs so that they
match, then the graphs are technically the same.
Strategy for determining if two graphs are isomorphic:
 Check that the graphs have the same number of vertices.
 Check the degrees of the vertices to make sure that there are the same number
of degrees in each graph.
 See whether vertices of corresponding degrees follow the same adjacency
pattern (e.g. if there is a vertex of degree 1 adjacent to a vertex of degree 4 in
one graph, then the same pattern should appear in the other graph).
 Look for triangles in the graphs and see whether they correspond.
 If the graphs have lots of edges, check if the complements are isomorphic See
if the graphs have an invariant on which they differ (if one exists, the graphs
are not isomorphic). Invariants might be:
i) The number of vertices in each graph.
ii) The number of edges in each graph.
iii) The degrees of the vertices.
iv) Whether the graphs are both planar or non-planar.
 Try to associate the edges and vertices of one graph to the edges and vertices
of the other graph.

Example1: Determine whether the following graphs are isomorphic:

G1 G2

u2

v2

u1 u3 v1 v3

u5 u4

v5 v4

Answer: The graphs are isomorphic.


i) Each is the 5-cycle.
ii) One isomorphism is f(u1) = v1, f(u2) = v3, f(u3) = v5, f(u4) = v2, and f(u5) =
v4.

Example 2:Determine whether the following graphs are isomorphic:

u1 u2 u3 u5 u6 u8
u4 u7

y1 y2 y4 y5 y6 y8

y3 y7

Answer: The graphs are not isomorphic.

In the first graph, vertices of degree 3 are adjacent to a common vertex


(u3 and u6 are adjacent to u5). This is not true in the second graph.

Problem: Determine whether the graphs G & H shown below are isomorphic.

Solution : (i) (ie) { }


(ii) (ie) { }
The vertices of two graphs are same.

(iii) The edges of two graphs are equal.


(iv) Degree of G : deg(u1) = deg(u3) = deg(u5) = deg(u6) =2 & deg(u2) = deg(u4) =3
Degree of H : deg(v1) = deg(v2) = deg(v4) = deg(v6) =2 & deg(v3) = deg(v5) =3
Four vertices are having degree 2 both in G & H. Two vertices are having degree 3
both in G &H.
(v)

F :V(G) V(H) one to one correspondence:

, , , , ,

Because of one to one correspondence . Therefore G & H are isomorphic.

Connectivity

Path:
A path is a sequence of distinctive vertices connected by edges. Vertex v is
reachable from u if there is a path from u to v.
Connected graph :

 Connected graph - An undirected graph with the property that there is a path
between every pair of vertices in the graph.

 A graph that is not connected is the union of two or more connected


subgraphs, each pair of which has no vertex in common.
 These disjoint connected subgraphs are called the connected components of the
graph.

A graph is connected, if there is a path between any two vertices.

Strogly connected graph : A directed graph is strongly connected if there is


a path from u to v and from v to u for any u and v in the graph.

Weakly connected graph :A directed graph is weakly connected if the


underlying undirected graph is connected.

 Path from u to v in an undirected graph - a sequence of one or more edges


e1, e2, …, en where ei is associated to edge {xi-1, xi} for i = 1, 2, …, n where x0 =
u and xn = v.

 Path from u to v in a graph with directed edges - a sequence of one or more


edges e1, e2, …, en where ei is associated to the edge represented by the ordered
pair (xi-1, xi) for i = 1, 2, …, n where x0 = u and xn = v.
 Simple path - a path that does not contain an edge more than once.

 Circuit (cycle) - a path that begins and ends at the same vertex.

 Simple circuit - A circuit that does not contain the same edge more than once.

 Paths and cycles (circuits can help us to determine if two graphs are
isomorphic).
Note that the use of paths and cycles are typically used to show that two
graphs are not isomorphic.
 Cut vertices (or articulation points) are those vertices whose removal and the
removal of all edges incident with it produces a subgraph with more connected
components than the original graph.

 An edge whose removal produces a graph with more connected components


that the original graph is called a cut edge or bridge.

 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 any two


vertices in the underlying undirected graph.

Representing Graphs

As an example, the graph depicted in Figure 1 has vertex set V={a,b,c,d,e.f} and
edge set E = {(a,b),(b,c),(c,d),(c,e),(d,e),(e,f)}.

e f
a b
c
Every graph has associated with it an adjacency matrix, which is a binary nn
matrix A in which aij = 1 and aji = 1 if vertex vi is adjacent to vertex vj, and aij = 0
and aji = 0 otherwise. The natural graphical representation of an adjacency matrix

Adjacency matrix for graph

a b c d e f

a 0 1 0 0 0 0

b 1 0 1 0 0 0

c 0 1 0 1 1 0

d 0 0 1 0 1 0

e 0 0 1 1 0 1

f 0 0 0 0 1 0

Definition 4. A path from a vertex v to a vertex w is a sequence of vertices


v0, v1, v2, … ,vm, such that v = v0 and vn = w and there is an edge from each vj to the
next vj+1 for j = 0, 1, …, m-1. The path is a cycle (or circuit) if v = w. A path is
simple if no vertex is repeated except the starting vertex and ending vertex in the
case of a cycle.

1) New graphs from old.


a) Sometimes we only need part of a graph to solve a problem, e.g. we may
only be interested in part of a large computer network.
b) Subgraph of a graph G = (V, E) - a graph (W, F) where W is a subset of V
and F is a subset of E, i.e. edges and vertices are removed from the original
graph and no new vertices or edges are added.

G W
Paths and Circuits

 chain : A sequence of vertices is a chain of length l in G if


for i=1,2, ...,l.

 path : A sequence of vertices is a path from v0 to vl of length l in


G if for i=1,2, ...,l.
 simple path: It does not include the same edge twice.
 elementary path(or chain): A path or chain in G is called elementary if no
vertex occurs more than once.
 connected graph : A graph G is connected if between any two vertices there
exists a path in G joining them.
 strongly connected graph : A graph G is strongly connected if for any two
vertices x and y there exists a path in G from x to y.

 elementary cycle(circuit) : A cycle is a elementary cycle if vi


¹ vj for i¹j.

 chordless cycle : A simple cycle is chordless if vi vjÏE for i


and j differing by more than 1 mod l+1.

Theorem: Let G be a simple graph with n vertices. Show that if then

G is connected where is the miimum degree of the graph.


Proof: Let u and v be any two distinct vertices in the graph G we claim that there
is a uv path in G (ie) if
Case(i): If uv is an edge of G then it is a uv path. Therefore G is connected.
Case(ii): suppose uv is not an edge of the graph G then let X be the set of all
vertices which are adjacent to u and let Y be the set of all vertices which are
adjacent to v then u,vdoes not belong to XUY (ie) G has n vertices
Then

Subtracting on both side

Let us take then uwv is a path in G . Therefore a


graph G is a connected graph. Thus for every pair of distinct vertices of G there is
a path. Therefore graph G is connected.
Theorem :

Prove that a simple graph with n vertices may have atmost edges.
Solution : Let G = {v,e} be a simple graph with n vertices and k components.

Let the number of vertices in the ith component of G be ni where

Then +

……..(i)
+

……….(ii)

Squaring (ii) =

-k …..(iii)

We know that a simple graph with n vertices will have maximum edges.

Therefore the ith component having ni vertices will have edges .


Therefore the total number of edges in G
EULER AND HAMILTON PATHS

 An Euler cycle is a cycle which uses every edge of the graph exactly once.
 Euler's Theorem for Euler Cycles:
a) If the graph G doesn't have any isolated vertices, then it has an Euler cycle
if and only if the following two conditions are both satisfied:
i) G is connected.
ii) The degree of each vertex of G is even.

Graph models
 Niche overlap graph (in ecology) - each species is represented by a vertex.
An undirected edge connects two vertices if the two species represented by
the vertices compete (i.e. if their food sources are the same).
Example : Construct a niche overlap graphs for 6 species of birds where the
hermit thrush competes with the robin and blue jay, the robin competes with the
mocking bird, the mockingbird competes with the blue jay, and the nuthatch
competes with the woodpecker.

r bj
Influence graphs - each person in the group is represented by a vertex. There is a
directed edge from vertex 'a' to vertex b when person 'a' influences person b.
Example:
Construct an influence graph for the board members of a company if the
president can influence the director of R & D, the director of marketing,
and the director of operations. The director of R & D can influence the
director of operations. The director of marketing can influence the
director of operations. No one can influence or be influenced by the
chief financial officer.
Round-robin tournaments are tournaments where each team plays
each other team exactly once. Each team is represented by a vertex.
Example:
In a round-robin tournament, the Tigers beat the Blue Jays, the
Cardinals, and the Orioles. The Blue Jays beat the Cardinals and
Orioles. The Cardinals beat the Orioles.

 Precedence graphs and concurrent processing - computer programs can


be executed more rapidly by executing certain statements concurrently.
Each statement is a vertex and there is an edge from one vertex to a second
vertex if the second statement cannot be executed before the first statement
has been executed.
Theorem 1.

A connected graph G is Eulerian if and only if the degree of each vertex of G is


even.

Proof.

If G is Eulerian and P is an Eulerian trail, then there is a contribution of 2 towards


the degree whenever P passes through a vertex. It follows that each vertex has
even degree.

On the other hand, suppose that each vertex of G has even degree and we need
to construct an Eulerian trail.

We apply induction on the number of edges of G. Clearly when G contains only 1


edge the statement is true.
Assume that the statement is true for all graphs having fewer edges than G. Since
G is connected, each vertex has degree at least 2. By the lemma, there is a cycle C
in G. Removing this cycle will produce a new graph H, which is possibly
disconnected or even a null graph. By the induction hypothesis, each component
of H has an Eulerian trail. Note that each component of H has at least one vertex
in common with C (otherwise, G should be disconnected).

Now, we obtain the required Eulerian trail (of G) by following the edges of C, if a
non-isolated vertex of H is reached, tracing the Eulerian trail (of that Eulerian
component of H), and then continuing along the edges of C, and so on. This
process stops when we return to the starting vertex.

Corollaries.

(1) A connected graph is Eulerian if and only if its set of edges is union of disjoint
cycles.

(2) A connected graph is semi-Eulerian if and only if it has exactly two vertices of
odd degree. (The “only if” part is obvious. For the “if” part, simply join that
two “odd vertices” by an edge, resulting in a Eulerian graph by Theorem 1.)

Hamiltonian graphs
A connected graph G is said to be Hamiltonian if there exists a cycle passing
through each vertex of G. This cycle is called Hamiltonian cycle of G. A non-
Hamiltonian graph is said to be semi-Hamiltonian if there exists a path passing
through each vertex of . This path is called Hamiltonian path of .

Examples of Hamiltonian graphs:


 A Hamilton cycle in a graph is a cycle that includes each vertex of the graph
exactly once.

 A Hamilton path is a path that includes each vertex of the graph exactly once.

 There is no simple way to determine whether a graph has a Hamilton cycle or


path. However, there are theorems that give sufficient conditions for the
existence or non-existence of a Hamilton cycle or path.

 If G is a connected simple graph with n vertices where n  3, then G has a


Hamilton cycle if the degree of each vertex is at least n/2.

 Graphs having Hamilton cycles are easily constructed.


a) Start with a cycle, and add edges.
b) In particular, the complete graphs Kn with n > 2 have Hamilton cycles.
c) The following are some graphs with Hamilton cycles:

 A bridge in a connected graph G is an edge having the property that, if it is


removed, the graph is no longer connected. Graphs that contain bridges to not
have Hamilton cycles.

Theorem 5.1. In a (directed or undirected) graph with n vertices, if there is a path


from vertex v1 to vertex v2, then there is a path of no more than n-1 edges from v1 to
vertex v2.
Eulerian Paths and Circuits

 L. Euler, the father of the graph theory


 solved the Königsberg’s bridge problem, 1736
 eulerian path problem : a path that traverses each edge in the graph once and
only once.
Theorem 5.2. An undirected graph possess an eulerian path if and only if it is
connected and has either zero or two vertices of odd degree.
Proof. () Suppose that the graph possess an eulerian path. It must be connected.
 When the eulerian path is traced, we observe that every time the path
meets a vertex, it goes through two edges which are incident with the
vertex and have not been traced before.
 Thus, except for the two vertices at the ends of the path, the degree of any
vertex in the graph must be even.
() omitted.

Theorem 5.3. An directed graph possess an eulerian circuit if and only if it is


connected and the incoming degree of every vertex is equal to its outgoing degree.
An directed graph possess an eulerian path if and only if it is connected and the
incoming degree of every vertex is equal to its outgoing degree with the possible
exception of two vertices. For these two vertices, the incoming degree of one is one
larger than its outgoing degree, and the incoming degree of the other is one less
than its outgoing degree.
Hamiltonian Paths and Circuits

 Hamiltonian path problem : a path that passes through each of the vertices in a
graph exactly once.
 No simple necessary and sufficient condition is known.
Theorem 5.4. Let G be a linear graph of n vertices. If the sum of the degrees for
each pair of vertices in G is n - 1 or larger, then there exists a hamiltonian path in
G.
Proof. (1) G is connected:
 Suppose G has two or more disconnected components. Let v1 be a vertex
in one component that has n1 vertices and v2 be a vertex in another
component that has n2 vertices.
 Since the degree of v1 is at most n1 - 1 and the degree of v2 is at most n2 -
1, the sum of their degrees is at most n1 + n2 - 2 < n - 1, contradicts to the
assumption.
(2) Construct a hamiltonian path:
Let there be a length p-1 (p < n) path, (v1, v2, v3, …, vp). Both v1 and vp are
adjacent only to the vertices that are in the path.
There is a cycle containing exactly the vertices v1, v2, v3, …, vp.
 Assume v1 is adjacent to , where 1 < ij < p.
 If vp is adjacent to one of then we have the cycle.
 If vp is not adjacent to any one of then vp is
adjacent to at most p-k-1 vertices. Contradicts to the assumption.
 Pick a vertex vx that is not in the cycle. Because G is connected, there is a
vertex vk that is not in the cycle with an edge between vx and vk for some
vk in {v1, v2, v3, …, vp}.
 We now have the path (vx, vk, vk+1, …, vj-1, vp, vp-1, …,vj, v1, v2, v3, …, vk-
1), which contains p edges.

 Repeat the foregoing construction until we have a path with n - 1 edges.


Theorem 5.5. There is always a hamiltonian path in a directed complete graph.
Proof. Let there be a length p-1 (p < n) path, (v1, v2, v3, …, vp). Let vx be a
vertex that is not included in this path, and there is no edge from vx to v1.
However, (v1, vx)  G.
 Suppose that (vx, v2) is also an edge in the path. Replace the edge (v1, v2) in
the original path with the two edges (v1, vx) and (vx, v2) so that the vertex vx
will be included in the argument path.
 If there is no edge from vx to v2, then there must be an edge (v2, vx) in the
path and we can repeat the argument.
 If we find that it is not possible to include vertex vk in any augment path by
replacing an edge (vk, vk+1) in the original path with two edges (vk, vx) and
(vx, vk+1)with 1  k  p-1, then we conclude that there must be an edge (vp,
vx) in the graph.
 We can repeat the argument until all vertices in the graph are included in
the argumented path.
Travelling Problems
Review of definitions and basic theorems:

1. A walk in a graph G is a finite sequence of edges in which any two


consecutive edges are adjacent of identical.

2. A walk in which all edges are distinct is called a trail.

3. If the vertices of a trail are distinct (except the initial vertex and final vertex
possibly coincide), then the trail is called a path.

4. We say a walk/trail/path is closed if the initial vertex is also the finial vertex.

5. A closed path with at least one edge is called a cycle.

6. A graph is connected if and only if there is a path between each pair of


vertices.

7. If G is a simple graph with n vertices, m edges, and k components, then

As a corollary, any simple graph with n vertices and more than edges
must be connected.

Now, we obtain the required Eulerian trail (of G) by following the edges of C, if a
non-isolated vertex of H is reached, tracing the Eulerian trail (of that Eulerian
component of H), and then continuing along the edges of C, and so on. This
process stops when we return to the starting vertex.

Lemma.

Eulerian graph contains no bridge. Each odd vertex of a semi-Eulerian graph is


incident with at most 1 bridge. (Reasons: the first statement is an application of
hand-shaking lemma, while the second one is a corollary of the first.)

Proof of Theorem 2.

Suppose at some stage we have just reached a vertex and the resulting graph
is still connected. We will show that the next step can be carried out and produce
also a connected graph.

Case 1:

If v incident with an edge which is not bridge, then there is no trouble.

Case 2:

All edges incident with v are bridge. In case there is only 1 bridge incident with v
(by the lemma), traverse through this bridge, erase this bridge and the vertex v
(because v is now isolated). The resulting graph is still connected.

Since the graph is finite, we must finally return to u (and the remaining graph, if
exists, is still a connected graph). If there is nothing remains, that means an
Eulerian trail is found. Otherwise, the remaining graph is still Eulerian and the
algorithm can go on until we have traversed all the edges.

Hamiltonian graphs
A connected graph G is said to be Hamiltonian if there exists a cycle passing
through each vertex of G. This cycle is called Hamiltonian cycle of G. A non-
Hamiltonian graph is said to be semi-Hamiltonian if there exists a path passing
through each vertex of . This path is called Hamiltonian path of .

Examples of Hamiltonian graphs:

Theorem 3. Ore

If G is a simple graph with vertices such that

for each pair of non-adjacent vertices u, v, then G is Hamiltonian.

Proof.

Suppose G is not Hamiltonian. We may assume G is a “maximal non-Hamiltonian


graph” (in the sense that adding extra edge will give a Hamiltonian graph).

Consider the longest path in the graph (note that this path must
pass through every vertex). Clearly, is not adjacent.

Case 1:

When , we have , so is adjacent. This is a contradiction.

Case 2:

When , there are n  3 ordered pairs where . Let A be the


set of the pairs such that are adjacent and B be the set of those such that
are adjacent. Since , we have . But there is only n
3 pairs, one of the pair, says with , must belong to both A

vj vn
v1 v2 v j+1 v n-1
and B. Therefore, is adjacent to and is adjacent to , as shown in the
following figure.

Now, is a Hamiltonian cycle.

In both cases, we lead to a contradiction by constructing a Hamiltonian cycle. We


conclude that G is Hamiltonian.

Theorem :If G is a simple graph with vertices such that for each
vertex v, then G is Hamiltonian.

The Seven Bridges of Konigsberg

The origins of graph theory can be traced to the 18th century and the bridges of
Königsberg problem.
a. The city of Königsberg in East Prussia (later to become
Kaliningrad in the Soviet Union) is situated on the Pregel
River.
b. In the river are two islands that are connected to each other
and to the mainland by seven bridges.
A B
Pregel River

c. The problem was to plan a walk through the city in such a


way that each bridge was crossed exactly once.
i. It is unclear whether the walker was supposed to return
to the starting location (a cycle) or end at another
location (a path), but either way, it was impossible.
d. The Swiss mathematician, Leonard Euler (1707-1783), proved
this and more general cases.
e. Euler did this by using one dot (a vertex) to represent each
land mass and a line (an edge) to represent each bridge.

. C

A. B

Diagrams of this type are called graphs.


Finite and Infinite Graphs

Although in the definition of a graph neither the vertex set V nor the edge set E need be
finite, in most of the theory and almost all applications these sets are finite. A graph with a
finite number of vertices as well as a finite number of edges is called a finite graph; otherwise, it
is an infinite graph.

Incidence and Degree

When a vertex vi is an end vertex of some edge ej, vi and ej are said to be incident with
(on or to) each other.
Two nonparallel edges are said to be adjacent if they are incident on a common vertex.
Similarly, two vertices are said to be adjacent if they are the end vertices of the same edge.

The number of edges incident on a vertex v i, with self-loops counted twice is called the
degree, d(vi), of vertex vi.

Since each edge contributes two degrees, the sum of the degrees of all vertices in G is
twice the number of edges in G.

Isolated vertex, Pendent vertex, and Null graph

A vertex having no incident edge is called an isolated vertex. In other words, isolated
vertices are vertices with zero degree. Vertex v 4 and v7 in Fig. 3-2, for example, are isolated
vertices. A vertex of degree one is called a pendent vertex or an end vertex. Vertex v3 in Fig. 3-2
is a pendant vertex. Two adjacent edges are said to be in series if their common vertex is of
degree two.

Graph containing isolated vertices, series edges and a pendant vertex.

In the definition of a graph G = (V, E), it is possible for the edge set E to be empty. Such
a graph, without any edges, is called a null graph. In other words, every vertex in a null graph is
an isolated vertex. Although the edge set E may be empty, the vertex set V must not be empty;
otherwise, there is no graph. In other words, by definition, a graph must have at least one
vertex.

Matrix Representation of Graphs


Although a pictorial representation of a graph is very convenient for a visual study, other
representations are better for computer processing. A matrix is a convenient and useful way of
representing a graph to a computer. Matrices lend themselves easily to mechanical
manipulations. Besides, many known results of matrix algebra can be readily applied to study
the structural properties of graphs from an algebraic point of view. In many applications of
graph theory, such as in electrical network analysis and operation research, matrices also turn
out to be the natural way of expressing the problem.

PART A

1. Define Graph.

A graph G = (V,E) consists of a finite non empty set V, the element of which are the vertices
of G, and a finite set E of unordered pairs of distinct elements of V called the edges of G.

2. Define complete graph.


A graph of n vertices having each pair of distinct vertices joined by an edge is called a
Complete graph and is denoted by Kn. Complete graphs are often called cliques.
3. Define regular graph
A graph in which each vertex has the same degree is called a regular graph. A regular
graph has n – regular if each vertex has degree n.
4. Define Bipartite Graph.
Let G = (V,E) be a graph. G is bipartite graph if its vertex set V can be partitioned into
two nonempty disjoint subsets V1 and V2 , called a bipartition, so that each edge has one end in V1
and in V2 .
5. Define complete bipartite graph.
A complete bipartite graph is a bipartite graph with bipartition V 1 and V2 in which each
vertex of V1 is joined by an edge to each vertex of V2 .

6. Define Subgraph.
A graph H = (V1,E1) is a subgraph of G = (V,E) provided that V1 ,E1 and for each e ε E1 ,
both ends of e are in V1
7. Define Isomorphism
Two graphs G1 = (V1,E1) and G2 = (V2,E2) are the same or isomorphic, if there is a
bijection F from V1 to V2 such that (u,v) ε E1 if and only if ( F(u), F(v)) ε E2.
8. Define strongly connected graph
A digraph G is said to be strongly connected if for evry pair of vertices both vertices of
the pair are reachable from one another.
9. State the necessary and sufficient conditions for the existence of an Eulerian path in a connected
graph
A connected graph contains an Euler path if and only if it has exactly two vertices of odd
degree.
10. State Handshaking theorem.
Let G be a graph with at least two vertices . at least two vertices of G have the same
degree.
11. Define Connected graph.
A graph for which each pair of vertices is joined by a trail is connected.
12. Define Tree
A tree is a connected acyclic graph.
13. What is minimum cost spanning tree.
A spanning tree of minimum weight is called a minimum cost spanning tree.
14. Define forest.
A graph in which each connected component of a tree is called a forest.
15. Define spanning subgraph.
A graph H = (V1,E1) is a subgraph of G = (V,E). H is a spanning subgraph of G if H is a
subgraph of G and V1= V.
16. Define Induced subgraph.
A graph H = (V1,E1) is a subgraph of G = (V,E). H is an induced subgraph of G such that
E1 consists of all the edges of G with both ends in V1.
17. Define binary tree.
A binary tree is either a tree with no vertices or a rooted tree for which each vertex has at
most two children.
18. Define Eulerian Circuit.
A circuit in a graph that includes eacg edge exactly once, the circuit is called an Eulerian
circuit.
19. State Konigsberg bridge theorem.
Let G be a connected graph. G has an Eulerian circuit if and only if each vertex is even.

You might also like