# Why do people choose 0.2 as the value of linking length in the friends-of-friends algorithm?

The friends-of-friends algorithm (hereafter FOF) is commonly used to find halos in cosmological simulations. And FOF depends on only one parameter, linking length, $$l_\mathrm{link}=b \left(\frac{V_u}{N}\right)^{1/3}$$, where $$V_u$$ is the volume of the simulation box, and $$N$$ is the number of dark matter particles.

In most literature, the value of $$b$$ is set at 0.2. What does $$b\approx 0.2$$ mean physically?

The friends-of-friends (FOF) algorithm (Huchra & Geller 1982; Press & Davis 1982, Davis et al. 1985) for finding groups of particles can be used for various numerical problems, not just cosmology, and linking lengths may vary between these problems. The larger the values you use for $$b$$ (the linking length in terms of the mean interparticle distance), the more particles you will include in your group of particles. Since the density falls off with distance from the center of the group, this means that the average density will be smaller for larger values of $$b$$.

In cosmological applications of the FOF algorithm, particle groups are called halos, and experience shows that using $$b = 0.2$$ result in an average enclosed overdensity of close to $$\Delta = 180$$ times the average "global" density. This value of 180 equals the virial overdensity predicted by the spherical collapse model in the Einstein-De Sitter cosmology (see e.g. Mo et al. 2010). Also, the value of 180, or perhaps 200, is also typically the overdensity used for another popular halo finder, the so-called spherical overdensity algorithm.

That $$b=0.2$$ results in $$\Delta \simeq 180$$ is actually only true for an isothermal density profile; the exact value will depend on the actual profile and halo concentration $$c$$. Surhud et al. (2011) offer an analytical solution to the overdensity as a function of $$b$$ and $$c$$.

• @pela Thanks for your nice answer. By the way, could you recommend some tutorials or lectures about how to implement FOF through programming? Jan 27, 2021 at 2:38
• @WangYun I don't know of any tutorials, unfortunately, so the best I can do is to tell you to have a look in some of the "famous" FOF halo finders, such as yt, N-Body Shop, or Pynbody. I also found a few less famous here and here. See also the paper linked to by planetmaker.
– pela
Jan 27, 2021 at 8:51
• @pela Thank you so much. Jan 27, 2021 at 9:03
• @WangYun You're welcome :)
– pela
Jan 27, 2021 at 9:09

A quick search brought me to a book by Houjun Mo, et al. Galaxy Formation and Evolution which says

For example, the frequently used friends-of-friends (FOF) algorithm defines halos as structures whose particles are separated by distances less than than a percolation parameter $$b$$, called the linking length, times the mean interparticle distance (Davis et al. 1985). A heuristic argument, based on spherical collapse, sugests that one should use $$b\simeq 0.2$$ for which the mean overdensity of a halo is $$\sim 180$$.

This partially answers your question about the underlying physics: It is apparently based on percolation theory. Although being familiar with the percolation theory, it is not clear to me what the "heuristic argument" may be.

However, I also found an article by M. White The mass of a halo from 2001 which states

Commonly used values of $$b$$ are $$0.1$$, $$0.15$$ and $$0.2$$, although other choices exist (e.g. Gardner 2000 chooses instead $$b^{−3}= \Omega_M \Delta_c = 3$$. Jenkins et al. (2000) find that the mass function is universal if they take $$b=0.2$$, independent of the cosmology under consideration.

I could not find the original publication Davis et al. from 1985, I think it may contain the above mentioned "heuristic argument". Nevertheless, I emphasized the main reason for choosing $$b=0.2$$ in the quote above.

• Thank you for your nice answer! Jan 27, 2021 at 2:35