0% found this document useful (0 votes)
100 views26 pages

FAL (2022-23) MAT1003 TH AP2022232000323 Reference Material I 09-Dec-2022 Module 6 Lecture

The document discusses graphs and paths in graphs. It defines what a path is in a graph, including simple paths, circuits, and walks. It also defines connectivity in graphs and discusses determining whether two graphs are isomorphic based on the existence of certain paths or circuits. The document presents theorems about counting the number of paths between vertices using the adjacency matrix and finding the shortest path between vertices in a weighted graph.

Uploaded by

Nithin Shankar
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)
100 views26 pages

FAL (2022-23) MAT1003 TH AP2022232000323 Reference Material I 09-Dec-2022 Module 6 Lecture

The document discusses graphs and paths in graphs. It defines what a path is in a graph, including simple paths, circuits, and walks. It also defines connectivity in graphs and discusses determining whether two graphs are isomorphic based on the existence of certain paths or circuits. The document presents theorems about counting the number of paths between vertices using the adjacency matrix and finding the shortest path between vertices in a weighted graph.

Uploaded by

Nithin Shankar
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/ 26

Isomorphism of Graphs

Example Determine whether the graphs shown in Figure are isomorphic.

DMS (MAT1003) Dr. Nikunja 5/3


Paths
Definition: 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 has,
for i = 1, …, n, the endpoints xi-1 and xi.
 When the graph is simple, we denote this path by its vertex sequence
x0, x1, … , xn(since listing the vertices uniquely determines the path).
 The path is a circuit if it begins and ends at the same vertex (u = v) and
has length greater than zero.
 The path or circuit is said to pass through the vertices x1, x2, … , xn-1
and traverse the edges e1, … , en.
 A path or circuit is simple if it does not contain the same edge more
than once.

This terminology is readily extended


to directed graphs. (see text)
Connectivity
Note: In some books, the term walk is used instead of path, where 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 endpoints of ei
for i = 1, 2, . . . , n. When this terminology is used, closed walk is used
instead of circuit to indicate a walk that begins and ends at the same
vertex, and trail is used to denote a walk that has no repeated edge
(replacing the term simple path).

DMS (MAT1003) Dr. Nikunja 7/3


Connectivity
Note: In some books, the term walk is used instead of path, where 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 endpoints of ei
for i = 1, 2, . . . , n. When this terminology is used, closed walk is used
instead of circuit to indicate a walk that begins and ends at the same
vertex, and trail is used to denote a walk that has no repeated edge
(replacing the term simple path).
Example In the simple graph shown in Figure,
a, d, c, f, e is a simple path of length 4. However,
d, e, c, a is not a path. Note that b, c, f, e, b is a circuit
of length 4 because {b, c}, {c, f }, {f, e}, and {e, b} are
edges, and this path begins and ends at b. The path
a, b, e, d, a, b, which is of length 5, is not simple because
it contains the edge {a, b} twice.
DMS (MAT1003) Dr. Nikunja 7/3
Connectedness in Undirected Graphs
Definition
Let n be a nonnegative integer and G 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.

DMS (MAT1003) Dr. Nikunja 8/3


Connectedness in Undirected Graphs
Definition
Let n be a nonnegative integer and G 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.

Definition
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. We say that we disconnect a graph when
we remove vertices or edges, or both, to produce a disconnected subgraph.
DMS (MAT1003) Dr. Nikunja 8/3
Connectedness in Undirected Graphs

Example
The graph G1 in the Figure is connected,
because for every pair of distinct vertices
there is a path between them. However,
the graph G2 is not connected. For
instance, there is no path in G2 between
vertices a and d.

DMS (MAT1003) Dr. Nikunja 9/3


Connectedness in Undirected Graphs

Example
The graph G1 in the Figure is connected,
because for every pair of distinct vertices
there is a path between them. However,
the graph G2 is not connected. For
instance, there is no path in G2 between
vertices a and d.
Theorem
There is a simple path between every pair of distinct vertices of a
connected undirected graph.

DMS (MAT1003) Dr. Nikunja 9/3


Connectedness in Undirected Graphs

Example
The graph G1 in the Figure is connected,
because for every pair of distinct vertices
there is a path between them. However,
the graph G2 is not connected. For
instance, there is no path in G2 between
vertices a and d.
Theorem
There is a simple path between every pair of distinct vertices of a
connected undirected graph.

Note: Paths and circuits can help determine whether two graphs are
isomorphic.

DMS (MAT1003) Dr. Nikunja 9/3


Connectedness in Undirected Graphs
Example Determine whether the graphs G and H shown in the Figure are
isomorphic.

DMS (MAT1003) Dr. Nikunja 10 / 3


Connectedness in Undirected Graphs
Example Determine whether the graphs G and H shown in the Figure are
isomorphic.
Answer H has a simple circuit of length
three, namely, v1 , v2 , v6 , v1 , whereas G has
no simple circuit of length three. Because
the existence of a simple circuit of length
three is an isomorphic invariant, G and H
are not isomorphic.

DMS (MAT1003) Dr. Nikunja 10 / 3


Connectedness in Undirected Graphs
Example Determine whether the graphs G and H shown in the Figure are
isomorphic.
Answer H has a simple circuit of length
three, namely, v1 , v2 , v6 , v1 , whereas G has
no simple circuit of length three. Because
the existence of a simple circuit of length
three is an isomorphic invariant, G and H
are not isomorphic.
Example Determine whether the graphs G and H shown in the Figure are
isomorphic.

DMS (MAT1003) Dr. Nikunja 10 / 3


Connectedness in Undirected Graphs
Example Determine whether the graphs G and H shown in the Figure are
isomorphic.
Answer H has a simple circuit of length
three, namely, v1 , v2 , v6 , v1 , whereas G has
no simple circuit of length three. Because
the existence of a simple circuit of length
three is an isomorphic invariant, G and H
are not isomorphic.
Example Determine whether the graphs G and H shown in the Figure are
isomorphic.

Answer Yes.
DMS (MAT1003) Dr. Nikunja 10 / 3
Counting Paths Between Vertices

Theorem
Let G be a graph with adjacency matrix A with respect to the ordering
v1 , v2 , . . . , vn of the vertices of the graph (with directed or undirected
edges, with multiple edges and loops allowed). The number of different
paths of length r from vi to vj , where r is a positive integer, equals the
(i, j)th entry of Ar .

DMS (MAT1003) Dr. Nikunja 11 / 3


Counting Paths Between Vertices

Theorem
Let G be a graph with adjacency matrix A with respect to the ordering
v1 , v2 , . . . , vn of the vertices of the graph (with directed or undirected
edges, with multiple edges and loops allowed). The number of different
paths of length r from vi to vj , where r is a positive integer, equals the
(i, j)th entry of Ar .

Example How many paths of length four are there from a to d in the
simple graph G in the Figure?

DMS (MAT1003) Dr. Nikunja 11 / 3


Counting Paths Between Vertices

Theorem
Let G be a graph with adjacency matrix A with respect to the ordering
v1 , v2 , . . . , vn of the vertices of the graph (with directed or undirected
edges, with multiple edges and loops allowed). The number of different
paths of length r from vi to vj , where r is a positive integer, equals the
(i, j)th entry of Ar .

Example How many paths of length four are there from a to d in the
simple graph G in the Figure?

Answer

a, b, a, b, d; a, b, a, c, d; a, b, d, b, d; a, b, d, c, d; a, c, a, b, d; a, c, a, c, d; a, c, d, b, d;
and a, c, d, c, d are the eight paths of length four from a to d.
DMS (MAT1003) Dr. Nikunja 11 / 3
Shortest-Path Problems

Example What is the length of a shortest path between a and z in the


weighted graph shown in the Figure?

DMS (MAT1003) Dr. Nikunja 12 / 3


Shortest Path problems
The ’shortest-path model’ can be further can be classified into two:
Shotest path between only one pair of nodes in a network.
Shortest path between any pair of nodes in a network.
The shortest path between only one pair of nodes can be formulated using
a Dijkstra’s algorithm.
Dijkstra’s algorithm is designed to determine the shortest routes
between the source node and every other node.
The arcs in the network may be dfined directed or undirected.
Let ui be the shortest distance from source node 1 to node i, and
define dij (≥ 0) as the length of arc(i,j)
Then the algorithm defines the label for an immediately succeeding
node j as
[ui , i] = [ui + dij , i], dij ≥ 0.
Module No. 6: Network Flows Dr. K.M.REDDY 4 / 43
The label for the starting node is [0, −], indicating that the node has
no predecessor.
Node labels in Dijkstra’s algorithm are of two types:
Temporary
Permanent
.
A temporary label is modified if a shorter route to a node can be
found.
If no better route can be found, the staus of the temporary label is
changed to permanent.

Module No. 6: Network Flows Dr. K.M.REDDY 5 / 43


Dijkstra’s algorithm

1 Step 0 Label the source node (node 1) with the permanent label
[0, −]. Set i=1.
2 Step i.
1 Compute the temporary labels [ui + dij , i] for each node j that can be
reached from node i, provided j is not permanently labeled.
If node j is already labeled with [uj , k] through another node k and if
ui + dij < uj , replace [uj , k] with [ui + dij , i].
2 If all the nodes permanent labels, stop. Otherwise, select the label
[ur , s] having the shortest distance (= ur ) among all the temporary
labels(break ties arbitrarily). Set i = r and repeat step i.

Module No. 6: Network Flows Dr. K.M.REDDY 6 / 43


Shortest-Path Problems

Example What is the length of a shortest path between a and z in the


weighted graph shown in the Figure?

There are several different algorithms that find a shortest path between
two vertices in a weighted graph. We will present a greedy algorithm
discovered by the Dutch mathematician Edsger Dijkstra in 1959. The
version we will describe solves this problem in undirected weighted graphs
where all the weights are positive.

DMS (MAT1003) Dr. Nikunja 12 / 3


Shortest-Path Problems: Dijkstra’s Algorithm
Example Use Dijkstra’s algorithm to find the length of a shortest path
between the vertices a and z in the weighted graph displayed in the Figure.

DMS (MAT1003) Dr. Nikunja 14 / 3


Shortest-Path Problems: Dijkstra’s Algorithm
Example Use Dijkstra’s algorithm to find the length of a shortest path
between the vertices a and z in the weighted graph displayed in the Figure.

DMS (MAT1003) Dr. Nikunja 14 / 3


Shortest-Path Problems: Dijkstra’s Algorithm
Example Use Dijkstra’s algorithm to find the length of a shortest path
between the vertices a and z in the weighted graph displayed in the Figure.

Example Use Dijkstra’s algorithm to find the length of a shortest path


between the vertices a and z in the weighted graph displayed in the Figure.

DMS (MAT1003) Dr. Nikunja 14 / 3


Shortest-Path Problems: Dijkstra’s Algorithm
Example Use Dijkstra’s algorithm to find the length of a shortest path
between the vertices a and z in the weighted graph displayed in the Figure.

Example Use Dijkstra’s algorithm to find the length of a shortest path


between the vertices a and z in the weighted graph displayed in the Figure.

Theorem
Dijkstra’s algorithm finds the length of a shortest path between two
vertices in a connected simple undirected weighted graph.
DMS (MAT1003) Dr. Nikunja 14 / 3
Planar Graphs
Consider the problem of joining three houses to each of three separate
utilities, as shown in the Figure. Is it possible to join these houses and
utilities so that none of the connections cross?

DMS (MAT1003) Dr. Nikunja 15 / 3

You might also like