Lecture 02
Lecture 02
Graph Theory
CS-4207
Lecture – 02
Disclaimer: The Contents of this reader are borrowed from the book(s) mentioned in the
reference section.
Isomorphism
Isomorphism of graph G = (V, E) to a graph H = (W, F) is two bijection: φ from V onto W and
ψ from E to F, so that for e ∈ E and x, y ∈ V, the edge ψ(e) has for endvertices φ(x) and φ(y) in
H if and only if the e has x and y as endvertices in G.
This means that these mappings preserve the incidence relation of the edges and the
vertices.
Two isomorphic graphs are in fact identical in their graph structure.
They have exactly the same properties.
They can only be distinguished by the sets of their elements, vertices and edges, in more
concrete terms, by the names or labels given to these elements.
G1 G2
How can we find that two graphs are Isomorphic, Lets go through step by step activity.
Consider the above two graphs and determine whether they a Isomorphic or not.
1|Page
Atif Ishaq - Lecturer GC University, Lahore
1. No. of Vertices : V(G1)= V(G2) both have same number of vertices that is 3
2. No. of Edges : E(G1)= E(G2) both have same number of edges that is 5
3. Check the degree sequence, it means the outgoing edges from each vertex in both graph
are same or not
4. Map the vertex
x maps to s1
y maps to s3
z maps to s2
5. Validate the mapping by checking that the mapped vertices preserve the mapping.
How can we formally prove that the two graphs are Isomorphic or not?
Considering the above example, first we determined that the number of vertices and edges are
same and then we moved towards the mapping. If the two graphs have a path of same length
then they may be said structurally the same graph. Then formally we write that G1 ≅ G2. As
shown below while mapping vertices (shown in red line), the degree of each vertices that are
mapped must be same.
The two bijection function φ from V onto W set of vertices of G1 and G2 respectively and ψ
from E to F set of edges of G1 and G2 respectively. These functions must satisfy some
properties
No two or more vertices of one graph maps to same vertex of other graph, it means each distinct
vertex must map to distinct vertex. This function φ actually tells us how we can relabel the
vertices of second graph to make it equals to the first graph. This function φ is called injective
function. The second property is that when vertices of two graphs are mapped distinctly then
no vertex should remain unmapped. This property says that the function φ is surjective. If both
2|Page
Atif Ishaq - Lecturer GC University, Lahore
these properties are satisfied, it means that there is one-to-one correspondence between two
graphs. Because of these two properties the function φ is called bijective function.
If two vertices in the G are adjacent then their corresponding vertices in H should also be
adjacent. Similarly if two vertices in G are not adjacent then their corresponding edges in H
should also be not adjacent.
v1v2 ∈V(G) if and only if φ(v1) φ (v2) ∈ V(H)
v1v2 ∉V(G) if and only if φ(v1) φ (v2)∉ V(H)
Here ∈ refers adjacent and ∉ refers not adjacent.
Exercise
Show that the given graphs are Isomorphic or not?
Presentation of Graphs
There are two ways to present a graph the one we have already discussed is graphical, while,
the other way of representation is adjacency matrix and incidence matrix..
Incidence Matrix
In mathematics, an incidence matrix is a logical matrix that shows the relationship between
two classes of objects, usually called an incidence relation. If the first class is X and the
second is Y, the matrix has one row for each element of X and one column for each element of
Y. In this matrix, rows represents vertices and columns represents edges. The matrix is filled
with 0, 1, or -1. Here 0 represents the row edge not connected to column vertex, 1 represents
row edge is connected to outgoing edge to column vertex, and -1 represents row edge is
connected to incoming edge to column vertex.
3|Page
Atif Ishaq - Lecturer GC University, Lahore
e2 v3
e1 e2 e3 e4 e5 e6
v4
v1 1 0 0 0 0 2
e3
v2 1 1 0 1 0 0
v3 0 1 1 0 1 0 e4 e5
v5
v2
v4 0 0 0 0 0 0
v5 0 0 1 1 1 0 e1 e6
v1
= {1 ∈ ,0 ℎ
Consider the following directed graph
Adjacency Matrix
The adjacency matrix, sometimes also called the connection matrix, of a simple labeled graph
is a matrix with rows and columns labeled by graph vertices, with a 1 or 0 in
position ( , ) according to whether and are adjacent or not. For a simple graph with no
self-loops, the adjacency matrix must have 0s on the diagonal.
= {1 ∈ , ℎ 0
4|Page
Atif Ishaq - Lecturer GC University, Lahore
Consider the following directed graph and its corresponding adjacency matrix
5|Page
Atif Ishaq - Lecturer GC University, Lahore
Graphs as Model
When we build a graph model, we use appropriate type of graph to capture the important
features of the application
We illustrate this process using graph models of different types of computer networks. In all
these graph models, the vertices represents data centers and edges represents communication
links.
To model a computer network where we are only connected whether two data centers are
connected by a communication link we use a simple graph. This is the appropriate type of the
graph when we only care whether two data centers are directly linked (and not how many links
there may be) and all communication links works in both directions.
To model a computer network where we care about the number of links between data centers
we use multigraph.
To model a computer network with diagnostic links at data centers, we use a pseudograph, as
loop as needed.
6|Page
Atif Ishaq - Lecturer GC University, Lahore
To model a computer network with multiple one-way links, we use a directed multigraph. Note
that we could use a directed graph without multiple edges if we only care whether there is at
least one link from a data center to another data center.
7|Page
Atif Ishaq - Lecturer GC University, Lahore
Collaboration Graph
It is undirected graph where two people are connected if they collaborate in specific way.
The Hollywood graph models the collaboration of actors in films. We represents actors by
vertices and we connect two vertices if the actor they represents have appeared in the same
movie.
An academic collaboration graph models the collaboration of researchers who jointly
written paper in a particular subject.
We represents researchers in a particular academic discipline using vertices
We connect the vertices representing two researchers in his discipline if they are co-
author of a paper
Influence Graph
It is directed graph where there is an edge from one person to another if the first person can
influence the second person.
8|Page
Atif Ishaq - Lecturer GC University, Lahore
We can use directed graph called precedence graph to represents which statement must have
already been executed before we execute each statement.
In such graphs vertices represents the statements in a computer program, and there is a directed
edge from a vertex to a second vertex if the second vertex cannot be executed before the first
vertex. The below precedence graph shows which statement have already been executed before
we can execute each of the six statements in the program
9|Page
Atif Ishaq - Lecturer GC University, Lahore
Biological Applications
Graph models are used extensively in many areas of the biological science. We will describe
two such models, one to ecology and the other to molecular biology.
Niche overlap graph models competition between species and an ecosystem
Vertices represents the species and an edge connects two vertices when they represents species
which compete for food resources.
Some of the other problems than can be solved using graph theory are
Matching Problem
Stable Marriage Problem
Time Table
Job Assignment Problem
References
1. Douglas B. West, “Introduction to Graph Theory” , Second Edition
2. Jean Claude Fourier, “Graph Theory and Applications with Exercises and Problems”.
3. C. Vasudev, “Graph Theory with Applications”
4. https://mathworld.wolfram.com/
10 | P a g e