Unit 11: Beyond the basics

Order in chaos, and the shape of real networks

The last unit is a tour of four big ideas that grew out of everything you've learned: why total disorder is impossible, what happens when edges are added at random, why the world is so small, and how a search engine decides which pages matter most.

1234567891011
In this unit
  1. Ramsey theory: the party problem
  2. Random graphs
  3. Small worlds
  4. Hubs and scale-free networks
  5. Who matters most? Centrality
  6. PageRank
  7. Where to go next
  8. Practice set
  9. Course summary

Ramsey theory: the party problem

At any party of six people, there are always three who all know each other, or three who are all strangers to each other. Always, however the friendships fall. With five people, that's no longer guaranteed.

Make each guest a vertex and join every pair with an edge: teal if they're friends, pink if they're strangers. That's the complete graph K6 with every edge coloured one of two colours. The claim is that there's always a monochromatic triangle: three vertices whose three edges all have the same colour.

Five people, no triangle of one colourFive people in a ring. Teal edges (friends) go round the pentagon; pink edges (strangers) form a star inside. No three people are all teal or all pink.

Five people: no single-colour triangle

Why six people are enoughPerson v has five edges; at least three have the same colour, say teal to a, b and c. The three dashed edges among a, b, c decide the rest.vabcde

Six people: the proof

Left: five friends round a table, each friends only with their two neighbours (teal pentagon). Strangers form the pink star. No triangle is all one colour. Right: with six people, pick anyone, v.

Why six always works. Pick any person v. They have 5 edges to the others, each teal or pink, so at least 3 must share a colour. Say v is friends with a, b and c (if it's strangers instead, swap the colours in what follows). Now look at the three edges among a, b and c:

Either way there's a single-colour triangle. Combined with the five-person example, this shows that 6 is the exact threshold. We write R(3, 3) = 6.

Ramsey numbers

R(s, t) is the smallest number of people that guarantees either s mutual friends or t mutual strangers. Frank Ramsey proved in 1930 that these numbers always exist.

The big idea of Ramsey theory is that complete disorder is impossible: any large enough structure contains a perfectly organised piece. But the exact numbers are fiendishly hard to find. R(4, 4) = 18 has been known since 1955. For R(5, 5), all anyone knows is that it's somewhere from 43 to 46, and checking every possible colouring is far beyond any computer. The mathematician Paul Erdős liked to joke that if aliens threatened to destroy Earth unless we told them R(5, 5), we should put all our computers and mathematicians to work on it; but if they asked for R(6, 6), we should try to destroy the aliens instead.

Try it. Using the handshake idea, explain why in any group of 6 people, if each person shakes hands with exactly 3 others, there's either a trio who all shook hands or a trio where nobody shook hands with each other.

Show answer

This is just a special case of R(3, 3) = 6: colour each pair teal if they shook hands and pink if not. Any 2-colouring of K6 has a single-colour triangle, so one of the two kinds of trio must exist, whatever the handshakes were.

Random graphs

What does a "typical" graph look like? In 1959 and 1960, Paul Erdős and Alfréd Rényi studied graphs built by chance: take n vertices and, for each pair, flip a biased coin to decide whether to add an edge. The key number is the average degree, the average number of edges per vertex.

Three random graphs on the same 40 vertices. Pink marks the largest connected piece (Unit 2). As edges are added, small fragments suddenly merge into one giant component.

Erdős and Rényi discovered that random graphs change suddenly, like water freezing into ice:

These "phase transitions" explain things like epidemics. If each infected person passes a disease on to fewer than one other person on average, outbreaks fizzle out in small clusters. Above one, a giant outbreak becomes possible. That's why the reproduction number "R" above or below 1 matters so much.

Small worlds

In Unit 2 we met the "six degrees of separation" idea. How can billions of people be so close together when most of our friends live near us and know each other? In 1998 Duncan Watts and Steven Strogatz gave a beautifully simple explanation.

Everyone knows their near neighboursSixteen people in a circle, each joined to the two nearest on each side.

Only local friends

A few shortcutsThe same circle with three edges rewired as long-range shortcuts across the middle.

Three long-range shortcuts

A few shortcuts shrink the world. Left: each person knows the two nearest people on each side, so friends of friends tend to know each other, but crossing the circle takes many steps. Right: rewiring just three of the 32 edges into shortcuts (pink) cuts the average distance between people by about 14% (from 2.4 steps to 2.07), while most friendship groups stay intact.

Real social networks combine two features that seem to pull in opposite directions:

Watts and Strogatz showed that a tiny number of random long-range links (a friend who moved abroad, a colleague from another city) is enough to make distances short, while barely affecting clustering. In a network of millions, a small fraction of shortcuts brings typical distances down from thousands of steps to a handful. Graphs with both properties are called small-world networks. They describe social networks, the nerve connections of a worm, power grids and more.

Hubs and scale-free networks

Random graphs have a democratic feel: most vertices have roughly the average degree. Real networks often don't. On the web, in airline routes and in social media, a few hubs have enormous numbers of connections while most vertices have only a few.

A network with hubsSixty vertices grown by preferential attachment. Most have one or two connections; a few hubs, drawn larger, have many.
A network grown by "the rich get richer". Each new vertex links to an existing one, choosing popular vertices more often. Circle size shows degree. The biggest hub (centre) has 14 connections, while most vertices have just 1 or 2.

In 1999 Albert-László Barabási and Réka Albert suggested a simple mechanism: preferential attachment. Networks grow over time, and newcomers prefer to link to vertices that are already popular. New websites link to famous websites; new airports add flights to big hubs. The result is a heavily unequal degree distribution, sometimes called scale-free, in which hubs are far more common than in a random graph.

Hubs have a double-edged effect. Networks with hubs are robust against random failures (most vertices are unimportant, so losing a random one rarely matters) but fragile against targeted attacks (remove the few hubs and the network shatters). That's why airline disruptions at one hub airport ripple across a whole continent, and why vaccinating highly connected people can slow an epidemic far more than vaccinating people at random.

Who matters most? Centrality

"Important" can mean different things in a network, and each meaning gives a different measure, called a centrality:

A broker between two groupsTwo triangles of friends, a-b-c and d-e-f, connected only through Sam in the middle.abcSamdef
Sam has only two friends, yet every message between the two groups passes through Sam. By degree, c and d look more important. By "being in the middle", Sam wins.
CentralityIdeaTop in the picture
DegreeHow many direct connections? (Unit 1)c and d (3 each)
ClosenessHow short are your distances to everyone else? Related to eccentricity in Unit 2.Sam
BetweennessHow many shortest paths between other people pass through you?Sam (all 9 paths between the two groups)
Eigenvector / PageRankAre you connected to people who are themselves important?see the next section

Betweenness picks out brokers and bottlenecks: the person whose departure would split a team, or the road junction where traffic jams form. Notice that Sam is a cut vertex (Unit 2), exactly the kind of weak spot betweenness tends to find.

PageRank

In the late 1990s, web search engines struggled to tell important pages from unimportant ones. Larry Page and Sergey Brin, then students at Stanford, had a graph-theoretic idea that became the foundation of Google: a page is important if important pages link to it.

That sounds circular, and it is, but in a useful way. Imagine a "random surfer" who starts on any page and keeps clicking a random link. Occasionally (15% of the time, in the original paper) they get bored and jump to a completely random page instead. Over a long time, the fraction of time the surfer spends on each page is its PageRank.

Five linked web pagesArrows are links: A links to B and C; B to C and D; C to A; D to C; E to C and D. PageRank scores shown as percentages.ABCDE33%17%35%12%3%
Five web pages and their PageRank. C is linked from four pages, so it ranks highest. A has only one incoming link, but it comes from C, which links nowhere else, so A inherits much of C's importance. E has no incoming links at all and gets only the minimum from random jumps.

Two lessons hide in this small example:

Mathematically, the PageRank scores are the solution of a large system of equations, which can be written as a special vector of the graph's adjacency matrix (Unit 1), called an eigenvector. Studying graphs through their matrices is a whole field, spectral graph theory, which also helps split networks into communities and measure how quickly a random walk mixes. Search engines today use many more signals, but the random-surfer idea remains one of the most famous applications of graph theory.

Try it. Suppose page E above adds a link to itself from a new page F, and nothing links to F. Would E's PageRank go up much? What does this say about spam pages that link to each other?

Show answer

Only a little. F receives only random jumps, so it has very little importance to pass on. Links from unimportant pages are worth little, which is exactly why PageRank resisted simple tricks like creating many junk pages that all link to one target, at least much better than counting links did.

Where to go next

You now know the core of a first university course in graph theory. Here are some directions to explore:

Books

Practice set

Mixed questions covering the whole unit. Try each one before opening the answer.

1. Show that in any group of 6 people, there are actually at least two single-colour triangles. (Hard; just try to see why one isn't the end of the story.)

Show answer

A known result (Goodman's formula) says every 2-colouring of K6 contains at least two single-colour triangles. One way in: count "two-coloured corners", places where a vertex has one teal and one pink edge. Each vertex has 5 edges, so at most 3 × 2 = 6 such corners. That's at most 36 in total. Every non-single-colour triangle has exactly 2 such corners, so there are at most 18 of them. Of the 20 triangles in K6, at least 20 − 18 = 2 are single-coloured.

2. A random graph has 1,000 vertices and 400 edges. Do you expect a giant component?

Show answer

The average degree is 2 × 400 ÷ 1000 = 0.8, below 1. No: expect many small pieces, mostly trees.

3. In the broker picture, what happens to the network if Sam leaves? Which unit's idea is this?

Show answer

The network splits into two components, {a, b, c} and {d, e, f}. Sam is a cut vertex, and the edges c–Sam and Sam–d are bridges (Unit 2).

4. Why might a network with hubs survive 50% of its vertices failing at random but collapse if 5% are deliberately attacked?

Show answer

Random failures mostly hit the many low-degree vertices, which hold little together. A deliberate attack targets the few hubs, which carry most of the connections, so removing them breaks the network into fragments.

5. In the PageRank example, which page would gain the most if B added a link to E?

Show answer

E, which currently has no incoming links: its score rises from about 3% to about 8%. B now splits its importance three ways (C, D, E) instead of two, so everyone else drops slightly. For example, C falls from about 35% to 34%.

Course summary

Congratulations on reaching the end of the course. Here is the whole journey on one line each:

  1. Foundations: vertices, edges, degree and the handshake lemma.
  2. Walks and connectivity: paths, components, distance, bridges and cut vertices.
  3. Trees: n − 1 edges, spanning trees, Kruskal and Prim.
  4. Exploring a graph: BFS, DFS and topological sorting.
  5. Shortest paths: Dijkstra, Bellman–Ford and Floyd–Warshall.
  6. Euler and Hamilton: every edge once is easy; every vertex once is hard.
  7. Matching: augmenting paths, Hall's theorem and stable matchings.
  8. Network flow: maximum flow equals minimum cut.
  9. Colouring: chromatic number, greedy colouring and four colours for maps.
  10. Planar graphs: V − E + F = 2, K5, K3,3 and the Platonic solids.
  11. Beyond: Ramsey theory, random graphs, small worlds, hubs and PageRank.

The same simple picture, dots and lines, turned out to describe friendships, roads, mazes, schedules, pipes, maps, molecules and the web. Next time you look at a metro map, a family tree or a list of who follows whom, you'll see the graph underneath.

Powered by Webloyt | Report abuse