Intermediate Module

Graph Algorithms

Navigate the world of graphs: traversals, shortest paths, spanning trees, and network flow - the algorithms that power the connected world.

14 hours
5 key concepts

Graph Traversal Visualizer

Interactive

Breadth-First Search

Explores all neighbors at current depth before moving deeper. Uses a queue.

O(V + E)
ABCDEF
Queue
[ ]
Current
-
Visited
0 / 6
Edges Used
0
Unvisited
Current
Visited

BFS vs DFS: When to Use Which?

Breadth-First Search (BFS)

  • āœ“ Finding shortest path in unweighted graphs
  • āœ“ Level-order traversal
  • āœ“ Finding nodes within K distance
  • āœ“ Web crawlers, social network analysis
Data structure: Queue (FIFO)

Depth-First Search (DFS)

  • āœ“ Detecting cycles in graphs
  • āœ“ Topological sorting
  • āœ“ Solving puzzles (mazes, Sudoku)
  • āœ“ Path finding when any path is acceptable
Data structure: Stack (LIFO) or recursion

Chapters

1

Graph Representations

How to store and think about graphs

Interactive
Adjacency Matrix O(1)Adjacency List O(1)Graph Types
2

Graph Traversal

Systematic exploration of graphs

Interactive
Breadth-First Search O(n)Depth-First Search O(n)Topological Sort O(n)
3

Shortest Paths

Finding optimal routes through graphs

Interactive
Dijkstra's Algorithm O(n log n)Bellman-Ford O(n²)Floyd-Warshall O(n²)

Ready for more?

Explore automata theory and formal languages.

Ā© 2025 Algorithmica — Computer Science Learning Platform