<p>A quick search brought me to a book by Houjun Mo, <em>et al.</em> <a href="https://books.google.de/books?id=Zj7fDU3Z4wsC&amp;pg=PA333&amp;lpg=PA333#v=onepage&amp;q&amp;f=false" rel="noreferrer"><strong>Galaxy Formation and Evolution</strong></a> which says</p>
<blockquote>
<p>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 <span class="math-container">$b$</span>, 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 <span class="math-container">$b\simeq 0.2$</span> for which the mean overdensity of a halo is <span class="math-container">$\sim 180$</span>.</p>
</blockquote>
<p>This partially answers your question about the underlying physics: It is apparently based on <a href="https://en.wikipedia.org/wiki/Percolation_theory" rel="noreferrer">percolation theory</a>. Although being familiar with the percolation theory, it is not clear to me what the &quot;heuristic argument&quot; may be.</p>
<p>However, I also found an article by M. White <a href="https://www.aanda.org/articles/aa/pdf/2001/07/aah2421.pdf" rel="noreferrer">The mass of a halo</a> from 2001 which states</p>
<blockquote>
<p>Commonly used values of <span class="math-container">$b$</span> are <span class="math-container">$0.1$</span>, <span class="math-container">$0.15$</span> and <span class="math-container">$0.2$</span>, although other choices exist (e.g. Gardner 2000 chooses instead <span class="math-container">$b^{−3}= \Omega_M \Delta_c = 3$</span>. Jenkins et al. (2000)  find that the mass function is universal if they take <span class="math-container">$b=0.2$</span>, <strong>independent of the cosmology under consideration</strong>.</p>
</blockquote>
<p>I could not find the original publication Davis et al. from 1985, I think it may contain the above mentioned &quot;heuristic argument&quot;. Nevertheless, I emphasized the main reason for choosing <span class="math-container">$b=0.2$</span> in the quote above.</p>

CC BY-SA 4.0
2021-01-27T02:35:05.803Z
Thank you for your nice answer!
Wang Yun
CC BY-SA 4.0
2021-01-26T12:33:10.130Z
2021-01-26T12:38:52.810Z
2021-01-26T12:38:52.810Z
B--rian
<p>The friends-of-friends (FOF) algorithm (<a href="https://ui.adsabs.harvard.edu/abs/1982ApJ...257..423H" rel="noreferrer">Huchra &amp; Geller 1982</a>; <a href="https://ui.adsabs.harvard.edu/abs/1982ApJ...259..449P" rel="noreferrer">Press &amp; Davis 1982</a>, <a href="https://ui.adsabs.harvard.edu/abs/1985ApJ...292..371D" rel="noreferrer">Davis et al. 1985</a>) 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 <span class="math-container">$b$</span> (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 <span class="math-container">$b$</span>.</p>
<p>In cosmological applications of the FOF algorithm, particle groups are called <em>halos</em>, and experience shows that using <span class="math-container">$b = 0.2$</span> result in an average enclosed <em>over</em>density of close to <span class="math-container">$\Delta = 180$</span> times the average &quot;global&quot; density. This value of 180 equals the virial overdensity predicted by the spherical collapse model in the <a href="https://en.wikipedia.org/wiki/Einstein%E2%80%93de_Sitter_universe" rel="noreferrer">Einstein-De Sitter cosmology</a> (see e.g. <a href="https://ui.adsabs.harvard.edu/abs/2010gfe..book.....M" rel="noreferrer">Mo et al. 2010</a>). Also, the value of 180, or perhaps 200, is also typically the overdensity used for another popular halo finder, the so-called <em>spherical overdensity</em> algorithm.</p>
<p>That <span class="math-container">$b=0.2$</span> results in <span class="math-container">$\Delta \simeq 180$</span> is actually only true for an <a href="https://en.wikipedia.org/wiki/Singular_isothermal_sphere_profile" rel="noreferrer">isothermal</a> density profile; the exact value will depend on the actual profile and halo concentration <span class="math-container">$c$</span>. <a href="https://ui.adsabs.harvard.edu/abs/2011ApJS..195....4M" rel="noreferrer">Surhud et al. (2011)</a> offer an analytical solution to the overdensity as a function of <span class="math-container">$b$</span> and <span class="math-container">$c$</span>.</p>

CC BY-SA 4.0
2021-01-27T02:38:17.950Z
@pela Thanks for your nice answer. By the way, could you recommend some tutorials or lectures about how to implement FOF through programming?
Wang Yun
CC BY-SA 4.0
2021-01-27T08:51:34.997Z
@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](https://yt-project.org/doc/reference/api/yt.analysis_modules.halo_finding.halo_objects.html#yt.analysis_modules.halo_finding.halo_objects.FOFHaloFinder), [N-Body Shop](https://faculty.washington.edu/trq/hpcc/tools/fof.html), or [Pynbody](https://tinyurl.com/y4rmtxoq). I also found a few less famous [here](https://tinyurl.com/y5uowrrj) and [here](https://github.com/damonge/MatchMaker). See also the paper linked to by planetmaker.
pela
CC BY-SA 4.0
2021-01-27T09:03:41.657Z
@pela Thank you so much.
Wang Yun
CC BY-SA 4.0
2021-01-27T09:09:57.970Z
@WangYun You're welcome :)
pela
CC BY-SA 4.0
2021-01-26T12:34:37.533Z
2021-01-27T09:09:05.117Z
2021-01-27T09:09:05.117Z
pela
<p>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, <span class="math-container">$l_\mathrm{link}=b \left(\frac{V_u}{N}\right)^{1/3}$</span>, where <span class="math-container">$V_u$</span> is the volume of the simulation box, and <span class="math-container">$N$</span> is the number of dark matter particles.</p>
<p>In most literature, the value of <span class="math-container">$b$</span> is set at 0.2. What does <span class="math-container">$b\approx 0.2$</span> mean physically?</p>

<cosmology><n-body-simulations><algorithm><galactic-halo>
Why do people choose 0.2 as the value of linking length in the friends-of-friends algorithm?
Wang Yun
# Why do people choose 0.2 as the value of linking length in the friends-of-friends algorithm?

(Asked by: username_0 on 2021-01-26)

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?

**Tags:** cosmology, n-body-simulations, algorithm, galactic-halo

---

## 2 answers

### Answer by username_2 on 2021-01-26. Score: 18 | Accepted answer

The friends-of-friends (FOF) algorithm ([Huchra & Geller 1982](https://ui.adsabs.harvard.edu/abs/1982ApJ...257..423H); [Press & Davis 1982](https://ui.adsabs.harvard.edu/abs/1982ApJ...259..449P), [Davis et al. 1985](https://ui.adsabs.harvard.edu/abs/1985ApJ...292..371D)) 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 *over*density 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](https://en.wikipedia.org/wiki/Einstein%E2%80%93de_Sitter_universe) (see e.g. [Mo et al. 2010](https://ui.adsabs.harvard.edu/abs/2010gfe..book.....M)). 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](https://en.wikipedia.org/wiki/Singular_isothermal_sphere_profile) density profile; the exact value will depend on the actual profile and halo concentration $c$. [Surhud et al. (2011)](https://ui.adsabs.harvard.edu/abs/2011ApJS..195....4M) offer an analytical solution to the overdensity as a function of $b$ and $c$.

> **Comments:**
> **username_0**: @pela Thanks for your nice answer. By the way, could you recommend some tutorials or lectures about how to implement FOF through programming?  
> **username_2**: @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](https://yt-project.org/doc/reference/api/yt.analysis_modules.halo_finding.halo_objects.html#yt.analysis_modules.halo_finding.halo_objects.FOFHaloFinder), [N-Body Shop](https://faculty.washington.edu/trq/hpcc/tools/fof.html), or [Pynbody](https://tinyurl.com/y4rmtxoq). I also found a few less famous [here](https://tinyurl.com/y5uowrrj) and [here](https://github.com/damonge/MatchMaker). See also the paper linked to by planetmaker.  
> **username_0**: @pela Thank you so much.  
> **username_2**: @WangYun You're welcome :)  

---

### Answer by username_1 on 2021-01-26. Score: 5

A quick search brought me to a book by Houjun Mo, *et al.* [**Galaxy Formation and Evolution**](https://books.google.de/books?id=Zj7fDU3Z4wsC&pg=PA333&lpg=PA333#v=onepage&q&f=false) 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](https://en.wikipedia.org/wiki/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](https://www.aanda.org/articles/aa/pdf/2001/07/aah2421.pdf) 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.

> **Comments:**
> **username_0**: Thank you for your nice answer!  

---

