By : Nisha Mittal
Nisha Mittal
Types of Graphs
Isomorphic Graph
Homomorphism Graph Hamilton path
Bipartite Graph
Complete Bipartite graph
Hamilton Circuit
Euler path K-regular graph
Euler Circuit
Planar Graphs
Graph Coloring
Complete Graph
Graph Theory
Graph G =(V, E) consists
set of vertices(node points) denoted by V
set of edges E
Adjacent Nodes:
any pair of nodes which are joined by an edge in a graph
Isolated Nodes:
a node which is not adjacent to any other node is called isolated
node.
Edge Type
Directed: Ordered pair of vertices. Represented as (u, v) directed from vertex
u to v.
u v
Undirected: Unordered pair of vertices. Represented as {u, v}. Disregards any
sense of direction and treats both end vertices interchangeably.
u v
Edge Type
• Self Loop: An Edge which joins a vertex to itself is called a
loop. Represented as {u, u} = {u}
a
• Parallel (Multiple) Edges: Two or more edges joining the
same pair of vertices.
Graph Type
Undirected Graph A graph in which every edge is undirected is
known as Undirected Graph
Representation Example: G(V, E), V = {u, v, w}, E = {{u, v}, {v, w}, {u, w}}
u v
w
Graph Type
Multigraph: Any graph which contains some parallel edges is called
multigraph
u
1 2 w
v 3
Graph Type
Directed Graph: A graph in which every edge is directed
u v
w
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 endpoints of {u, v}
• Degree of Vertex (deg (v)): the number of edges incident on a vertex. A loop
contributes twice to the degree (why?).
• Pendant Vertex: deg (v) =1 deg (v) = 1
u v
• Isolated Vertex: deg (k) = 0 k
deg (u) = 2
deg (k) = 0
w
deg (w) = 1
Directed graphs
• 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
A loop contributes 1 to both in-degree and out-degree
deg- (u) = 0
deg+ (u) = 2
deg- (v) = 1,
u v deg+ (v) = 1
deg- (w) = 2,
w deg+ (w) = 0
If all the vertices have same degree then the graph is called REGULAR GRAPH
If the degree of each vertex is k then the graph is called K-Regular Graph
Every Polygon is 2- Regular Graph.
Between any two distinct vertices there is exactly one edge.
Every complete Graph is a regular graph but Every regular graph need not to be complete.
A complete graph is a simple graph with maximum number of edges.
No. of edges in Kn= n(n-1)/2
Degree of each vertex = (n-1)
Isomorphism Graph
Two graphs which contain the same number of graph
vertices connected in the same way are said to be isomorphic.
• G1 = (V1, E2) and G2 = (V2, E2) are isomorphic if:
• There is 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.
• Function f is called isomorphism
Isomorphism Graph
Representation example: G1 = (V1, E1) , G2 = (V2, E2)
f(u1) = v1, f(u2) = v4, f(u3) = v3, f(u4) = v2,
u1 u2
u1 u4
u4 v1 v2
u3
v3 v4
u3 u2
Homomorphic Graph
• We can obtain a new graph by dividing an edge of G with additional vertices. The
graph G and G* are said to be homomorphic if they can be obtained from the
same graph.
Homomorphic Graph
A and B are not isomorphic but they are
homomorphic , since they can be determined from C
Bipartite graphs
• A graph G=(V,E) is called Bipartite graph , if its vertices V can be
partitioned into two subsets V1 and V2 such that each edge of G
connects a vertex V1 to a vertex V2
V1 V2
V4
V3
Bipartite graphs
• A graph G=(V,E) is called Bipartite graph , if its vertices V can be
partitioned into two subsets V1 and V2 such that each edge of G
connects a vertex V1 to a vertex V2
V = { V1, V2 , V3, V4}
V1’= {V1, V3}
V2’={V2,V4} V2
V1
V4
V3
Complete Bipartite graphs
• Where every Vertex of V1 is adjacent to every vertex of V2, Where V1
and V2 are two partitioned subsets of vertex set V of G.
Representation example: K2,3, K3,3
K2,3 K3,3
Euler Path , Euler Circuit , Hamilton path
Eulerian path (Eulerian trail, Euler walk) in a graph is a path whose edge list
contains each edge of the graph exactly once.
Eulerian cycle (Eulerian circuit, Euler tour) it is a path through a graph in which
initial vertex appears second time as terminal vertex.
Hamilton Path:- It is a path whose vertex list contains each vertex exactly once.
Euler Path , Euler Circuit , Hamilton path
Eulerian path (Eulerian trail, Euler walk) in a graph is a path whose edge list contains each edge of the graph exactly once.
An Euler path is a path that uses every edge in a graph with no repeats. Being a path, it does not have to return to the starting
vertex.
Eulerian cycle (Eulerian circuit, Euler tour) it is a path through a graph in which initial vertex appears second time as terminal
vertex.
An Euler circuit is a circuit that uses every edge in a graph with no repeats. Being a circuit, it must start and end at the same
vertex.
EULER’S PATH AND CIRCUIT THEOREMS
A graph will contain an Euler path if it contains at most two vertices of odd degree.
A graph will contain an Euler circuit if all vertices have even degree
Euler Path , Euler Circuit , Hamilton path
If graph G has more than two vertices of odd degree ,then there can be no euler
path.
If in connected graph exactly two vertices of odd degree,there is an euler path.
Any euler path must begin at vertex of odd degree and end at other vertex.
A graph has an euler circuit
iff it is connected and all vertices have even degree.
A graph has an euler path but not euler circuit
iff it has exactly two vertices with odd degree
a) If a graph has any odd vertices, then it cannot have an Euler circuit.
(b) If a graph is connected and every vertex is even, then it has at least one Euler
circuit.
(a) If a graph has more than two odd vertices, then it cannot have an Euler path.
(b) If a connected graph has exactly two odd vertices then it has at least one Euler path starting at one odd vertex and ending at
another odd vertex.
a) The sum of the degrees of all the vertices of a graph equals twice the number
of edges.
(b) A graph always has an even number of odd vertices.
0 Graph has Euler circuit(s)
2 Graph has Euler path(s) but no Euler circuit
4, 6, 8, . . . Graph has no Euler path and no Euler circuit
1, 3, 5, . . . Impossible!
Hamiltonian Graph
• Hamiltonian path is a path that visits each vertex exactly once.
• A Hamiltonian cycle is a cycle that visits each vertex exactly once (except for the starting vertex, which is visited once at the
start and once again at the end).
• A graph that contains a Hamiltonian path is called a traceable graph. A graph that contains a Hamiltonian cycle is called a
Hamiltonian graph.
• Any Hamiltonian cycle can be converted to a Hamiltonian path by removing one of its edges, but a Hamiltonian path can be
extended to Hamiltonian cycle only if its endpoints are adjacent.
Hamiltonian Graph
This one has a Hamiltonian path, but not a Hamiltonian
tour.
Hamiltonian Graph
• Similar notions may be defined for directed graphs, where edges (arcs) of a path or a cycle are required to point in the same
direction, i.e., connected tail-to-head.
• The Hamiltonian cycle problem or Hamiltonian circuit problem in graph theory is to find a Hamiltonian cycle in a given graph.
The Hamiltonian path problem is to find a Hamiltonian path in a given graph.
• There is a simple relation between the two problems. The Hamiltonian path problem for graph G is equivalent to the
Hamiltonian cycle problem in a graph H obtained from G by adding a new vertex and connecting it to all vertices of G.
• Both problems are NP-complete. However, certain classes of graphs always contain Hamiltonian paths. For example, it is
known that every tournament has an odd number of Hamiltonian paths.
Hamiltonian Graph
• DIRAC’S Theorem: if G is a simple graph with n vertices with n ≥ 3
if degree of each vertex deg(v)≥ n/2
Then graph has Hamilton circuit.
• ORE’S Theorem: if G is a simple graph with n vertices with n ≥ 3
if for each pair of vertices
deg (u) + deg (v) ≥ n
(nonadjacent vertices u and v)
then G has a Hamilton circuit.
Planar Graphs
K4
Planar Graphs
Planar Graphs
• Representation examples: K3,3 is Nonplanar
v1 v2 v3 v1 v5 v1 v5
R21
R2 R1 R1
R22
v3
v4 v5 v6 v4 v2 v4 v2
Planar Graphs
Theorem : Euler's planar graph theorem
For a connected planar graph or multigraph:
v–e+r=2
number number
number
of vertices of regions
of edges
Planar Graphs
Example of Euler’s theorem
A planar graph divides the plane
R1
K4 R2 R4 into several regions (faces), one
of them is the infinite region.
R3 v=4,e=6,r=4, v-e+r=2
Planar Graphs
• Kuwratoski’s Theorem: A graph is non-planar if and only if it contains a subgraph
homeomorephic to K3,3 or K5
Representation
b Example: G is
a Nonplanar
b b
a
c a
j
c d
h e c
i
k e
d
g f d
e H K5
g
f
G
Vertex Coloring Problem
• An assignment of colors to the vertices of a graph G, so that no two adjacent vertices have same color is called vertex
coloring.
• Chromatic number: least number of colors needed to color the graph
• If G is null X(G)=1
• If G is not null X(G) ≥ 2
• A graph that can be assigned a (proper) k-coloring is k-colorable, and it is k-chromatic if its chromatic number is exactly k.
Vertex Coloring Problem
• The chromatic number for Cn = 3 (n is odd) or 2 (n is even), Kn = n, Km,n = 2
C4 C5 K4 K2, 3
Vertex Covering Problem
• The Four color theorem: Every planer graph G is 4 colorable
• Example: G1 chromatic number = 3, G2 chromatic number = 4
G1 G2