"Back in Foundations we said structure-and-cost is a lens on the world. Here's the sharpest version of that lens: the moment you describe anything as 'things, and how they relate,' you've drawn a graph."
The Lens, Sharpened
A graph is just vertices (things) connected by edges (relationships). That's the entire definition — and it's almost insultingly general, which is exactly its power. Nearly every system that matters is a graph once you look:
- Maps: intersections are vertices, roads are edges. Your GPS is running a graph algorithm right now.
- Social networks: people are vertices, friendships are edges. "People you may know" is a graph query.
- The web: pages are vertices, hyperlinks are edges. Google's original PageRank ranked that graph.
- Dependencies: packages, build steps, course prerequisites — vertices that must come before others. Every package manager resolves a graph.
- The brain, molecules, supply chains, citations, the internet itself — all graphs.
This is the worldview frame from the very first track, returning at full strength: relationship is a fundamental feature of reality, and the graph is its data structure.
Everything You've Learned Is a Special Graph
Here's the unification: the structures from earlier tracks are all just graphs with rules added. A tree is a connected acyclic graph (with a chosen root in the rooted view). A non-circular singly linked list forms a path-shaped directed graph: each non-tail node has one outgoing next edge and the tail has none. A circular list forms a cycle, so “a tree where every node has one child” is not a correct general definition. Take any of those, remove the restrictions, and you're left with the general graph. So learning graphs isn't learning a new island; it's reaching the mainland that all the earlier structures were peninsulas of.
The Vocabulary of Edges
Two distinctions shape every graph problem: directed vs undirected (does the edge go both ways? Friendship is mutual — undirected; "follows" on social media is one-way — directed), and weighted vs unweighted (does the edge carry a cost? Roads have distances — weighted; a plain friendship link — unweighted). Naming these two properties for your problem tells you which algorithm you need: unweighted shortest path → BFS; nonnegative weighted shortest path → Dijkstra; negative weights require a different algorithm (next track).