A Graph is a data structure consisting of vertices and edges. the theory associated with graph is called graph theory.
It can be used to solve many problems such as Planning routes for goods or services delivery, finding the shortest path, finding number of colours needed to colour the regions of a map and so on.
Graph is a data structure that consists of following two components:
1. A finite set of vertices also called as nodes.
2. A finite set of ordered pair of the form (u, v) called as edge. The pair is ordered because (u, v) is not same as (v, u) in case of directed graph(di-graph). The pair of form (u, v) indicates that there is an edge from vertex u to vertex v. The edges may contain weight/value/cost.
Types of graph: