story
Graphs for Programmers
Learn graphs for programming from first principles: graph models, nodes, edges, graph theory basics, traversal, dependency ordering, shortest paths, and search spaces.Hub
Understanding Graphs for ProgrammersLearn graphs for programming from first principles: graph models, nodes, edges, graph theory basics, traversal, dependency ordering, shortest paths, and search spaces.
Reading Path
- 1 Why Graphs Exist
Learn why graphs are useful in programming, when arrays and maps are not enough, and how graphs model relationships in real data.
- 2 The Math Root of Graphs
Learn the graph theory basics programmers need: vertices, edges, directed graphs, degree, paths, cycles, and weighted edges.
- 3 Graphs vs Arrays, Maps, Tables, and Trees
Compare graphs with arrays, maps, tables, and trees, and learn when graph data structures are the right model for relationship-heavy problems.
- 4 Representing Graphs in Code
Learn how to represent graphs in code using edge lists, adjacency lists, adjacency matrices, and reversed graphs for practical programming problems.
- 5 Walking Graphs with BFS and DFS
Learn graph traversal with BFS and DFS, when to use each search strategy, and why traversal order matters in programming.
- 6 Detecting Cycles in Graphs
Learn how to detect cycles in directed graphs using DFS, in-progress nodes, and done states, with dependency graph examples.
- 7 Topological Sort and Build Order
Learn topological sort with dependency graphs, build order examples, in-degree, Kahn's algorithm, and cycle detection.
- 8 Weighted Graphs and Shortest Paths
Learn weighted graphs, shortest paths, edge costs, and Dijkstra's algorithm for programming problems where relationships have cost.
- 9 Graphs as Search Spaces
Learn how graphs can model search spaces in games, compilers, planners, and workflows using generated neighbors, minimax, and pruning.
Connections
These show why the reading path is ordered this way.
- Detecting Cycles in Graphs builds on Walking Graphs with BFS and DFS
- The Math Root of Graphs builds on Why Graphs Exist
- Graphs as Search Spaces builds on Walking Graphs with BFS and DFS
- Graphs as Search Spaces relates to Weighted Graphs and Shortest Paths
- Graphs vs Arrays, Maps, Tables, and Trees builds on The Math Root of Graphs
- Representing Graphs in Code builds on Graphs vs Arrays, Maps, Tables, and Trees
- Topological Sort and Build Order builds on Detecting Cycles in Graphs
- Walking Graphs with BFS and DFS builds on Representing Graphs in Code
- Weighted Graphs and Shortest Paths builds on Walking Graphs with BFS and DFS