Graphs Interview Questions | Practice Problems

A graph is an ordered pair G = (V, E) comprising a set V of vertices or nodes and a collection of pairs of vertices from V called edges of the graph.

  Graphs Interview Questions

For example for above graph,

V = { 1, 2, 3, 4, 5, 6 }
E = { (1, 4), (1, 6), (2, 6), (4, 5), (5, 6) }

Below is the list of commonly asked graphs interview questions –


  1. Graph Implementation using STL
  2. Graph Implementation in C++ without using STL
  3. Implement Graph Data Structure in C
  4. Graph Implementation in Java using Collections
  5. Breadth First Search (BFS) | Iterative & Recursive Implementation
  6. Depth First Search (DFS) | Iterative & Recursive Implementation
  7. Arrival and Departure Time of Vertices in DFS
  8. Types of edges involved in DFS and relation between them
  9. Bipartite Graph
  10. Minimum number of throws required to win Snake and Ladder game
  11. Topological Sorting in a DAG
  12. Kahn’s Topological Sort Algorithm
  13. Transitive Closure of a Graph
  14. Check if an undirected graph contains cycle or not
  15. Total paths in given digraph from given source to destination having exactly m edges
  16. Determine if an undirected graph is a Tree (Acyclic Connected Graph)
  17. 2-Edge Connectivity in the graph
  18. 2-Vertex Connectivity in the graph
  19. Check if given digraph is a DAG (Directed Acyclic Graph) or not
  20. Disjoint-Set Data Structure (Union-Find Algorithm)
  21. Chess Knight Problem – Find Shortest path from source to destination
  22. Check if given Graph is Strongly Connected or not
  23. Check if given Graph is Strongly Connected or not using one DFS Traversal
  24. Union-Find Algorithm for Cycle Detection in undirected graph
  25. Kruskal’s Algorithm for finding Minimum Spanning Tree
  26. Single-Source Shortest Paths – Dijkstra’s Algorithm
  27. Single-Source Shortest Paths – Bellman Ford Algorithm
  28. All-Pairs Shortest Paths – Floyd Warshall Algorithm
  29. Print all k-colorable configurations of the graph (Vertex coloring of graph)
  30. Print All Hamiltonian Path present in a graph
  31. Greedy coloring of graph
  32. Determine if a given graph is Bipartite Graph using DFS
  33. Find Cost of Shortest Path in DAG using one pass of Bellman-Ford
  34. Least Cost Path in Weighted Digraph using BFS


Thank you for being with us. 🙂


Get great deals at Amazon

Leave a Reply

newest oldest most voted
Notify of

Thanks,, this is really interesting and I’ll probably read through all of them just to brush up on my graph knowledge…


Very interesting stuff though. Love graph algorithms have coded many myself in JavaScript to prep for interviews. My algorithms code base test suite –


Much more applicable than knowing how to implement these techniques, would be knowledge of “how to solve given realworld problems with these concepts”. It is likely a developer would have access to optimized libraries implementing these, and would need to know when they apply.


This is awesome man! thanks a lot..