Graph Algorithms

Last Updated : 26 Jan, 2026

Graph is a non-linear data structure like tree data structure. A Graph is composed of a set of vertices(V) and a set of edges(E). The vertices are connected with each other through edges.

  • The limitation of tree is, it can only represent hierarchical data. For situations where nodes or vertices are randomly connected with each other other, we use Graph.
  • Example situations where we use graph data structure are, a social network, a computer network, a network of locations used in GPS and many more examples where different nodes or vertices are connected without any hierarchic or constraint on structure.

The following images show different types of graphs that see when solving graph problems.

Basics

BFS and DFS

Cycles

Shortest Path

Minimum Spanning Tree

Topological Sorting

Connectivity in Graph

Maximum Flow in Graph

Some must do Problems

If you are looking for difficulty-wise list of problems, please refer to Graph Data Structure.

Some Quizzes

Quick Links :

Comment