Professional Documents
Culture Documents
Graphds 190129134129
Graphds 190129134129
MATHEMATICS
,
Graph:
■ Simple graph
■ Null graph
■ Multi graph
■ Directed and Undirected graph
■ Regular graph
■ Cycle graph
■ Complete graph
■ Bipartite graph
■ Complete Bipartite graph
Conti..
■ Null graph
A null graph has no edges.
The null graph of $n$ vertices is
denoted by $N_n$.
■ Multi graph
If in a graph multiple edges between
the same set of vertices are allowed,
it is called Multi graph.
Conti..
■ Simple graph
A graph is called simple graph
if the graph is undirected and does not
contain any loops or multiple edges.
Conti..
■ Complete graph
A graph is called complete graph
if every two vertices pair are joined by
exactly one edge.
Conti..
■ Regular graph
A graph is regular if all the vertices
of the graph have the same degree.
■ Cycle graph
If a graph consists of a single cycle,
it is called cycle graph.
Conti..
■ Bipartite graph
If the vertex-set of a graph G can
be split into two disjoint sets, in such
a way that each edge in the graph joins
a vertex and there are no edges in G that
connect two vertices , then the graph G is
called a bipartite graph.
Conti..
– Use adjacency list, which specifies the vertices that are adjacent to each
vertex of the graph.
Adjacency List:
a c
e d
Solution:
Adjacency Matrix:
c d
Solution:
We order the vertices a, b, c, d. The matrix representing this graph is
0 1 1 1
1 0 1 0
1 1 0 0
1 0 0 0
Graph Isomorphism:
Definition:
– The simple graphs G1 and G2 are isomorphic if there is a one-to-one and onto
function f from V1 to V2 with the property that a and b are adjacent in G1 if and
only if f(a) and f(b) are adjacent in G2, for all a and b in V1. Such a function f is
called an isomorphism.
– Example:
Properties:
u3 u4 v3 v4
G H
– Solution: The function f with f(u1) = v1, f(u2) = v4, f(u3) = v3, f(u4) = v2 is a one-to-one
correspondence between V and W. To see that this correspondence preserves adjacency,
note that adjacent vertices in G are u1 and u2, u1 and u3, u2 and u4, and u3 and u4, and
each of the pairs f(u1) = v1 and f(u2) = v4, f(u1) = v1 and f(u3) = v3, f(u2) = v4 and
f(u3) = v3, and f(u1) = v1 and f(u4) = v2 are adjacent in H.
Example:
■ Example II: How about these two graphs?
a a
b
e e
b
c c d
d
■ Solution: No, they are not isomorphic, because they differ in the degrees
of their vertices.
■ Vertex d in right graph is of degree one, but there is no such vertex in the
left graph.
Connected Graph:
■ Leonhard Euler, first graph theory father, said in order to solve this puzzle I want
the degree of every vertex must be even but here you see the degree of every
vertex is odd, hence I proved there exists no solution for this graph and hence I
solved the problem.
Euler path:
■ An Euler path is a path that uses every edge of a graph exactly once.
■ Vertex can be repeated but edge can’t.
■ An Euler path starts and ends at
different vertices.
■ Graph contain 2 vertices with odd degree.
Euler circuit:
■ An Euler circuit is a circuit that uses every edge of a graph exactly once.
■ An Euler circuit starts and ends at the same vertex.
Euler graph:
.
Hamilton cycle or circuit
A cycle that visit each vertex exactly once except for the vertex that start and end
both, which is visit twice.
Hamilton path and circuit
■ circuit.
■ If the articulation point exist in the graph Hamiltonian cycle not exist.
■ If the graph have pendent vertices in the graph Hamiltonian cycle not exist
What is a Path ?
■ A path is a sequence of edges that begins at a vertex, and travels
from vertex to vertex along edges of the graph. The number of
edges on the path is called the length of the path.
■ Ex :
■ Consider the graph on the right. w x y z x
corresponds
w x
y z
Conti..
w x
Connected Disconnected
SHORTEST
PATH
PROBLEM
SHORTEST PATH
PROBLEM :
The shortest path problem is the problem of finding
a path between two vertices in a graph such that
the sum of the weights of its constituent edges is
minimized.
SHORTEST PATH PROBLEM:
2 23 3
9
s
18
2 6 Cost of path s-2-3-5-t
14 6 = 9 + 23 + 2 + 16
30
11
4
19
= 48.
5
5
15 6
20
16
t
7 44
DIJKSTRA’S ALGORITHM:
Works when all of the weights are positive.
Provides the shortest paths from a source to
all other vertices in the graph.
Can be terminated early once the shortest
path to t is found if desired.
EXAMPL
E : vertex 1 and update its neighbours,
Visit
marking it as visited
the shortest paths to 2, 4, and 5 are
updated
EXAMPL
EThe
: next vertex we visit is vertex 4
vertex 5 1 + 11 ≥ 8 don’t update
vertex 7 1+ 9<∞ update
vertex 8 1+ 8<∞ update
EXAMPL
ENext,
: visit vertex 2
vertex 3 4+1<∞ update
vertex 4 already
visited
vertex 5 4+6≥8 don’t update
vertex 6 4+1<∞ update
EXAMPL
ENext,
: we have a choice of either 3 or 6
We will choose to visit 3
vertex 5 5+2<8 update
vertex 6 5+5≥5 don’t update
EXAMPL
E:We then visit 6