Graph AlgorithmsTraversal, shortest paths, ordering
Graphs describe maps, social networks, task dependencies — anything where things relate to other things. This topic starts with the two basic traversals and works up through cycle detection, topological sort, the shortest-path family and minimum spanning trees.
Why learn Graph Algorithms
Where it shows upJunctions are nodes and roads are edges. "Fewest turns" is BFS; "fastest in minutes" has to account for edge weights, and that is Dijkstra.
→ Lesson: BFSEveryone two hops from you is a friend of a friend. BFS working outward ring by ring maps exactly onto degrees of separation.
→ Lesson: BFSA depends on B, B depends on C, so npm or make has to install C first. That is topological sort — and you need cycle detection first to be sure there is no circular dependency.
→ Lesson: Topological SortConnect every data centre for the lowest total cost. That is a minimum spanning tree, and Kruskal's version uses union-find.
→ Lesson: MST: Kruskal & Prim