A graph is a pictorial 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, and the links that connect the vertices are called edges.
Formally, a graph is a pair of sets(V,E), where V is the set of vertices and E is the set of edges, connection the pairs of vertices.
Graph data structure:
Mathematical graph can be represented by in data structure. We can represent a graph using an array of vertices and a two-dimensional array of edges.
Each node of the graph is represents as a vertex. In the following example, the labeled circle represents vertices.
Edges represents a path between two vertices or a line between two vertices.
Two node or vertices are adjacent if they are connected to each other through an edge.
Path represents a sequence of edges between the two vertices.