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
- Breadth First Traversal
- Depth First Traversal
- BFS vs DFS
- Rotten Tomatoes
- Islands in a Graph
- Flood Fill
- Check for Bipartite
- Word Ladder
- Snakes and Ladder
- Water Jug problem
- Pacific Atlantic Water Flow
- Shortest Path in Binary Matrix
- Clone a Graph
- Transitive Closure
Cycles
- Cycle in a Directed Graph
- Cycle in an undirected graph
- Cycle in a graph using colors
- Negative cycle in a Graph
- Cycles of length n
- Clone a Directed Acyclic Graph
- Disjoint Set Data Structure
Shortest Path
- Dijkstra’s shortest path
- Bellman–Ford
- Floyd Warshall
- Johnson’s algorithm
- Shortest Path in Directed Acyclic Graph
- Dial’s Algorithm
- Multistage Graph (Shortest Path)
- Shortest path in an unweighted graph
- Minimum mean weight cycle algorithm
- Shortest Path in a Binary Graph
- Minimum weight cycle
- D’Esopo-Pape Algorithm
Minimum Spanning Tree
- Prim’s Minimum Spanning Tree (MST)
- Kruskal’s Minimum Spanning Tree
- Prim’s vs Kruskal’s algorithm for MST
- Applications of Minimum Spanning Tree
- Minimum cost to connect all cities
- Total Spanning Trees
- Minimum Product Spanning Tree
- Reverse Delete Algorithm for Minimum Spanning Tree
- Boruvka’s Algorithm for Minimum Spanning Tree
Topological Sorting
- Topological Sorting
- All topological sorts of a Directed Acyclic Graph
- Kahn’s Algorithm for Topological Sorting
- Maximum edges that can be added to DAG so that is remains DAG
- Longest Path in a Directed Acyclic Graph
- Topological Sort of a graph using departure time of vertex
- Find Itinerary from a given list of tickets
Connectivity in Graph
- Articulation Points (or Cut Vertices) in a Graph
- Biconnected Components
- Bridges in a graph
- Eulerian path and circuit
- Fleury’s Algorithm for printing Eulerian Path or Circuit
- Strongly Connected Components
- Count walks with exactly k edges
- Euler Circuit in a Directed Graph
- Shortest chain to reach the target word
- An array of strings can be chained to form a circle
- Tarjan’s Algorithm for strongly connected Components
- Seven Bridges of Königsberg
- Dynamic Connectivity
Maximum Flow in Graph
- Max Flow Problem Introduction
- Ford-Fulkerson Algorithm for Max Flow
- Maximum edge disjoint paths
- Mnimum s-t cut in a flow network
- Maximum Bipartite Matching
- Channel Assignment Problem
- Introduction to Push Relabel Algorithm
- Karger’s Algorithm
- Dinic’s algorithm for Maximum Flow
Some must do Problems
- Largest region in Boolean Matrix
- Count Trees in a forest
- A Peterson Graph Problem
- Clone an Undirected Graph
- Graph Coloring
- Traveling Salesman Problem (TSP)
- Erdos Renyl Model (for generating Random Graphs)
- Chinese Postman or Route Inspection
- Hierholzer’s Algorithm for directed graph
- Bipartite or Not
- Snake and Ladder Problem
- Boggle (All Words in a Board)
- Hopcroft Karp Algorithm for Maximum Matching
- Graph from given degrees of all vertices
- Universal Sink
- Number of sinks in a graph
- Two Clique Problem
If you are looking for difficulty-wise list of problems, please refer to Graph Data Structure.
Some Quizzes
Quick Links :