0% found this document useful (0 votes)
1 views

graph-theory

Graph Theory in Discrete mathematics.

Uploaded by

ogames970
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)
1 views

graph-theory

Graph Theory in Discrete mathematics.

Uploaded by

ogames970
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/ 50

Graph

Theory
DISCRETE
M AT H E M AT I C S
( C S 11 4 2 )

Prepared by
Dr. Manushi Gupta
Introduction
The subject of graph theory began in the year 1736 when the great mathematician Leonhard Euler published a
paper giving the solution to the following puzzle:
The town of Königsberg in Prussia (now Kaliningrad in Russia) was built at a point where two branches of the
Pregel River came together. It consisted of an island and some land along the riverbanks. These were connected
by seven bridges as shown in the figure. The question is this: Is it possible for a person to take a walk around
town, starting and ending at the same location and crossing each of the seven bridges exactly once?

Dr. Manushi Gupta


Definitions
Let 𝑉 be a finite nonempty set, and 𝐸 ⊆ 𝑉 × 𝑉. The pair (𝑉, 𝐸) is then called a directed graph (on 𝑽) or
digraph (on 𝑽) where 𝑉 is the set of vertices, nodes, and 𝐸 is its set of (directed) edges or arcs. We write 𝐺 =
(𝑉, 𝐸) to denote such a graph.
When there is no concern about the direction of any edge, we still write 𝐺 = (𝑉, 𝐸). But now 𝐸 is a set of
unordered pairs of elements taken from 𝑉, and 𝐺 is called an undirected.
Whether 𝐺 = (𝑉, 𝐸) is directed or undirected, we often call 𝑉 the vertex set of 𝐺 and 𝐸 the edge set of 𝐺.

a) An undirected graph with vertices 𝑉 =


{𝑎, 𝑏, 𝑐, 𝑑, } and edges 𝐸 =
{𝑎, 𝑏}, {𝑏, 𝑐}, {𝑎, 𝑐}, {𝑐, 𝑑}.

b) A directed graph with vertices 𝑉 =


An edge such as {𝑎, 𝑏} stands for {𝑎, 𝑏, 𝑐, 𝑑} and edges 𝐸 = { 𝑎, 𝑏 , 𝑏, 𝑎 ,
{(𝑎, 𝑏), (𝑏, 𝑎)}. Although (𝑎, 𝑏) = (𝑏, 𝑎) 𝑎, 𝑐 , 𝑐, 𝑎 , 𝑐, 𝑏 , 𝑏, 𝑐 , 𝑐, 𝑑 , (𝑑, 𝑐)}.
only when 𝑎 = 𝑏, we do have 𝑎, 𝑏 =
𝑏, 𝑎 .

Dr. Manushi Gupta


• An edge with just one endpoint is called a loop.
• Two or more distinct edges with the same set of endpoints are said to be parallel.
• An edge is said to connect its endpoints; two vertices that are connected by an edge are called adjacent;
and a vertex that is an endpoint of a loop is said to be adjacent to itself. For example, edge 𝑒 [ v , v ]
, we say that the edge is incident with the vertices 𝑣 , 𝑣 ; 𝑣 is said to be adjacent to 𝑣 , whereas 𝑣 is
adjacent from 𝑣 . In addition, vertex 𝑣 is called the origin, or source, of the edge 𝑒 , and vertex 𝑣 is
the terminus, or terminating vertex.
• An edge is said to be incident on each of its endpoints, and two edges incident on the same endpoint
are called adjacent.
• A vertex on which no edges are incident is called isolated.

Can we say E is a relation on V?

Dr. Manushi Gupta


For each of the graphs :
•Find all edges that are incident on 𝑣 .
•Find all vertices that are adjacent to 𝑣 .
•Find all edges that are adjacent to 𝑒 .
•Find all loops.
•Find all parallel edges.
•Find all isolated vertices.

Dr. Manushi Gupta


Real life uses:
∙ A graph can model a wide variety of structures such as
o an arrangement of electric power lines or fiber optic cables,
o a transportation system,
o a knowledge base, or
o a collection of computers ranging from a small local area network to the entire
world wide web
∙ A graph model can be used to solve a logical problem, color a map, or
schedule meetings

Dr. Manushi Gupta


Walks, Trails, Paths, and Circuits
Let 𝑥, 𝑦 be (not necessarily distinct) vertices in an undirected graph 𝐺 = (𝑉, 𝐸).
An 𝒙 − 𝒚 walk in 𝑮 is a finite alternating sequence
𝑥 = 𝑥₀, 𝑒₁, 𝑥₁, 𝑒₂, 𝑥₂, 𝑒₃, … , 𝑒ₙ₋₁, 𝑥ₙ₋₁, 𝑒ₙ, 𝑥ₙ = 𝑦
of vertices and edges from 𝐺, starting at vertex 𝑥 and ending at vertex 𝑦 and involving the 𝑛 edges
𝑒ᵢ = {𝑥ᵢ₋₁, 𝑥ᵢ}, where 1 ≤ 𝑖 ≤ 𝑛.
The length of this walk is 𝑛, the number of edges in the walk.

When 𝑛 = 0, there are no edges, 𝑥 = 𝑦, and the walk is called trivial.

Any 𝑥 − 𝑦 walk where 𝑥 = 𝑦 (and 𝑛 > 1) is called a 𝐜𝐥𝐨𝐬𝐞𝐝 𝐰𝐚𝐥𝐤. Otherwise, the walk is called open.

A trail from 𝒙 to 𝒚 is a walk from 𝒙 to 𝒚 that does not contain a repeated edge.

A path from 𝒙 to 𝒚 is a trail that does not contain a repeated vertex.

A circuit is a closed walk that contains at least one edge and does not contain a repeated edge.

A simple circuit (cycle) is a circuit that does not have any other repeated vertex except the first and last.

Dr. Manushi Gupta


Repeated Repeated Starts and Ends Must Contain
Edge? Vertex? at at
the Same Least One
Point? Edge?

Walk Allowed Allowed Allowed No

Trail No Allowed Allowed No

Path No No No No

Closed Walk Allowed Allowed Yes Yes

Circuit No Allowed Yes Yes

Simple Circuit No First and last Yes Yes


only

Dr. Manushi Gupta


trail just walk circuit

simple circuit closed walk trail or closed walk

Dr. Manushi Gupta


Dr. Manushi Gupta
Distance between two vertices:
Let 𝐺 be a connected graph, u and v be any two vertices of graph 𝐺, then the smallest path between u and v is called the
distance between u and v and it is denoted by 𝑑 𝑢, 𝑣 .

Dr. Manushi Gupta


Degree and Subgraphs
Let be a graph and a vertex of G. The degree of , denoted deg( ), equals the number of edges
that are incident on , with an edge that is a loop counted twice.

A graph is said to be a subgraph of a graph if, and only if, every vertex in is also a vertex in
, every edge in is also an edge in , and every edge in has the same endpoints as it has in .

List all subgraphs of the graph G with vertex set {𝑣 , 𝑣 } and edge set {𝑒 , 𝑒 , 𝑒 }, where the endpoints of 𝑒 are 𝑣 and 𝑣 , the
endpoints of 𝑒 are 𝑣 and 𝑣 , and 𝑒 is a loop at 𝑣 . Find the degree of each vertex.

Dr. Manushi Gupta


Given a (directed or undirected) graph let be a subgraph of .
If , then is called a spanning subgraph of

Which of them are spanning subgraph of G?

Dr. Manushi Gupta


The complement of a subgraph with respect to the graph
is another subgraph such that is equal to

Find the complement


of subgraph G’ with
respect to the graph
G.

Dr. Manushi Gupta


The undirected complete graph of vertices, denoted , is a loop - free graph with
vertices in which there is an edge between each pair of distinct vertices.

Draw and

What will the degree of each vertex in 𝐾


graph and how many edges will be there? no. of edge =n*(n-1)/2
deg= n-1

The complement of a graph of vertices is defined to


be its complement with respect to and is denoted .

Dr. Manushi Gupta


Connectedness
Let G be a graph. Two vertices v and w of G are connected if, and only if, there is a path from v to w. The graph G
is connected if, and only if, given any two vertices v and w in G, there is a path from v to w.
Symbolically:
𝐺 is connected ⟺ ∀ vertices 𝑣 and 𝑤 in 𝐺, ∃ a path from 𝑣 𝑡𝑜 𝑤.

Let 𝐺 = (𝑉, 𝐸) be a directed graph. Its associated undirected graph is the graph obtained from G by ignoring the
directions on the edges. If more than one undirected edge results for a pair of distinct vertices in G, then only one of
these edges is drawn in the associated undirected graph. When this associated graph is connected, we consider G
connected.

A graph that is not connected is called disconnected.

A graph H is a connected component of a graph G if, and only if,


1. H is subgraph of G;

2. H is connected; and

3. no connected subgraph of G has H as a subgraph and contains vertices or edges that are in H.

Dr. Manushi Gupta


The no. of components in the graph 𝐺 = 𝑉, 𝐸 is denoted by 𝜅 𝐺 .

A connected component of a graph is a connected subgraph of largest possible size.

Find the connected components for each of the following graphs:

Dr. Manushi Gupta


Isomorphism
Let and be two undirected graphs. A function,
is called a graph isomorphism if
(a) f is one-to-one and onto, and
(b) for all if and only if .
When such a function exists, and are called isomorphic graphs .

This definition explains the concept of graph isomorphism, which is a way to determine if
two graphs have the same structure, regardless of how they are drawn or labeled.

What all
isomorphism Adjacencies Path Cycle
preserves?
Dr. Manushi Gupta
Simple Graphs: A simple graph is a loop-free graph that does not contain more than one edge between the
pair of vertices.
Multigraph: The pair (𝑉, 𝐸) determines a multigraph 𝐺 with vertex set V and edge set 𝐸 if, for some 𝑥, 𝑦 ∈
𝑉, there are two or more edges in 𝐸.

Draw non-isomorphic simple graph with vertices 2 and 3.

Dr. Manushi Gupta


Draw non-isomorphic simple graph with vertices 4.

Dr. Manushi Gupta


Are these graphs
isomorphic?

𝑎 → 𝑞, 𝑐 → 𝑢, 𝑒 → 𝑟, 𝑔 → 𝑥, 𝑖 → 𝑧,
𝑏 → 𝑣, 𝑑 → 𝑦, 𝑓 → 𝑤, ℎ → 𝑡, 𝑗 → 𝑠
gives an isomorphism.

Hints to arrive at isomorphism:


• First of all check no. of vertices and edges are same for both the graphs.
• Second check that no. of vertices of certain degrees are same in both the graph.
• If either of the above is not satisfied you can straight away say that graphs are not isomorphic.
• If first two are satisfied, now try to find isomorphism by using paths and cycle.
• In graph (a) the edges {a, f}, {f, i}, {i, d}, {d, e}, and {e, a} constitute a cycle of length 5. Hence, we must preserve this as we try to
find an isomorphism. One possibility for the corresponding edges in graph (b) is {q, w}, {w, z}, {z, y}, {y, r}, and {r, q}, which also
provides a cycle of length 5.
• Also, for the path a → f → h → c → b → g → j → e → d → i , the graph (a), there must be a corresponding path in graph (b).
Here the path described by q → w → t → u → v → x → s → r → y → z is the counterpart.

Dr. Manushi Gupta


Are these graphs
isomorphic?

If we try to construct an isomorphism between these graphs, we should


associate vertex a with a comparable vertex in graph (b), say vertex u. A
similar situation exists for vertex d and either vertex x or vertex z. But no
matter which of the vertices x or z we use, there remains one vertex in graph
(b) that is adjacent to two other vertices. And there is no other such vertex in
graph (a) to continue our one-to-one structure preserving correspondence.
Consequently, these graphs are not isomorphic.

Dr. Manushi Gupta


More on degrees

Quickly tell degrees of each!

h is called pendant vertex as has


degree 1.

Theorem: If is an undirected graph or multigraph, then ∈

Corollary: For any undirected graph or multigraph, the number of vertices of odd
degree must be even.

Dr. Manushi Gupta


An undirected graph (or multigraph) where each vertex has the same degree is
called a regular graph. If for all vertices , then the graph is called
-regular.

Every complete graph is an ………regular graph.

Is it possible to have a 4-
regular graph with 10 edges?
Is it possible to have a 4-
regular graph with 15 edges?

Draw the 4-regular graph with 5 vertices!

Dr. Manushi Gupta


Check whether these two are isomorphic or not.

Dr. Manushi Gupta


Dr. Manushi Gupta
Eulerian Circuit

Let be an undirected graph or multigraph with no isolated vertices. Then is


said to have an Euler circuit if there is a circuit in that traverses every edge of the graph
exactly once.
If there is an open trail from to in and this trail traverses each edge in G exactly once,
the trail is called an Euler trail.
A graph possessing an Eulerian circuit is known as Eulerian graph.

Let be an undirected graph or multigraph


Theorem with no isolated vertices. Then has an Euler circuit if
and only if is connected and every vertex in has
even degree.

Dr. Manushi Gupta


If some vertex of a graph has odd degree, then the graph does not have an Euler circuit

Corollary: If G is an undirected graph or multigraph with no isolated vertices, then we can construct
an Euler trail in G if and only if G is connected and has exactly two vertices of odd degree.

Does the following graph have an Euler circuit?

n odd, n=2

Dr. Manushi Gupta


The floor plan shown below is for a house that is open for public viewing. Is it possible to find a
trail that starts in room A, ends in room B, and passes through every interior doorway of the house
exactly once? If so, find such a trail.

Dr. Manushi Gupta


Let 𝐺 = (𝑉, 𝐸) be a directed graph or multigraph. For each 𝑣 ∈ 𝑉,

a) The incoming, or in, degree of 𝑣 is the number of edges in 𝐺 that are incident into v, and this is denoted by 𝒊𝒅(𝒗).

b) The outgoing, or out, degree of v is the number of edges in 𝐺 that are incident from v, and this is denoted by 𝒐𝒅(𝒗).

For the case where the directed graph or multigraph contains one or more loops, each loop at a given vertex v contributes a count
of 1 to each of 𝑖𝑑(𝑣) and 𝑜𝑑(𝑣).

Let be a directed graph or multigraph with


Theorem no isolated vertices. The graph G has a directed Euler
circuit if and only if G is connected and
for all v V.

Dr. Manushi Gupta


Dr. Manushi Gupta
Hamilton cycle
In 1859 the Irish mathematician Sir William Rowan Hamilton introduced a puzzle in the shape of a dodecahedron. Each vertex
was labeled with the name of a city—London, Paris, Hong Kong, New York, and so on. The problem Hamilton posed was to
start at one city and tour the world by visiting each other city exactly once and returning to the starting city.

One solution is the


circuit
ABCDEFGHIJK
L M N O P Q R S T A.

Hence, we have the following definition made in honor of Hamilton.

Dr. Manushi Gupta


If is a graph or multigraph with , we say that has a Hamilton cycle if
there is a cycle in that contains every vertex in . A Hamilton path is a path (and not a cycle)
in that contains each vertex.

If a graph has a Hamilton cycle then it is connected.

Note that for Eulerian, we use trail and circuit as we don’t to repeat the edge but
for Hamiltonian, we use path and cycle (simple circuit) as we want to cover every
vertex just once.

Dr. Manushi Gupta


Draw a graph for each case:
• It has an Eulerian circuit but not a Hamiltonian cycle.
• It does not have an Eulerian circuit but a Hamiltonian cycle.
• It has both Eulerian circuit and Hamiltonian cycle.
• It has neither Eulerian circuit nor Hamiltonian cycle.

Dr. Manushi Gupta


The number of Hamiltonian cycles in complete graphs with vertices

In a complete graph with 𝑛 vertices, each vertex is connected to every other vertex by an edge. Starting at
any vertex there are 𝑛 − 1 possible choices of vertices to visit next. After that, there are 𝑛 − 2 vertices left
to visit, and so on. Since every vertex is connected to every other vertex, this means there are 𝑛! = 𝑛 ×
(𝑛 − 1) × (𝑛 − 2) × ⋯ × 2 × 1 possible Hamiltonian cycles.

But this number includes repetition. For example, see, 𝐾

Let us know reduce the repetition. First, each of the cycle is counted 𝑛 times: once for each possible starting
point. So, we have to divide by n to get 𝑛!/𝑛, or (𝑛 − 1)!. Then we have still over-counted, because each cycle
has been counted in both directions (think clockwise and counter-clockwise), so we have to divide by 2,
eventually arriving at (𝒏 − 𝟏)!/𝟐.

Dr. Manushi Gupta


Dr. Manushi Gupta
Unlike for Euler circuits, no simple characterization of graphs with Hamiltonian cycles is known. But
there are theorems stating conditions that imply the existence of Hamiltonian cycles.

Let be a loop-free undirected graph with


Ore’s If for all
Theorem nonadjacent then contains a Hamilton
cycle.

Dirac’s Let be a loop-free undirected graph with


Theorem If for all then
contains a Hamilton cycle.

Dr. Manushi Gupta


Note that, converse of Ore’s theorem is not true.

For any two nonadjacent vertices, 𝑢, 𝑣, we have


deg 𝑢 + deg 𝑣 = 4 < 5
But it has a Hamilton cycle.

Dr. Manushi Gupta


We have similar results for Hamilton paths

Let be a loop-free undirected graph with


Theorem If for all
then has a Hamilton path.

Let be a loop-free undirected graph with


Corollary If for all
then contains a Hamilton path.

Dr. Manushi Gupta


A graph is called if with ,
and every edge of is of the form with and If each vertex
in is joined with every vertex in , we have a complete bipartite graph. In this
case, if , the graph is denoted by , .

Dr. Manushi Gupta


Dr. Manushi Gupta
Dr. Manushi Gupta
Dr. Manushi Gupta
The Adjacency Matrix of a Graph

Let be a directed graph with ordered vertices . The adjacency matrix of is the
matrix over the set of nonnegative integers such that
the number of arrows from

Let G be an undirected graph with ordered vertices . The adjacency matrix of is the
matrix over the set of nonnegative integers such that
the number of edges connecting

Find the adjacency matrices for the following directed Find adjacency matrices for the following (undirected)
graphs. graphs.

Dr. Manushi Gupta


Find adjacency matrices for the following:
• 𝐾 , the complete graph on four vertices.
• 𝐾 , , the complete bipartite graph on (2, 3) vertices.

Dr. Manushi Gupta


Theorem: Let G be a graph with connected components 𝐺 , 𝐺 , . . . , 𝐺 . If there are 𝑛 vertices in each connected
component 𝐺 and these vertices are numbered consecutively, then the adjacency matrix of G has the form

where each Ai is the 𝑛 × 𝑛 adjacency matrix of Gi, for every i = 1, 2, . . . , k, and the O’s represent matrices
whose entries are all 0.

Dr. Manushi Gupta


If is a graph with vertices and is the adjacency matrix of , then for each positive
integer n and for all integers i, j= 1, 2, . . . , m, the ij th entry of

𝒏
the number of walks of length from

Dr. Manushi Gupta


TREES
A undirected graph is called a tree if is connected and contains no
cycles.

A trivial tree is a graph that consists of a single vertex.

A graph is called a forest if it is not connected, and each component is a tree.

Dr. Manushi Gupta


Results:

Theorem: A graph is a tree if and only if between every pair of


distinct vertices of , there is a unique path.

Corollary: A graph F is a forest if and only if between every pair of


distinct vertices of , there is atmost one path.

Another version: An undirected graph is a connected if


and only has a spanning tree.

Theorem: In every tree , .


References:
• K. H. Rosen, Discrete Mathematics and its Applications, 7th Ed., Tata
McGraw-Hill, 2007.
• R. P. Grimaldi, Discrete and Combinatorial Mathematics, 5th Edition,
Pearson, 2018.
• S. S. Epp, Discrete mathematics with applications, 5th Edition, Wadsworth
Publ. Co., 2018.
• C. L. Liu, Elements of discrete mathematics", 2nd Edition, Mc Graw Hill,
1985.

You might also like