<p>If you have enough particles to sample your field, then a given (local) density corresponds to the same mean distance between your particles. The FOF algorithm keeps linking particles to a halo until a particle is farther away than the linking length. That means that the halo boundary will be ~exactly on the border between regions of interparticle distances smaller and larger than the linking length, corresponding to a boundary between larger and smaller densities, respectively. That is, an iso-density surface.</p>
<p>In contrast, a halo finder using the spherical overdensity (SO) algorithm will always result in a spherical boundary, which will only be an iso-density surface in the case of a completely symmetrical halo.</p>
<p>This is the reason that FOF halo finders tend to include more filaments outside the region identified by SO halo finder. This may or may not be desired.</p>

CC BY-SA 4.0
2021-01-29T02:28:25.770Z
In your statement which says "If you have enough particles to sample your field, then a given density corresponds to the same mean distance between your particles",  What does "a given density" refers to, local density or mean density?
Wang Yun
CC BY-SA 4.0
2021-01-29T10:33:59.363Z
@WangYun I mean a given _local_ density. I just meant that, if your field is not well-sampled, then a given local density of 1 g/cm³ or 1 M☉/pc³ or whatever, may be represented by a slightly different number of particles in two different regions. Maybe a bit superfluous statement, but it was to address what More+ 11 said: "_at least in the limit of large number of particles_". I edited the answer to include the word _local_.
pela
CC BY-SA 4.0
2021-01-29T14:23:54.317Z
@WangYun Although the positions of the particles are well-defined points in space, the field that they represent is continuous, by assuming the particles be "smoothed" over space by some kernel. But the surface found by the FOF algorithm is a polyhedron with particles at the vertices. Going from one particle to its nearest neighbor along the FOF surface, the density field decreases as you leave one particle until you're midway between the two, after which it increase again until you reach the neighbor. Hence, it's not exactly an isodensity surface, but with enough particles the difference →0.
pela
CC BY-SA 4.0
2021-01-28T12:56:58.297Z
2021-01-29T10:34:14.163Z
2021-01-29T10:34:14.163Z
pela
<p>The friends-of-friends algorithm (hereafter FOF) is commonly used to find halos in cosmological simulations. (For more information, please refer to <a href="http://swift.dur.ac.uk/docs/FriendsOfFriends/algorithm_description.html" rel="nofollow noreferrer">here</a> and <a href="https://stackoverflow.com/questions/9333084/friends-of-friends-algorithm-written-in-python-need-to-be-in-fortran-90-95">here</a>)</p>
<p>I found that some literature argues that the boundary of the FOF halo is corresponding to an iso-density surface. For example, <a href="https://academic.oup.com/mnras/article/328/3/726/1241140?login=true" rel="nofollow noreferrer">Springel et al 2001</a> states</p>
<blockquote>
<p>It
places any two particles with a separation less than some linking
length <span class="math-container">$b$</span> into the same group. In this way, particle groups are
formed that correspond to regions approximately enclosed by
isodensity contours with threshold value <span class="math-container">$\rho\propto1/b^3$</span>.</p>
</blockquote>
<p><a href="https://iopscience.iop.org/article/10.1088/0067-0049/195/1/4/meta" rel="nofollow noreferrer">More et al 2011</a> says</p>
<blockquote>
<p>One could expect that for a given value of <span class="math-container">$b$</span>, the FOF algorithm defines the boundary of a halo as corresponding to a certain isodensity surface, at least in the limit of large number of particles.</p>
</blockquote>
<p>However, I can't understand the connection between the boundary of the FOF group of particles and iso-density contour. How to derive this connection in formula form? Does this connection need other hypotheses?</p>

<cosmology><n-body-simulations><algorithm><galactic-halo>
Why is the boundary of friends-of-friends (FOF) halo corresponding to iso-density contour?
Wang Yun
# Why is the boundary of friends-of-friends (FOF) halo corresponding to iso-density contour?

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

The friends-of-friends algorithm (hereafter FOF) is commonly used to find halos in cosmological simulations. (For more information, please refer to [here](http://swift.dur.ac.uk/docs/FriendsOfFriends/algorithm_description.html) and [here](https://stackoverflow.com/questions/9333084/friends-of-friends-algorithm-written-in-python-need-to-be-in-fortran-90-95))

I found that some literature argues that the boundary of the FOF halo is corresponding to an iso-density surface. For example, [Springel et al 2001](https://academic.oup.com/mnras/article/328/3/726/1241140?login=true) states

> It
> places any two particles with a separation less than some linking
> length $b$ into the same group. In this way, particle groups are
> formed that correspond to regions approximately enclosed by
> isodensity contours with threshold value $\rho\propto1/b^3$.

[More et al 2011](https://iopscience.iop.org/article/10.1088/0067-0049/195/1/4/meta) says

> One could expect that for a given value of $b$, the FOF algorithm defines the boundary of a halo as corresponding to a certain isodensity surface, at least in the limit of large number of particles.

However, I can't understand the connection between the boundary of the FOF group of particles and iso-density contour. How to derive this connection in formula form? Does this connection need other hypotheses?

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

---

## 1 answers

### Answer by username_1 on 2021-01-28. Score: 3 | Accepted answer

If you have enough particles to sample your field, then a given (local) density corresponds to the same mean distance between your particles. The FOF algorithm keeps linking particles to a halo until a particle is farther away than the linking length. That means that the halo boundary will be ~exactly on the border between regions of interparticle distances smaller and larger than the linking length, corresponding to a boundary between larger and smaller densities, respectively. That is, an iso-density surface.

In contrast, a halo finder using the spherical overdensity (SO) algorithm will always result in a spherical boundary, which will only be an iso-density surface in the case of a completely symmetrical halo.

This is the reason that FOF halo finders tend to include more filaments outside the region identified by SO halo finder. This may or may not be desired.

> **Comments:**
> **username_0**: In your statement which says "If you have enough particles to sample your field, then a given density corresponds to the same mean distance between your particles",  What does "a given density" refers to, local density or mean density?  
> **username_1**: @WangYun I mean a given _local_ density. I just meant that, if your field is not well-sampled, then a given local density of 1 g/cm³ or 1 M☉/pc³ or whatever, may be represented by a slightly different number of particles in two different regions. Maybe a bit superfluous statement, but it was to address what More+ 11 said: "_at least in the limit of large number of particles_". I edited the answer to include the word _local_.  
> **username_1**: @WangYun Although the positions of the particles are well-defined points in space, the field that they represent is continuous, by assuming the particles be "smoothed" over space by some kernel. But the surface found by the FOF algorithm is a polyhedron with particles at the vertices. Going from one particle to its nearest neighbor along the FOF surface, the density field decreases as you leave one particle until you're midway between the two, after which it increase again until you reach the neighbor. Hence, it's not exactly an isodensity surface, but with enough particles the difference →0.  

---

