Skip to content

Graph Problems

Graph problems involve vertices and edges — modeling networks, dependencies, and relationships. Practice topological sort, shortest paths, connected components, and graph coloring.

39 problems

Title Difficulty
Alien Dictionary Hard
Breadth-First Search of a Graph Easy
Cheapest Flights Within K Stops Medium
Course Schedule Medium
Is Graph Bipartite? Medium
Critical Connections in a Network Hard
Depth-First Search of a Graph Easy
Detect a Negative-Weight Cycle Medium
Detect Cycle in a Directed Graph Easy
Evaluate Division Medium
Find Eventual Safe States Medium
City with the Fewest Reachable Neighbors Medium
Flood Fill Easy
Floyd–Warshall: All-Pairs Shortest Paths Medium
Graph Coloring with M Colors Medium
Knight Dialer Medium
Longest Increasing Path in a Matrix Hard
Graph Coloring with an Adjacency List Medium
Making a Large Island Hard
Minimum Payments to Settle Debts Hard
Mobile Numeric Keypad Medium
Most Stones Removed with Same Row or Column Medium
Number of Operations to Make Network Connected Medium
Minimum Spanning Tree with Prim’s Algorithm Medium
Redundant Connection Medium
Shortest Bridge Medium
Snakes and Ladders Medium
Minimum Knight Moves on a Board Medium
Strongly Connected Components Medium
Sum of Distances in Tree Hard
Swim in Rising Water Hard
The Celebrity Problem Hard
Time Needed to Inform All Employees Medium
Topological Sort Medium
Count Spanning Trees Hard
Travelling Salesman Hard
Cycle in an Undirected Graph Easy
Water Jug Problem Using BFS Hard
Word Ladder Hard