Back to Home

Graphs

Graphs model connections. Typical tools are DFS/BFS and visited tracking.

Key Ideas

  • Represent as adjacency list.
  • Use a set/array to track visited nodes.
  • BFS is great for shortest path in unweighted graphs.