5
for all three tangles (Fig. 2E). Additionally, the total con-
tact link (SI), obtained by summing all the pair contact
links from Fig. 2C, is sensitive to the contact structure
of the tangle. In particular, the total contact link as a
function of worm radius (Fig. 2F) behaves similarly as
the worms are thickened from zero radius to larger radii.
Thus, by incorporating topological information [45, 46]
as well as geometric information, contact link cLk cap-
tures core structural motifs that are reproducible over
different experiments. In particular cLk will enable us
to compare experimentally observed worm tangles with
tangled structures generated by dynamical simulations.
The ability of the blackworm to form tangles over
minutes (Fig. 3A), but rapidly unravel in milliseconds
(Fig. 3B) is a key biological and topological puzzle [37,
38]. To understand the dynamical process that gives rise
to tangle formation, we experimentally studied the head
trajectories of single worms (Fig. 3A-D; Methods). Since
these experiments were performed in a shallow fluid well
(height ∼2 mm), the projection of the trajectories into
2D (Fig. 3A-D) does not cause significant information
loss. To capture the winding motions associated with
braiding and unbraiding, we assume the worm head has
preferred speed v=h| ˙
x(t)|i, and focus on the worm turn-
ing direction, θ(t) = arg ˙
x(t). The θtrajectories can be
approximately described in terms of two parameters, the
average angular speed α=h| ˙
θ|i (Fig. 3A,B) and the rate
λat which ˙
θchanges sign. These quantities can be esti-
mated from the noisy trajectory data (SI). Although the
characteristic timescales α−1for slow tangling and ultra-
fast untangling differ by 2 orders of magnitude, rescaling
the θtrajectories for each gait by α−1reveals a similar
underlying dynamics (Fig. 3A,B). This similarity reflects
the fact that locomotion machinery is biologically con-
strained [47], and indicates that tangling and untangling
can be captured by the same mathematical model. To
confirm this, we first formulate a minimal 2D model of
worm head dynamics which we will then generalize to a
full 3D dynamical picture.
A minimal 2D model can be constructed by focusing
on the helical worm head dynamics identified experimen-
tally (Fig. 3). In particular, the quantities α, λ and v
discussed above motivate the following stochastic differ-
ential equation (SDE) model for a worm-head trajectory
˙
x=vnθ+ξT,˙
θ=σ(t;λ)α+ξR(2)
where ξT, ξRare noise terms, nθis a unit vector in the
θdirection and σ(t;λ) switches between +1 and −1 at
rate λ(SI). These trajectories can be further classified
by dimensionless parameters. In particular, the chirality
number, γ=α/2πλ, distinguishes between the tangling
and untangling gaits (Fig. 3A,B). This non-dimensional
parameter corresponds to the average number of right-
handed or left-handed loops traced out by the worm
before changing direction and provides an intuitive way
of understanding the topological properties of each gait.
When γis large, worms wind around each other before
switching direction, thus producing a coherent tangle.
On the other hand, for small γ, the worms change di-
rection before they are able to wind around one another
and so remain untangled. Our trajectory model thus ex-
plains how the characteristic helical waves produced by
untangling worms mediate topology (movie S2).
We next show that these conclusions generalize to a
full 3D mechanical model of worm gaits. To model the
worms, we performed elastic fiber simulations where the
worms are treated as Kirchhoff filaments [48–55] with
active head dynamics (SI). The head motions are pre-
scribed by the SDE model (2) together with additional
3D drift (SI). The resulting worm collectives can form 3D
tangled structures (Fig. 3E) consistent with those seen in
our experiments, as quantified by contact link (Fig. 3F).
In particular, the tangling and untangling behavior in
these simulations appears to be a function of the chirality
number, γ, further confirming its importance (Fig. 3E,F;
movie S2). This formulation of a 3D dynamical model al-
lows us to understand how the dynamics of single worms
produces worm collectives with distinct topologies.
Based on the above analysis of the worm trajecto-
ries we can build a mean-field tangling model, which es-
tablishes a mapping between tangling and percolation
(Fig. 4). To formulate an analytically tractable model,
we treat the worm motion as approximately 2D, so each
worm effectively moves in a 2D slice of the 3D tangle
(Fig. 4A,B). As a given worm moves in a plane P, its
head traces out a curve, x(t) (Fig. 4B, purple and green
curves), described by equation (2). The worm can en-
counter obstacles, which represent intersections of the
other worms with the plane P(Fig. 4B, colored cir-
cles). For simplicity, we treat these obstacles as forming
a square lattice Λ ⊂P, with spacing `(Fig. 4B), which
corresponds to the tightness of the worm tangle (SI). The
3D notion of contact link between worms can be mapped
to this 2D picture [41] by considering the winding of the
trajectory x(t) around the obstacles p∈Λ. In particular,
let Wpbe the winding number of x(t) around p∈Λ after
time t=L/v, the time taken for the worm-head to move
one worm length, L(SI). The contact winding, cWpof
x(t) around pis then |Wp|if x(t) gets within a thresh-
old distance of p(SI), and is 0 otherwise (Fig. 4B). As
observed in experiments (Fig. 3), topological properties
such as the contact winding are sensitive to the chirality
number γ(Fig. 4B). Thresholding and averaging all the
contact winding numbers yields a tangling index
T=*X
p∈Λ
Θ (cWp−1)+(3)
where the step function Θ returns 1 if cWp>1 and 0 oth-
erwise. The tangling index therefore counts the number
of obstacles that a worm winds around (Fig. 4B), and is a
measure of the mean degree of a tangle graph. Since con-