Skip to content

Graphs

A graph is a way to connect things.

The things are called vertices or nodes.

The connections are called edges.

Files In This Folder

Fast Idea

Algorithm Main Idea
BFS Explore level by level
DFS Go deep, then backtrack
Dijkstra Find shortest path with non-negative weights
Topological Sort Order tasks so prerequisites come first

Real-Life Picture

  • Graph: cities and roads
  • BFS: spreading wave
  • DFS: walking down one path in a maze
  • Dijkstra: GPS shortest route

See Also

For side-by-side notes, read Comparison.

For diagram-heavy notes, read Visual Comparison.