Chapter 1 · Complexity science
Simple rules, surprising patterns
Schelling's city: red and blue agents on a grid, about 10% of houses empty. An agent is happy if at least N of its 8 neighbours match it; if not, it moves to a random empty house. Nobody asks for segregation, yet clusters appear and grow. Each tower's height shows how many like neighbours that agent has; floating, pale blocks are unhappy agents about to move.
Segregation–
Unhappy–
Sweeps0
Segregation over time
avg. share of like neighboursshare unhappy
A random city starts near 50% alike. Watch how far above 50% it ends, even when agents only demand 2 of 8.
Try this
- Push segregation above 75% while agents ask for 3 of 8 or less.
- Reach a city where every agent is happy (N ≥ 2).
- Find a demand so strict the city never settles: unhappy stays above 30% after 40 sweeps.
Why this counts as a different kind of science
The chapter compares classical models (planetary motion) with complexity models (Schelling) along a set of axes. Each row runs from classical on the left to complex on the right.
KKepler's planets SSchelling's city
The shape of the argument
Chapter 2 · Graphs
Random graphs and the jump to connected
An Erdős–Rényi graph G(n, p): take n nodes and give every pair an edge with probability p. Drag p slowly. Edges arrive one by one, but connectivity does not: near p* = ln(n)/n the graph flips from scattered islands to one piece. Colours mark connected components; tower height is degree.
Edges (expected)–
Components–
Connected?–
Mean degree–
Largest piece–
p* = ln n / n–
How the search walks the graph
Tap a voxel to watch it run.
The experiment: probability of being connected
fraction of 80 random graphs that are connectedp*your p
Try this
- Tap a node in a disconnected graph and watch the search stop at its island.
- Find a connected graph with p below 1.3 × p* (with n ≥ 30).
- Run the experiment, then change n and run it again. Does the cliff stay at p*?
Chapter 3 · Small world graphs
A few shortcuts shrink the world
Start with a ring lattice: each node linked to its k nearest neighbours. Clustering is high, but paths are long. Now rewire each edge with probability p. Shortcuts arch over the ring in yellow. At small p, path length collapses while clustering barely moves. That is Watts and Strogatz's small world, and the reason Milgram's letters needed only about six hops.
Clustering C–
C(p) / C(0)–
Shortcuts–
Path length L–
L(p) / L(0)–
Selected path–
The Watts–Strogatz experiment
C(p)/C(0)L(p)/L(0)your graph
The small world lives in the gap between the curves, roughly p = 0.01 to 0.1, where L has dropped but C has not.
Try this
- Find a small world: C/C(0) above 0.8 and L/L(0) below 0.35 (n ≥ 100).
- Pick two nodes whose shortest path uses a shortcut.
- On the plain ring (p = 0), find a pair more than 15 hops apart. Then add p = 0.02 and measure again.
The shape of the argument
Chapter 4 · Scale-free networks
Growth plus rich-get-richer makes hubs
In the Facebook data, mean degree is 43.7 but the standard deviation is 52.4: most people have a few friends, one has over 1000. The WS model gets clustering and path length right but gives everyone about 44 friends. Barabási and Albert add two ingredients: nodes arrive one at a time, and each newcomer links to k existing nodes with probability proportional to their degree. Watch the hubs grow into towers.
The lottery: 0 tickets in repeated_nodes
Every node holds one ticket per edge. A newcomer draws k distinct nodes from the box, so a hub with many edges is likely to win again.
Nodes–
Mean degree–
Std of degree–
Degree distribution, log-log
BA model (yours)WS graph, same n and mean degree, p = 0.05
A power law, PMF(k) ∼ k−α, shows as a straight line on log-log axes. The CCDF is smoother and shows the tail more clearly.
Which model fits the data?
| Facebook | WS model | BA (yours) |
| Clustering C | 0.61 | – | – |
| Path length L | 3.69 | – | – |
| Mean degree | 43.7 | – | – |
| Std of degree | 52.4 | – | – |
Facebook column: SNAP dataset, 4039 users and 88,234 friendships (Table 4.1 in the book). Model columns are computed live on your much smaller graphs, so read the pattern rather than the exact values: WS wins on clustering, BA wins on spread of degree.
Try this
- Grow a hub with degree at least 10 × k.
- Grow at least 200 nodes with Uniform attachment and compare the tallest tower.
- Switch the chart to CCDF and find the straight-ish tail.
The shape of the argument
Chapter 5 · Cellular automatons
A world in one line
A 1-D cellular automaton: a row of cells, each on or off. Every tick, each cell looks at itself and its two neighbours and uses an 8-entry rule table to decide its next state. Rows stack toward you, so the picture shows the world's whole history.
The rule table (tap an output to flip it)
Hover a block to see the three cells that produced it; the matching table entry lights up. Tap a cell in the first row to flip it.
Famous rules
Rule 0 is class 1 (uniform). Rules 50, 18 and 90 are class 2 (nested). Rule 30 is class 3 (random-looking). Rule 110 is class 4 (complex, and Turing complete).
The shape of the argument
A simple model doesn't need to resemble the system in detail. It only needs the few features that are enough to produce the behaviour.
Chapter 8 · Self-organized criticality
The sand pile that tunes itself
Bak, Tang and Wiesenfeld's sand pile: any stack of 4 or more grains topples, sending one grain to each neighbour. Keep dropping grains and the pile drives itself to a critical state where avalanches of every size happen.
Tap a column to drop a grain exactly there.
Grains dropped0
Last avalanche0
Average height0
Avalanche sizes, log-log
A rough straight line on log-log axes means a heavy-tailed, power-law-like distribution.
Average height as sand falls
Chapter 11 · Evolution
Natural selection on a landscape
Each organism has a genome of 8 genes, each on or off: 256 possible genomes, laid out so that neighbours differ by about one gene. Terrain height is fitness, the chance of surviving each step. Orange cubes show where the organisms are. Switch the ingredients of evolution on and off and watch populations (never individuals) move across the landscape.
Tap a genome to light up its 8 neighbours, each one mutation away.
Mean fitness–
Genomes in use–
Best possible–
Mean fitness
Diversity: genomes in use