RUN

# Graph

Written By -

## What is a graph?

A graph is a pictorial representation of data and values which are represented in an organized manner.

In terms of data structures, a graph is an abstract data type which implements graph theory concepts such as the implementation of directed and undirected graphs.

Graph is a very important concept in data structures. It can be defined as:

• A graph is a non-linear data structure.
• It is a flow structure consisting of nodes and edges.
• It consists of a finite number of vertices and edges which are connected using links.
• A graph is a pair of the set (V, E), where V is the set of vertices or nodes and E is the set of edges, interconnected by lines or edges.
• The edges contain weights or cost if the graph is a weighted graph.

This figure illustrates a graph which consists of a finite number of vertices called nodes and finite set of ordered pair (u,v) called vertices.

The (u,v) in vertices represent that an edge exists from edge u to edge v

The graph is represented in the form of Adjacency Matrix, Adjacency List, Incidence Matrix and Incidence List.

The basic operations to be performed are adding vertices, edges and displaying the graph by its vertices.

The Adjacency Matrix represents the graph in a 2D matrix. The Adjacency List is the representation of the graph in the form of Linked Lists. Also, using these values we can represent it in the form of programs.