Graph Theory Paths and Cycle
Graph Theory Paths and Cycle
A node or a vertex
An edge E or ordered pair is a connection
between two nodes u,v that is identified by
unique pair(u,v). The pair (u,v) is ordered
because (u,v) is not same as (v,u) in case of
directed graph.The edge may have a weight or
is set to one in case of unweighted graph.
Sample Graph
Characteristics of graphs
1
Types of graphs
Directed graph:
A graph in which the direction of the edge is defined to a particular node
is a directed graph
a. Directed Acyclic graph: It is a directed graph with no cycle.For a vertex ‘v’
in DAG there is no directed edge starting and ending with vertex ‘v’.
Undirected graph
A graph in which the direction of the edge is not defined.So if an edge
exists between node ‘u’ and ‘v’,then there is a path from node ‘u’
to ‘v’ and vice versa.
a. Connected graph: A graph is connected when there is a path between
every pair of vertices.
B. Biconnected graph: A connected graph which cannot be broken down
into any further pieces by deletion of any.
C. Complete graph: A graph in which each pair of graph vertices is
connected by an edge.In other words,every node ‘u’ is adjacent to every
other node ‘v’ in graph ‘G’.A complete graph would have n(n-1)/2
edges.
For example
A. N𝑜𝑑𝑒𝑠 = 5
𝑛(𝑛 − 1)
𝐸=
2
5(5−1)
𝐸= 2
5(4)
𝐸= 2
20
𝐸= 2
𝐸 = 10 𝑒𝑑𝑔𝑒𝑠
B. N𝑜𝑑𝑒𝑠 = 10
𝑛(𝑛 − 1)
𝐸=
2
10(10−1)
𝐸= 2
10(9)
𝐸= 2
90
𝐸= 2
𝐸 = 45 𝑒𝑑𝑔𝑒𝑠
C. N𝑜𝑑𝑒𝑠 = 13
𝑛(𝑛 − 1)
𝐸=
2
13(13−1)
𝐸= 2
13(12)
𝐸= 2
156
𝐸= 2
𝐸 = 78 𝑒𝑑𝑔𝑒𝑠
Applications