0% found this document useful (0 votes)
46 views15 pages

Introduction To Graph Theory

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

Introduction To Graph Theory

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

Lecture 3.1.

Introduction to Graph Theory

Course outcome to be covered:

CO3: Apply and recognized about the Graph Theory

1.1 Topic Objectives:

 To understand and apply the fundamental concepts in graph theory

 To apply graph theory based tools in solving practical problems.

1.2 Introduction:

In the domain of mathematics and computer science, graph theory is the study of graphs that
concerns with the relationship among edges and vertices. It is a popular subject having its
applications in computer science, information technology, biosciences, mathematics, and
linguistics to name a few.

Definition of Graph
 A graph is a pictorial representation of a set of objects where some pairs of objects are
connected by links. The interconnected objects are represented by points termed
as vertices, and the links that connect the vertices are called edges.
 Formally, a graph is a pair of sets (V, E), where V is the set of vertices and E is the set of
edges, connecting the pairs of vertices. Take a look at the following graph −
In the above graph,
V = {a, b, c, d, e}
E = {ab, ac, bd, cd, de}

Directed Graph
A directed graph is a graph in which the edges are directed by arrows.

Directed graph is also known as digraphs.

Example:

In the above graph, each edge is directed by the arrow. A directed edge has an arrow from A to
B, means A is related to B, but B is not related to A.

Undirected Graph
An undirected graph is a graph whose edges are not directed.
Example

In the above graph since there is no directed edges, therefore it is an undirected graph.

Weighted Graph
A weighted graph is a graph whose edges have been labeled with some weights or numbers.

The length of a path in a weighted graph is the sum of the weights of all the edges in the path.

Example

In the above graph, if path is a -> b -> c -> d -> e -> g then the length of the path is 5 + 4 + 5 + 6
+ 5 = 25.

Degree of a Vertex:
The degree of a vertex is the number of edges incident on a vertex v. The self-loop is counted
twice. The degree of a vertex is denoted by d (v)

Example1: Consider the graph G shown in fig. Determine the degree of each vertex.
Solution: The degree of each vertex is as follows:

d(a)=3; d(b)=5; d(c) = 2; d(d)=2.

Example2 : Verify that the sum of the degrees of all the vertices is even for the graph shown in
fig:

Solution: The sum of the degrees of all the vertices is:


=d (v1)+d(v2 )+d(v3 )+d(v4 )+d(v5 )+d(v6 )+d(v7 )+d(v8)
= 2+3+3+3+3+4+2+2=22, which is even.

Path:
A path of length n is a sequence of n+1 vertices of a graph in which each pair of vertices is an
edge of the graph.

1. A Simple Path: The path is called simple one if no edge is repeated in the path, i.e., all
the vertices are distinct except that first vertex equal to the last vertex.
2. An Elementary Path: The path is called elementary one if no vertex is repeated in the
path, i.e., all the vertices are distinct.
3. Circuit or Closed Path: The circuit or closed path is a path in which starts and ends at
the same vertex, i.e., v0=vn.
4. Simple Circuit Path: The simple circuit is a simple path which is a circuit.

Example: Consider the graph shown in fig: Give an example of the following:

1. A simple path fromV1 to V6.


2. An elementary path from V1 to V6.
3. A simple path which is not elementary from V1 to V6.
4. A path which is not simple and starting fromV2.
5. A simple circuit starting from V1
6. A circuit which is not simple and starting from V2.
Solution:

1. A simple path fromV1 to V6.


V1, V2, V3, V4, V5, V6.
2. An elementary path from V1 to V6.
V1, V2, V3, V5, V4, V6.
3. A simple path which is not elementary from V1 to V6.
V1, V2, V3, V5, V2, V4, V 6.
4. A path which is not simple and starting fromV2.
V2, V3, V4, V5,V3,V4,V6.
5. A simple circuit starting fromV1.
V1,V2,V4,V6,V5,V3,V1
6. A circuit which is not simple and starting from V2.
V2, V3, V1 , V2,V5,V4,V2.

Pendant Vertex:
A vertex with degree one is called a Pendant Vertex.

Pendant Edge:
The only edge which is an incident with a pendant vertex is called the Pendant Edge.

Odd Vertex:
A vertex having degree odd is called an odd vertex.

Even Vertex:
A vertex having a degree even is called an even vertex.

Incident Edge:
An edge is called incident with the vertices is connects.

Adjacent Vertices:
Two vertices are called adjacent if an edge links them. If there is an edge (u, v), then we can say
vertex u is adjacent to vertex v, and vertex v is adjacent to vertex u.

Example: Consider the graph as shown in fig:

Determine the following:


1. Pendant Vertices
2. Pendant Edges
3. Odd vertices
4. Even Vertices
5. Incident Edges
6. Adjacent Vertices

Solution:

1. The vertex V5 is the pendant vertex.


2. The edge (V4, V5) or e5 is the pendant edge.
3. The vertices V3 and V5 are odd vertices.
4. The vertices V1, V2, and V4 are even vertices.
5. The edge e1 is an incident on V1, and V2.
The edge e2 is an incident on V1 and V3.
The edge e3 is an incident on V2 and V3.
The edge e4 is an incident on V3 and V4.
The edge e5 is an incident on V4 and V5.
6. The vertex V1 is adjacent to V2 and V3.
The vertex V2 is adjacent to V1 and V2.
The vertex V3 is adjacent to V1 and V4
The vertex V4 is adjacent to V3 and V5
The vertex V5 is adjacent to V4.

Self-Loop:
A self-loop is an edge e if it has the same endpoint.

The graph shown in fig contains the self-loop at vertex b, i.e., e=(b, b).

Isolated Vertex:
A vertex with degree 0 is called Isolated Vertex.
Handshaking Theorem:
Statement: The sum of degrees of the vertices of a graph is twice the number of edges.

If G = (V,E) be a graph with E edges, then

Σ deg G(V) = 2E

Proof: Since the degree of a vertex is the number of edges incident with that vertex, the sum of
degree counts the total number of times an edge is incident with a vertex.

Since every edge is incident with exactly two vertices , each edge gets counted twice, once at
each end.

Thus the sum of the degrees is equal twice the number of edges.

Remark:

This theorem applies even if multiple edges and loops are present. The theorem holds this rule
that if several people shake hands, the total number of hands shake must be even that is why
the theorem is called handshaking theorem.

Corollary: In a graph, the total number of odd degree vertices is even.

Example:
A simple graph G has 24 edges and degree of each vertex is 4. Find the number of vertices.

Solution:

Given
Number of edges = 24
Degree of each vertex = 4

Let number of vertices in the graph = n.


Using Handshaking Theorem, we have-
Sum of degree of all vertices = 2 x Number of edges

Substituting the values, we get- n*4=2*24


n=12
Thus the number of vertices in the graph=12

Graph Representations
In graph theory, a graph representation is a technique to store graph into the memory of
computer.

To represent a graph, we just need the set of vertices, and for each vertex the neighbors of the
vertex (vertices which is directly connected to it by an edge). If it is a weighted graph, then the
weight will be associated with each edge.

There are different ways to optimally represent a graph, depending on the density of its edges,
type of operations to be performed and ease of use.

1. Adjacency Matrix
o Adjacency matrix is a sequential representation.
o It is used to represent which nodes are adjacent to each other. i.e. is there any edge
connecting nodes to a graph.
o In this representation, we have to construct a nXn matrix A. If there is any edge from a
vertex i to vertex j, then the corresponding element of A, ai,j = 1, otherwise ai,j= 0.

o If there is any weighted graph then instead of 1s and 0s, we can store the weight of the
edge.
Example

Consider the following undirected graph representation:

Undirected graph representation

Directed graph representation

See the directed graph representation:

In the above examples, 1 represents an edge from row vertex to column vertex, and 0 represents
no edge from row vertex to column vertex.

Undirected weighted graph representation


Pros: Representation is easier to implement and follow.

Cons: It takes a lot of space and time to visit all the neighbors of a vertex, we have to traverse all
the vertices in the graph, which takes quite some time.

2. Incidence Matrix
In Incidence matrix representation, graph can be represented using a matrix of size:

Total number of vertices by total number of edges.

It means if a graph has 4 vertices and 6 edges, then it can be represented using a matrix of 4X6
class. In this matrix, columns represent edges and rows represent vertices.

This matrix is filled with either 0 or 1 or -1. Where,

o 0 is used to represent row edge which is not connected to column vertex.


o 1 is used to represent row edge which is connected as outgoing edge to column vertex.
o -1 is used to represent row edge which is connected as incoming edge to column vertex.

Example

Consider the following directed graph representation.


3. Adjacency List
o Adjacency list is a linked representation.
o In this representation, for each vertex in the graph, we maintain the list of its neighbors. It
means, every vertex of the graph contains list of its adjacent vertices.
o We have an array of vertices which is indexed by the vertex number and for each vertex
v, the corresponding array element points to a singly linked list of neighbors of v.

Some Areas of Application


Graph Theory is used in vast area of science and technologies. Some of them are given below:
Computer Science

In computer science graph theory is used for the study of algorithms like:

o Dijkstra's Algorithm
o Prims's Algorithm
o Kruskal's Algorithm

o Graphs are used to define the flow of computation.


o Graphs are used to represent networks of communication.
o Graphs are used to represent data organization.
o Graph transformation systems work on rule-based in-memory manipulation of graphs.
Graph databases ensure transaction-safe, persistent storing and querying of graph
structured data.
o Graph theory is used to find shortest path in road or a network.
o In Google Maps, various locations are represented as vertices or nodes and the roads are
represented as edges and graph theory is used to find the shortest path between two
nodes.

Practice Questions
1. In any graph, the number of vertices of odd degree is even.
2. Determine number of edges in a graph with 5 nodes, 2 of degree 3 and 3 of degree 2

FAQ
Q.1 What is the purpose of graph theory?

Ans: In mathematics, graph theory is the study of graphs, which are mathematical structures
used to model pairwise relations between objects. A graph in this context is made up of vertices
(also called nodes or points) which are connected by edges (also called links or lines).

Q.2 Who is the father of graph theory?

Ans: Eulerian refers to the Swiss mathematician Leonhard Euler, who invented graph theory in
the 18th century.

Summary
In this lecture, we have discussed about

 Introduction to Graph
 Various properties in graph
 Handshaking theorem
 Representation of graph

REFERENCES

Books

[1] Elements of Discrete Mathematics, (Second Edition) C. L. Liu, McGraw Hill, New Delhi,
2017

[2] G. Ronald, Knuth, Donald and Patashik Oren, concrete Mathematics: A Foundation for
Computer Science", Addison-Wesley.

Websites
[1] https://www.tutorialspoint.com/graph_theory/graph_theory_fundamentals.htm

[2] https://www.javatpoint.com/introduction-of-graphs

Courses

[1] https://www.coursera.org/specializations/discrete-mathematics
[2] https://www.classcentral.com/course/swayam-discrete-mathematics-12929

Video Links

[1] https://www.youtube.com/watch?v=gbPFyGP_EzU

[2] https://www.youtube.com/watch?v=HkNdNpKUByM

You might also like