0% found this document useful (0 votes)
38 views28 pages

Graph Theory 1

Uploaded by

Ahmad Graphics
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)
38 views28 pages

Graph Theory 1

Uploaded by

Ahmad Graphics
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/ 28

Graph

Theory
M. ZEESHAN KHAN
Graph
A graph is a pictorial and mathematical 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 or nodes and the links
that connect the vertices are called edges or arcs or lines.
In other words, a graph is an ordered pair G = (V, E) where,
•G specifies the graph.
•V is the vertex-set whose elements are called the vertices, or nodes of the graph. This set is often
denoted by V(G) or just V.
•E is the edge-set whose elements are called the edges, or connections between vertices of the
graph. This set is often denoted by E(G) or just E.
In the above graph,
V = {A, B, C, D, E}
E = {AB, BC, CA, AD}
Graph Theory

Graph theory is the sub-field of mathematics and computer science which


deals with graphs, diagrams that contain points and lines and which often
pictorially represents mathematical truths.
In short, graph theory is the study of the relationship between edges and
vertices.
Fundamental
Concept
A point is a particuar position that is
located in a space. Space can be one-
dimensional, two-dimensional or three-
dimensional space. A dot is used to
represent a point in graph and it is labeled
1.Point by alphabet, numbers or alphanumeric
values.
Example
p
Here, dot is a point labeled by 'p’.
Two points are connected to each other through
a line. A line is a connection between two points. It is
represented by a solid line.

2.Line Here, 'A' and 'B' are the points and links between two
points is called a line.
A vertex is a synonym of point in graph i.e. one of
the points on which the graph is defined and which
may be connected by lines/edges is called a vertex.

Vertex is also called "node", "point" or "junction". A


vertex is denoted by alphabets, numbers or
3. Vertex alphanumeric value.
Example
v
Here, point is the vertex labeled with an alphabet 'v'.
Edge is the connection between two vertices. Each edge connects
one vertex to another vertex in the graph. Without a vertex, an
edge cannot be formed. It is also called line, branch, link or arc.
Edge can either be directed or undirected. A directed edge is the
edge which points from one vertex to another, and an undirected
edge has no direction.
If there is a directed edge from vertex A to B, and a directed edge
from B to A, this would essentially be equivalent to an undirected
edge connecting A and B.
4. Edge

Here, 'A' and 'B' are the vertices and the link 'AB' between them
is called an edge.
Graph specifies to a "function graph" or "graph of a function"
i.e. a plot.

In mathematics terminology, a graph is a collection of points


and lines connecting some (possibly empty) subset of them.

A graph G is defined as G = {V, E} where V is a set of all


vertices or points and E is the set of all edges in the graph.

5. Graph

In the above example, A, B, C, D and E are the vertices of the


graph and AB, BC, CA and AD are the edges of the graph.
Example 2

In the above example, G1, G2 and G3 are graphs.


Types of
Graphs
Though, there are a lot of different types of graphs depending upon the
number of vertices, number of edges, interconnectivity, and their overall
structure, some of such common types of graphs are as follows:
A null graph is a graph in which there are no edges
between its vertices. A null graph is also called empty graph.

Example:

1. Null Graph

A null graph with n vertices is denoted by Nn


A trivial graph is the graph which has only one vertex.

Example:

2. Trivial v

Graph
In the above graph, there is only one vertex 'v' without any
edge. Therefore, it is a trivial graph.
A simple graph is the undirected graph with no parallel
edges and no loops.
A simple graph which has n vertices, the degree of every vertex is
at most n -1.

3. Simple
Graph
In the above example, First graph is not a simple graph because it
has two edges between the vertices A and B and it also has a
loop.
Second graph is a simple graph because it does not contain any
loop and parallel edges.
An undirected graph is a graph whose edges are not
directed.

Example

4. Undirected
Graph

In the above graph since there is no directed edges, therefore


it is an undirected graph.
A directed graph is a graph in which the edges are
directed by arrows.
Directed graph is also known as digraphs.
Example

5. Directed Graph

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.
A graph in which every pair of vertices is joined by exactly one
edge is called complete graph. It contains all possible edges.
A complete graph with n vertices contains exactly nC2 edges
and is represented by Kn.
Example

6. Complete Graph

In the above example, since each vertex in the graph is


connected with all the remaining vertices through exactly one
edge therefore, both graphs are complete graph.
A connected graph is a graph in which we can visit from any
one vertex to any other vertex. In a connected graph, at least
one edge or path exists between every pair of
vertices.Example

7. Connected
Graph

In the above example, we can traverse from any one vertex to


any other vertex. It means there exists at least one path
between every pair of vertices therefore, it a connected graph.
A disconnected graph is a graph in which any path does not
exist between every pair of vertices.

Example:

8. Disconnected
Graph
The above graph consists of two independent components
which are disconnected. Since it is not possible to visit from the
vertices of one component to the vertices of other components
therefore, it is a disconnected graph.
A Regular graph is a graph in which degree of all the vertices
is same.

If the degree of all the vertices is k, then it is called k-regular


graph.

Example:

9. Rigular Graph

In the above example, all the vertices have degree 2. Therefore


they are called 2- Regular graph.
A graph with 'n' vertices (where, n>=3) and 'n' edges forming a
cycle of 'n' with all its edges is known as cycle graph.

A graph containing at least one cycle in it is known as a cyclic


graph.

In the cycle graph, degree of each vertex is 2.

The cycle graph which has n vertices is denoted by Cn.

10. Cyclic Graph Example:

In the above example, all the vertices have degree 2. Therefore


they all are cyclic graphs.
A bipartite graph is a graph in which the vertex set can be
partitioned into two sets such that edges only go between sets,
not within them.

A graph G (V, E) is called bipartite graph if its vertex-set V(G)


can be decomposed into two non-empty disjoint subsets V1(G)
and V2(G) in such a way that each edge e ∈ E(G) has its one
last joint in V1(G) and other last point in V2(G).
11. Bipartite Graph
The partition V = V1 ∪ V2 is known as bipartition of G..
11. Bipartite Graph
Example -1: Example -2:
A complete bipartite graph is a bipartite graph in which each
vertex in the first set is joined to each vertex in the second set
by exactly one edge.

A complete bipartite graph is a bipartite graph which is


complete.

Example:
12. Complete Bipartite
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:

13. Weighted Graph

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.
A graph in which there are multiple edges between any pair of
vertices or there are edges from a vertex to itself (loop) is
called a multi – graph.

Example:

14. Multi Graph

In the above graph, vertex-set B and C are connected with two


edges. Similarly, vertex sets E and F are connected with 3
edges. Therefore, it is a multi graph.
M. Zeeshan Khan
Lecturer-Computer Science
University of Swat

Submit your assignments on [email protected]

Thanks.

You might also like