Graph Theory DSA Problems

162 graph theory problems for coding interviews and campus placements, with hints and company tags. Below are the first 100 of 162: 3 easy, 18 medium and 79 hard. Practise them free on InternHack and track what you have solved.

Graph Theory problems, easiest first

  1. Find Center of Star Graph (Easy)
  2. Find if Path Exists in Graph (Easy)
  3. Find the Town Judge (Easy)
  4. All Ancestors of a Node in a Directed Acyclic Graph (Medium)
  5. All Paths from Source Lead to Destination (Medium)
  6. All Paths From Source to Target (Medium)
  7. Apply Substitutions (Medium)
  8. Cheapest Flights Within K Stops (Medium)
  9. Clone Graph (Medium)
  10. Connecting Cities With Minimum Cost (Medium)
  11. Count the Number of Complete Components (Medium)
  12. Count the Number of Houses at a Certain Distance I (Medium)
  13. Count Unreachable Pairs of Nodes in an Undirected Graph (Medium)
  14. Course Schedule (Medium)
  15. Course Schedule II (Medium)
  16. Course Schedule IV (Medium)
  17. Detonate the Maximum Bombs (Medium)
  18. Digit Operations to Make Two Integers Equal (Medium)
  19. Evaluate Division (Medium)
  20. Find All Possible Recipes from Given Supplies (Medium)
  21. Find Champion II (Medium)
  22. Add Edges to Make Degrees of All Nodes Even (Hard)
  23. Alien Dictionary (Hard)
  24. Build a Matrix With Conditions (Hard)
  25. Cat and Mouse (Hard)
  26. Cat and Mouse II (Hard)
  27. Check for Contradictions in Equations (Hard)
  28. Checking Existence of Edge Length Limited Paths (Hard)
  29. Checking Existence of Edge Length Limited Paths II (Hard)
  30. Collect Coins in a Tree (Hard)
  31. Count Pairs Of Nodes (Hard)
  32. Count the Number of Houses at a Certain Distance II (Hard)
  33. Count Visited Nodes in a Directed Graph (Hard)
  34. Count Ways to Build Rooms in an Ant Colony (Hard)
  35. Couples Holding Hands (Hard)
  36. Cracking the Safe (Hard)
  37. Critical Connections in a Network (Hard)
  38. Design Excel Sum Formula (Hard)
  39. Design Graph With Shortest Path Calculator (Hard)
  40. Distance to a Cycle in Undirected Graph (Hard)
  41. Divide Nodes Into the Maximum Number of Groups (Hard)
  42. Find All People With Secret (Hard)
  43. Find Critical and Pseudo-Critical Edges in Minimum Spanning Tree (Hard)
  44. Find Edges in Shortest Paths (Hard)
  45. Find Minimum Diameter After Merging Two Trees (Hard)
  46. Find Shortest Path with K Hops (Hard)
  47. Frequencies of Shortest Supersequences (Hard)
  48. Frog Position After T Seconds (Hard)
  49. Largest Color Value in a Directed Graph (Hard)
  50. Longest Cycle in a Graph (Hard)
  51. Longest Increasing Path in a Matrix (Hard)
  52. Longest Path With Different Adjacent Characters (Hard)
  53. Maximum Candies You Can Get from Boxes (Hard)
  54. Maximum Employees to Be Invited to a Meeting (Hard)
  55. Maximum Partition Factor (Hard)
  56. Maximum Path Quality of a Graph (Hard)
  57. Maximum Score of a Node Sequence (Hard)
  58. Maximum Sum of Edge Values in a Graph (Hard)
  59. Maximum XOR of Two Non-Overlapping Subtrees (Hard)
  60. Minimize Malware Spread (Hard)
  61. Minimize Malware Spread II (Hard)
  62. Minimize Maximum Value in a Grid (Hard)
  63. Minimum Cost to Convert String II (Hard)
  64. Minimum Cost to Make at Least One Valid Path in a Grid (Hard)
  65. Minimum Cost to Reach Destination in Time (Hard)
  66. Minimum Cost Walk in Weighted Graph (Hard)
  67. Minimum Degree of a Connected Trio in a Graph (Hard)
  68. Minimum Edge Reversals So Every Node Is Reachable (Hard)
  69. Minimum Edge Weight Equilibrium Queries in a Tree (Hard)
  70. Minimum Obstacle Removal to Reach Corner (Hard)
  71. Minimum Operations to Remove Adjacent Ones in Matrix (Hard)
  72. Minimum Runes to Add to Cast Spell (Hard)
  73. Minimum Time to Break Locks II (Hard)
  74. Minimum Time to Visit a Cell In a Grid (Hard)
  75. Minimum Weighted Subgraph With the Required Paths (Hard)
  76. Modify Graph Edge Weights (Hard)
  77. Number of Good Paths (Hard)
  78. Number of Increasing Paths in a Grid (Hard)
  79. Number of Possible Sets of Closing Branches (Hard)
  80. Number Of Ways To Reconstruct A Tree (Hard)
  81. Optimize Water Distribution in a Village (Hard)
  82. Parallel Courses II (Hard)
  83. Parallel Courses III (Hard)
  84. Path Existence Queries in a Graph II (Hard)
  85. Process Restricted Friend Requests (Hard)
  86. Rank Transform of a Matrix (Hard)
  87. Reachable Nodes In Subdivided Graph (Hard)
  88. Reconstruct Itinerary (Hard)
  89. Redundant Connection II (Hard)
  90. Remove Max Number of Edges to Keep Graph Fully Traversable (Hard)
  91. Second Minimum Time to Reach Destination (Hard)
  92. Shortest Cycle in a Graph (Hard)
  93. Shortest Path Visiting All Nodes (Hard)
  94. Sort Items by Groups Respecting Dependencies (Hard)
  95. Strange Printer II (Hard)
  96. String Transforms Into Another String (Hard)
  97. Sum of Distances in Tree (Hard)
  98. The Maze III (Hard)
  99. The Most Similar Path in a Graph (Hard)
  100. Valid Arrangement of Pairs (Hard)

Companies that ask graph theory problems

Before your interview

Most resumes are filtered by software before a recruiter reads them. Check your resume ATS score free, no signup needed.

Other DSA topics