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.
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
InteractiveGraph Representations
How to store and think about graphs
Adjacency Matrix O(1)Adjacency List O(1)Graph Types
2
InteractiveGraph Traversal
Systematic exploration of graphs
Breadth-First Search O(n)Depth-First Search O(n)Topological Sort O(n)
3
InteractiveShortest Paths
Finding optimal routes through graphs
Dijkstra's Algorithm O(n log n)Bellman-Ford O(n²)Floyd-Warshall O(n²)
Ready for more?
Explore automata theory and formal languages.