What is a graph data structure and what are its uses?
A graph is a data structure that has nodes and vertices. The nodes are connected to each other via vertices. A graph can be a weighted graph or unweighted one. Also, it can be directed or undirected.
We will discuss the types of graphs in coming posts.
Uses of a graph:
Graphs are used for many practical applications in computer science. Some of the examples are as below:
1) To represent computer networks.
2) To determine the shortest path in a problem.
3) Used in social network sites to represent the user and their connections.
Representation of graph:
A graph can be drawn as below pictorially:
Ways of representation:
1) Adjacency matrix.
2) Adjacency list.
3) Incidence matrix.
We will deep dive into the details of representation of graphs in the coming tutorials.
Do let us know your questions/suggestions related to graphs in comments below.