Graphs & the Follow Graph
In short: a graph is vertices (things) plus edges (connections) — the most general structure there is, because unlike a list or a tree it can loop back on itself. An edge is directed (an arrow, one way) or undirected (a line, both ways), and it can carry a weight (a cost). You can store a graph three ways — an edge list, an adjacency matrix, or an adjacency list — and the right choice depends on how often you ask "who connects to what" versus "does this exact pair connect", and on how sparse the graph is.

Tunebox's follow graph
Ana follows Ben, Ben follows Cal, and Cal follows Ana right back — a loop a list or a tree could never hold. Tunebox receives follows exactly like this: one row per follow, a follower and a followed. That raw form is an edge list:
Each follow row becomes one arrow, and the arrows together are the graph.
The first row, ana follows ben, becomes an arrow from ana to ben. 4 nodes, 1 edges, directed.
An edge list is cheap to append to but slow to query. Features want an adjacency list instead — every listener's own list of who they follow:
Converting rows into that shape is the most common graph code you'll write, and it has one trap: a listener who follows nobody is still a vertex and still needs a key, or the first algorithm that reaches them falls over:
KeyErrorCal follows nobody, so this should print []. Instead it crashes with a KeyError. Fix build so every listener in the graph has a key.
A vertex's degree is how many edges touch it; a directed graph splits that
into out-degree (who you follow — free, it's len(graph[name])) and
in-degree (who follows you — not stored anywhere, since those arrows live in
other people's lists). Counting it is one pass over every list:
That's O(V + E): every key once, every edge once.