# How many people does it take to build a network out of phones? Fewer than you think.

FireChat connects all nearby phones into a network and uses this network to pass messages. Today, we are launching private off-the-grid messaging. FireChat uses unlicensed spectrum to create a heterogenous ad hoc network for messaging. Connections using unlicensed spectrum are fairly short-range: about 40 yards in most situations, but up to 70 if the conditions are right. While the throughput of these connections differs depending on technology — Wi-Fi Direct is considerably faster than Bluetooth Low Energy — the range is pretty similar.

The key to the way the network operates is the ability to daisy-chain devices to pass messages much further. FireChat augments pure off-the-grid transmission with using the Internet when available, but for now let’s focus on off-the-grid operation only.

Consider people in a city; can John text Sally using FireChat if the Internet is completely out? At first glance, one would expect that the answer would depend heavily on exactly where other people are in the city. However, a branch of mathematics, percolation theory, has studied this question and arrived at a surprising conclusion: as long as there is a significant degree of randomness in people’s locations, the only thing that matters for a given connection range is the density of the people — how many there are, on average, per square mile.

A classic experiment that illustrates percolation theory involves a jar and beads, some plastic and some coated in a thin layer of metal. Plastic beads don’t conduct electricity. The surface of coated beads does. A mix of these beads is poured into the jar. The top and the bottom of the jar are fitted with metal plates. Can electricity pass from the top plate to the bottom? If more than 25% of the beads are the conductive type, it generally will. If fewer than 25% are conductive, there usually won’t be a path.

This is broadly generalizable. For example, if the beads are of random differing sizes, there is still a way to formulate a similar rule: if the conductive beads occupy more than about 16% of the jar’s volume, there generally will be a conductive path through the jar. Incidentally, 25% for equal-sized spheres is a special case of the 16% rule: equal-sized spheres randomly poured into a jar will occupy about 64% of the jar’s volume, and 0.64*0.25=0.16. The critical density is called the percolation threshold.

The 16% rule generally works for other shapes in a three-dimensional space, but in two dimensions, the magic threshold is different: 50%.

Percolation theory can be applied to the situation when a network emerges out of nodes that opportunistically connect to adjacent nodes. Of course, percolation theory makes assumptions that might not exactly match network reality, but as we will see later, all the differences make propagation better. Thus, we can get a threshold that, even in unfavorable conditions, would, with high probability, yield the potential for near-instant message propagation.

The percolation threshold for FireChat range of connections is about 2,300 people/square mile. For comparison, population density in San Francisco is 17,200 people/square mile, seven times higher than the percolation threshold. The tent city at Burning Man is about 35,000 people/square mile.

In the visualization below, you can see how the properties of the network change as people are added. At first, there are disconnected nodes. Then, they turn into islands. Then, as the percolation threshold is reached, we have a connected mesh of people covering the entire area.

Note that above the percolation threshold, you can get near-instant propagation for FireChat messages to anywhere in the area. There are three significant factors that this brief background introduction ignores:

1. Some people are connected to the Internet.
2. People don’t just stay in a fixed place, but move about.
3. Population density is uneven.

Each of this factors makes the situation radically better in practice than percolation theory alone would predict.

If even a small fraction of people are connected to the Internet, they can help bridge any gaps that might arise below percolation threshold. In effect, when Internet connectivity is taken into account, you only need enough density to connect to someone, not to everyone, to pass messages.

As people move, they physically carry messages and can pass them around until they reach the recipient — or someone connected to the Internet. With enough movement, particularly if vehicles are involved, the density requirements are much lower, as we will see in a future post.

Uneven population density means that people bunch up and that the majority of population is, in fact, in areas with much higher population density than the average. This works on multiple scales — a city park is less densely populated than a low-rise residential neighborhood, which itself is much lower density than the high-rise area, but within these areas there are roads and other features that make population bunch up more. This means that even well below percolation threshold, the bulk of people are a part of a connected core. We will cover this further.

This summer we have a new intern at Open Garden, Giulio from MIT. Giulio and I have been working on some models and simulations and I wanted to make some of this public. This is an introduction that gives some background on FireChat and the general theory of how phones can connect to make a network. And by the way, if this is your cup of tea, we are hiring.