Aph Theory
Aph Theory
INTRODUCTION
1.ADJACENT VERTEX:
Two vertices in a graph are said to be adjacent if
there exsists an edge between them.if a graph
contains an edge(v1,v2) then vertex v2 is said to be
adjancent to vertex v1.
2.PATH:
• A path is a sequence of vertices traversed by
following the edges between them.A path is simple if
it has no repeating vertices
• One special type of simple path is called cycle. A cycle
is a simple path consisting of sequence of vertices
such that the starting and ending vertex are same.
• A loop is special case of cycle in which an edge begins
and ends with the same vertex.
• If a graph doesnot contain any cycle then it is called
an acyclic graph.
ACYCLIC GRAPH CYCLIC GRAPH
3.DEGREE OF VERTEX:
• In an undirected graph ,the degree of vertex is the number of
edges originating from it.
• In other words,the number of edges connected with vertex vi
is called the degree of vertex vi. It is denoted by degree (vi )
• For directed graph this term is used as:
• Indegree : is the number of edges entering the vertex.The
indegree of vertex is denoted by indegree(vi )
• Outdegree : is the number of edges leaving the vertex. And
represented by outdegree (vi )
• A vertex is pendent if its indegree is 1 and its outdegree is 0
4.COMPLETE GRAPH:
• A graph is said to be complete if there are edges
from any vertex to all other vertices.
• In such type of graph ,each vertex is adjacent to
every other vertex.
5.CONNECTED GRAPH:
• A undirected graph is said to be connected if every
vertex is reachable from others by following some
path.
• In other words an undirected graph is said to be
connected if each pair of distinct vertices (vi ,vj ) ɛ V
has a path between them.
• If this property holds true for directed graph then it is
called strongly connected graph i.e. a digraph is said
to be strongly connected if for every pair of distinct
vertices (vi ,vj ) there exsist a path from vi to vj that
connect two nodes.
UNCONNECTED GRAPH CONNECTED GRAPH
6.WEIGHTED GRAPH:
• A graph is termed as weighted graph if all the edges
in it are labelled with some weights.
• A weight is the measure of the cost of using an
edge to go from one vertex to another.
• In an unweighted graph where the weight is not
mentioned explicitly ,the cost of traversing an edge
is same for all the edges.
7.MULTIGRAPH:
• It may be possible that there are two or more edges
connecting the same vertices of graph.Such a graph
is called multigraph.
REPRESENTATION OF GRAPHS
• Representation of a graph-There are two main ways
of representing a graph in memory. These are:
• 1)Sequential
• 2)Linked List
1.SEQUENTIAL/MATRIX
REPRESENTATION
• This representation can be used for both directed
and undirected graph.
• The graphs can be represented as matrices in
sequential representation.In this representation a
square matrix of order nxn is used where n is
number of vertices in graph.
• There are two most common matrices. These are:
• Adjacency Matrix
• Incidence Matrix
• The adjacency matrix is a sequence matrix with one
row and one column devoted to each vertex.
• The values of the matrix are 0 or 1.
• A value of 1 for row i and column j implies that
edge eij exists between vi and vj vertices.
• A value of 0 implies that there is no edge between
the vertex vi and vj.
• Thus, for a graph with v1,v2,v3………..vn vertices, the
adjacency matrix A=[aij] of the graph G is the n x n
matrix and can be defined as:
• 1 if vi is adjacent to vj (if there is an edge between v i and vj)
• aij =
•
• 0 if there is no edge between vi and vj
B C
Node Adjacency List
A B,C,D
C
C,E
B
C
C
D
E
www.csemcq.com