Talentd
FleetCode
Make and follow sheets.Sign in

Graph Problems (190)

Problems tagged with Graph. Start with the easy ones, then move to medium and hard.

4 Easy90 Medium96 Hard

Learn these first

1
Union Find

Union Find (Disjoint Set Union) is commonly used in graph problems involving connectivity, component merging, and detecting cycles in undirected graphs.

2
Shortest Path

Shortest path algorithms like Dijkstra and Bellman-Ford are used to compute minimum distances in weighted graphs and appear frequently in advanced graph interview questions.

3
Topological Sort

Topological sorting is critical for solving dependency and ordering problems in directed acyclic graphs, such as course scheduling or task pipelines.

4
Depth-First Search

DFS helps explore graphs recursively and is essential for cycle detection, connected components, and backtracking-based graph problems.

5
Breadth-First Search

BFS is a core graph traversal technique used to explore nodes level by level. It forms the basis for solving shortest path problems in unweighted graphs and many grid or island problems.

TitleSolutionAcceptDifficultyTopics
269. Alien DictionaryVideoPremium
Solution37.1%Hard
Array, Breadth-First Search +4· 18 companies
499. The Maze IIIVideoPremium
Solution52.3%Hard
Array, Breadth-First Search +6· 1 company
631. Design Excel Sum FormulaVideoPremium
–39.3%Hard
Array, Design +3· 9 companies
913. Cat and MouseVideo
Solution36.2%Hard
Solution43.6%Hard
Array, Breadth-First Search +4· 10 companies
Solution31.3%Hard
Bit Manipulation, Bitmask +2· 3 companies
Solution61.4%Hard
Array, Graph +2· 1 company
Solution42.7%Hard
Array, Graph +4· 3 companies
1728. Cat and Mouse IIVideo
Solution40.4%Hard
Array, Dynamic Programming +6· 1 company
Solution43.3%Hard
Array, Binary Search +3· 1 company
Solution67.0%Hard
Array, Dynamic Programming +2· 9 companies
Solution63.1%Hard
Array, Backtracking +1· 5 companies
–66.5%Hard
Solution43.8%Hard
Array, Depth-First Search +2· 2 companies
Showing 1–50 of 92

More about Graph

A Graph is one of the most powerful and widely used data structures in computer science. A graph consists of nodes (vertices) connected by edges, representing relationships between entities. Graphs can model real-world systems such as social networks, road maps, computer networks, recommendation systems, and dependency pipelines. Because of their flexibility, graph problems frequently appear in technical interviews at companies like Google, Amazon, and Meta.

In coding interviews, graph questions test your ability to model complex relationships and traverse structures efficiently. Many well-known interview problems involve identifying connected components, detecting cycles, finding the shortest path, or determining ordering constraints. To solve these problems, developers rely on foundational traversal algorithms like Breadth-First Search and Depth-First Search, which allow you to explore nodes layer by layer or recursively.

Beyond basic traversal, graph problems often combine multiple algorithmic techniques. For example, connectivity problems frequently use the Union Find data structure, while dependency resolution problems rely on Topological Sort. Route optimization and weighted graphs commonly require algorithms from the Shortest Path family such as Dijkstra’s or Bellman-Ford.

Common graph patterns you will encounter include:

  • Graph traversal using BFS or DFS
  • Cycle detection in directed or undirected graphs
  • Connected components and island-style problems
  • Shortest path and weighted graph algorithms
  • Graph coloring and bipartite checks

You should use graph algorithms whenever a problem involves relationships, networks, dependencies, or paths between entities. If the input can be modeled as nodes connected by edges—such as cities, users, tasks, or states—it is often a graph problem in disguise.

FleetCode provides 181 carefully curated Graph practice problems designed to help you recognize patterns, implement algorithms efficiently, and build the intuition needed to solve real interview questions. By mastering graph fundamentals and practicing diverse problem types, you can confidently tackle some of the most challenging questions in coding interviews.

Graph: common questions

Is Graph an important topic for FAANG interviews?

Yes, graph algorithms are extremely important for FAANG and top tech interviews. Many medium and hard interview questions involve graphs, including dependency resolution, network traversal, and pathfinding. Mastery of BFS, DFS, and shortest path algorithms is often expected.

What are the common patterns in Graph DSA problems?

The most common graph patterns include BFS/DFS traversal, cycle detection, connected components, bipartite graph checks, topological ordering, and shortest path algorithms. Many problems combine these techniques with data structures like heaps or Union Find.

How do you identify a Graph problem in coding interviews?

A problem is likely a graph problem if it involves relationships, networks, dependencies, routes, or transformations between states. If elements are connected and you need to explore paths or components between them, modeling the problem as a graph is often the right approach.

What are the most common Graph problems in coding interviews?

Common graph interview problems include number of islands, course schedule, clone graph, network delay time, and shortest path in a grid. These typically involve BFS, DFS, Union Find, or shortest path algorithms.

What is the best way to learn Graph algorithms for coding interviews?

Start by learning graph representations (adjacency list or matrix), then master BFS and DFS traversal. After that, practice patterns like cycle detection, connected components, topological sorting, and shortest path algorithms. Consistent problem practice is key to recognizing graph patterns quickly.