0% found this document useful (0 votes)
5 views66 pages

GTmodule 2

Uploaded by

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

GTmodule 2

Uploaded by

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

MODULE2

TOPICS

• Eulerian and Hamiltonian graphs


• Euler graphs
• Operations on graphs
• Hamiltonian paths and circuits
• Travelling salesman problem

• Directed graphs
• Types of graphs
• Digraphs
• Binary relation
EULERIAN AND HAMILTONIAN GRAPHS

Euler graphs:

• In a graph G a closed walk running through every edge of G exactly once called an Euler line, and a
graph that consists of an Euler line is called an Euler graph.
Theorem:A given connected graph G is an euler
graph if and only if all vertices of G are of even degree.

• Suppose that G is an Euler graph. It therefore contains an Euler line (which is a closed walk). In
tracing this walk we observe that every time the walk meets a vertex v it goes through two “new”
edges incident on v—with one we “entered” v and with the other “exited.” This is true not only of
all intermediate vertices of the walk but also of the terminal vertex, because we “exited” and
“entered” the same vertex at the beginning and end of the walk, respectively.

• Thus if G is an Euler graph, the degree of every vertex is even.


• Conversely,Assume that all vertices of G are of even degree then prove that it is a euler graph

1. i.e to prove G contains atleast one euler line

2. To prove G contains a closed walk covering all edges

• Construct a closed walk starting at an vertex v and going through the edges of G such that no
edge is repeated. Let the closed walk be h.
• Case 1:If h covers all the edges of g then h is a euler line and hence G is a euler graph

• Case2:If h does not cover all the edges of G,then remove all the edges of h from G and
obtain the remaining graph G’. But both G and G’ have all their vertex of even degree we
can say that every vertex of G’ is of even degree. Since G is connected, h will touch G’
atleast at one vertex. Starting from a, we can again construct a new walk in graph h′.
Since all the vertices of h′ are of even degree, this walk in h ′ must terminate at vertex a;
but this walk in h′ can be combined with h to form a new walk, which starts and ends at
vertex v and has more edges than h. This process can be repeated until we obtain a
closed walk that traverses all the edges of G. Thus G is an Euler graph
• Now looking at the graph of the Königsberg bridges (Fig. 1-5), we find
that not all its vertices are of even degree. Hence, it is not an Euler
graph. Thus it is not possible to walk over each of the seven bridges
exactly once and return to the starting point.
• an open walk that includes (or traces or covers) all edges of a graph
without retracing any edge a unicursal line or an open Euler line.
OPERATIONS ON GRAPHS

• The union
• Intersection
• ring sum
• Complement
• Fusion
• Deletion
• Decomposition
UNION

• The union of two graphs


• G1 = (V1 , E1 ) and
• G2 = (V2 , E2 )
• is another graph G3 (written as G3 = G1 ⋃ G2 )

• whose vertex set V3 = V1 ⋃ V2 and the edge set E3 = E1 ⋃ E2 .


INTERSECTION

The intersection G1 ⋂ G2 of graphs G1 and G2 is a graph G4 consisting


only of those vertices and edges that are in both G1 and G2 .
RING SUM

• The ring sum of two graphs G1 and G2 (written as G1 ⊕ G2) is a graph


consisting of the vertex set V1 ⋃ V2 and of edges that are either in G1
or G2, but not in both
• If G1 and G2 are edge disjoint, then G1 ⋂ G2 is a null graph, and G1 ⊕
G2 = G1 ⋃ G2. If G1 and G2 are vertex disjoint, then G1 ⋂ G2 is empty.
• For any graph G, G ⋃ G = G ⋂ G = G, and G ⊕ G = a null graph
COMPLEMENT

• The complement of a graph ( G ) is defined such that there will be an


edge between two vertices ( (v, e) ) in ( G' ) if and only if there is no
edge between ( (v, e) ) in ( G ). The number of vertices remains
unchanged in the complement of the graph1.
DIRECTED GRAPHS
DECOMPOSITION:

• A graph G is said to have been decomposed into two subgraphs g1 and


g2 if g1 ⋃ g2 = G, and g1 ⋂ g2 = a null graph.
• In other words, every edge of G occurs either in g1 or in g2,
• Some of the vertices, however, may occur in both gl and g2. I
DELETION

• Deletion: If vi is a vertex in graph G, then G — vi denotes a subgraph of G


obtained by deleting (i.e., removing) vi from G. Deletion of a vertex always
implies the deletion of all edges incident on that vertex.
• If ej is an edge in G, then G — ej is a subgraph of G obtained by deleting ej
from G. Deletion of an edge does not imply deletion of its end vertices.
Therefore G − ej= G ⊕ ej
FUSION:

• A pair of vertices a, b in a graph are said to be fused (merged or


identified) if the two vertices are replaced by a single new vertex such
that every edge that was incident on either a or b or on both is incident
on the new vertex. Thus fusion of two vertices does not alter the
number of edges, but it reduces the number of vertices by one.
FIND

• Find fusion of a and d


• Fusion of a and c
• Fusion of e and f
HAMILTONIAN CIRCUITS

• A Hamiltonian circuit in a connected graph is defined as a closed walk


that traverses every vertex of G exactly once, except of course the
starting vertex, at which the walk also terminates.
• For example,
In the graph
a) starting at vertex v, if one traverses along the edges shown in heavy lines— passing through
each vertex exactly once—one gets a hamiltonian circuit.
b)A hamiltonian circuit for the graph in fig(b) is also shown by heavy lines
• Hamiltonian Path: If we remove any one edge from a Hamiltonian
circuit, we are left with a path. This path is called a Hamiltonian path.
• Since a Hamiltonian path is a subgraph of a Hamiltonian circuit (which
in turn is a subgraph of another graph), every graph that has a
Hamiltonian circuit also has a Hamiltonian path.
e1 b
a
e3
e2
c
e5 e4
a e1 b e3 c e4 f e6 d is a Hamiltonian path d f
e6
DRAW HAMILTONION CIRCUIT AND
HAMILTONION PATH
v v
1 2
v v
5 6

v v
7 8 v
v
4 3
v1 v2 v1 v2

v5 v6
v5 v6

v7 v8
v7 v8
v3
v4 v3
v4

Hamiltonion circuit
v1 v2 v6 v8 v3 v4 v7 v5 v1 • Hamiltonion path
• v1 v5 v7v4 v3 v8 v6 v2
DIFFERENCE BETWEEN EULER PATH AND
HAMILTONION PATH
Hamiltonian path in the graph is a path that visits the each vertex
exactly once.
Eulerian path in a graph is a path that visits the every edge exactly
once.
COMPLETE GRAPH.

• Complete Graph: A simple graph in which there exists an edge between


every pair of vertices is called a complete graph.
• Number of Hamiltonian Circuits in a Graph: A given graph may contain
more than one Hamiltonian circuit.
THEOREM :IN A COMPLETE GRAPH WITH N VERTICES THERE ARE (N − 1)/2
EDGE-DISJOINT HAMILTONIAN CIRCUITS, IF N IS AN ODD NUMBER ≥ 3
• Proof: A complete graph G of n vertices has n(n − l)/2 edges, and a Hamiltonian
circuit in G consists of n edges. Therefore, the number of edge disjoint Hamiltonian
circuits in G cannot exceed (n − l)/2.
• when n is odd, can be shown as follows:
• The subgraph (of a complete graph of n vertices) in Fig. 2-24 is a Hamiltonian circuit.
Keeping the vertices fixed on a circle, rotate the polygonal pattern clockwise by
360/(n − 1), 2·360/(n − 1), 3·360/(n − 1), . . . , (n − 3)/2·360/(n − 1) degrees.

• Observe that each rotation produces a Hamiltonian circuit that has no edge in
common with any of the previous ones. Thus we have (n − 3)/2 new Hamiltonian
circuits, all edge disjoint from the one in figure and also edge disjoint among
themselves.
TRAVELING-SALESMAN PROBLEM

• A salesman is required to visit a number of cities during a trip. Given


the distances between the cities, in what order should he travel so as
to visit every city precisely once and return home, with the minimum
mileage traveled
• Representing the cities by vertices and the roads between them by
edges, we get a graph. In this graph, with every edge ei there is
associated a real number (the distance in miles, say), w(ei). Such a
graph is called a weighted graph; w(ei) being the weight of edge ei.
• The total number of different (not edge disjoint, of course) Hamiltonian
circuits in a complete graph of n vertices can be shown to be (n − l)!/2.
DIRECTED GRAPHS

• A directed graph (or a digraph for short) G consists of a set of vertices


V = {v1, v2, . . .}, a set of edges E = {e1, e2, . . .}, and a mapping that
maps every edge onto some ordered pair of vertices (vi, vj).

The figure shows a digraph with five vertices and


ten edges. A digraph is also referred to as an
oriented graph.
• . The vertex vi, which edge ek is incident out of, is called the initial
vertex of ek.
• The vertex vj, which ek is incident into, is called the terminal vertex of
ek.
• v5 is the initial vertex and v4 is the terminal vertex of edge e7.
• An edge for which the initial and terminal vertices are the same forms a
self-loop, such as e5.
• The number of edges incident out of a vertex vi is called the out-
degree of vi and is written d+(vi). The number of edges incident into
vi is called the in-degree . d is written as d−(vi)
• In any digraph G the sum of all in-degrees is equal to the sum of all out-
degrees, each sum being equal to the number of edges in G; that is
• An isolated vertex is a vertex in which the in-degree and the out-
degree are both equal to zero. A vertex v in a digraph is called
pendant if it is of degree one, that is, if
• Two directed edges are said to be parallel if they are mapped onto the
same ordered pair of vertices. edges e8, e9, and e10 are parallel,
ISOMORPHIC DIGRAPHS:

• Isomorphic graphs were defined such that they have identical


behavior in terms of graph properties. For two digraphs to be
isomorphic not only must their corresponding undirected graphs be
isomorphic, but the directions of the corresponding edges must also
agree.

Non isomorphic
graphs
SOME TYPES OF DIGRAPHS

• Simple Digraphs: A digraph that has no self-loop or parallel edges is called a


simple digraph
• Asymmetric Digraphs: Digraphs that have at most one directed edge between
a pair of vertices, but are allowed to have self-loops,
• Symmetric Digraphs: Digraphs in which for every edge (a, b) (i.e., from vertex
a to b) there is also an edge (b, a) are called asymmetric or antisymmetric.
• A digraph that is both simple and symmetric is called a simple symmetric
digraph.
• Similarly, a digraph that is both simple and asymmetric is simple asymmetric.
COMPLETE DIGRAPHS:

• There are two types of complete graphs.


• A complete symmetric digraph is a simple digraph in which there is
exactly one edge directed from every vertex to every other vertex and
a complete asymmetric digraph is an asymmetric digraph in which
there is exactly one edge between every pair of vertices
• A complete asymmetric digraph of n vertices contains n(n – l)/2
edges, but a complete symmetric digraph of n vertices contains n(n –
1) edges
Complete
asymmetric
Complete symmetric
SYMMETRIC DIGRAPH
DIGRAPHS AND BINARY RELATIONS

• A digraph is the most natural way of representing a binary relation on a set X.

• Each xi ∈ X is represented by a vertex xi .

• If xi has the specified relation R to xj, a directed edge is drawn from vertex xi to xj, for
every pair (xi xj).
Represents the relation “is greater than” on a set consisting of five numbers
(3, 4, 7, 5, 8}.
REFLEXIVE RELATION:

For some relation R it may happen that every element is in relation R to itself. For
example, a number is always equal to itself, or a line is always parallel to itself. Such a
relation R on set X that satisfies

xiRxi
• for every xi ∈ X is called a reflexive relation.
• The digraph of a reflexive relation will have a self-loop at every vertex. Such a digraph
representing a reflexive binary relation on its vertex set may be called a reflexive
digraph.
• A digraph in which no vertex has a self-ioop is called an irreflexive digraph.
SYMMETRIC RELATION:

• For some relation R it may happen that for all xi and xj if


xiRxj holds, then xjRxi also holds.
• Such a relation is called a symmetric relation
• “Is equal to” is both symmetric and reflexive.
• The digraph of a symmetric relation is a symmetric digraph
because for every directed edge from vertex xi to xj there
is a directed edge from xj to xi.
shows the graph of an irreflexive, symmetric binary relation on a set
of four elements.

The same relation can also be represented by drawing just one undirected edge between
every pair of vertices
TRANSITIVE RELATION:

• A relation R is said to be transitive if for any three elements xi, xj, and xk
in the set,
xiRxj and xjRxk always imply
xiRxk.
• The binary relation “is greater than,” for example, is a transitive relation.
• If xi>xj and xi > xk, clearly xi > xk.
• A digraph representing a transitive relation (on its vertex set) is called a
transitive directed graph.
EQUIVALENCE RELATION:

• A binary relation is called an equivalence relation if it is reflexive,


symmetric, and transitive.
• Some examples of equivalence relations are “is parallel to,” “is equal to,”
“is congruent to,” “is equal to modulo m,” and“ is isomorphic to.”
• The graph representing an equivalence relation may be called an
equivalence graph.
• The equivalence relation “is congruent to modulo 3” means that two
integers a and b are related if their difference is divisible by 3. In
mathematical terms:
Let us look at an example, consisting of the equivalence relation “is congruent to
modulo 3” defined on the set of 11 integers, 10 through 20.
•10 mod 3 = 1
•11 mod 3 = 2
•12 mod 3 = 0
•13 mod 3 = 1
•14 mod 3 = 2
•15 mod 3 = 0
•16 mod 3 = 1
•17 mod 3 = 2
•18 mod 3 = 0
•19 mod 3 = 1
•20 mod 3 = 2
RELATION MATRICES:

• A binary relation R on a set can also be represented by amatrix, called


a relation matrix.
• It is a (0, 1), n by n matrix, where n is the number of elements in the
set. The i, j th entry in the matrix is 1 if xiRxj is true,and is 0, otherwise.
• For example, the relation matrix of the relation “is greater than” on the
set of integers
(3, 4, 7, 5, 8)

You might also like