OCEAN
Dsa

Graphs and Union-Find

A focused graph interview guide covering DFS, cycle detection, topological sort, bipartite graphs, Dijkstra, Bellman-Ford, Union-Find, Kruskal, and Prim

Why Graphs Feel Hard

Graphs feel difficult because the same underlying structure can look like:

  • cities and roads
  • courses and prerequisites
  • islands in a matrix
  • accounts to merge
  • words changing one letter at a time

The trick is to translate the story into:

  • nodes
  • edges
  • traversal
  • connectivity
  • shortest path

Algorithms in This Topic

On this page