# Bacterial Route Finding and Collective Escape in Mazes and Fractals

Trung Phan, Ryan Morris, Matthew Black, Tuan Do, Ke-Chih Lin, Krisztina

Nagy, James Sturm, Julia Bos, Robert Austin

► To cite this version:

Trung Phan, Ryan Morris, Matthew Black, Tuan Do, Ke-Chih Lin, et al.. Bacterial Route Finding and Collective Escape in Mazes and Fractals. Physical Review X, 2020, 10 (3), 10.1103/Phys-RevX.10.031017. pasteur-03242799

HAL Id: pasteur-03242799

https://pasteur.hal.science/pasteur-03242799

Submitted on 31 May 2021

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
# Bacterial Route Finding and Collective Escape in Mazes and Fractals

Trung V. Phan

Department of Physics, Princeton University, Princeton 08544, New Jersey, USA

Ryan Morris

Department Of Physics, Edinburgh University, Edinburgh EH9 3FD, United Kingdom

Matthew E. Black

Lewis-Sigler Institute for Integrative Genomics, Princeton University, Princeton 08544, New Jersey, USA

Tuan K. Do

Department of Mathematics, Princeton University, Princeton 08544, New Jersey, USA

Ke-Chih Lin

Department of Electrical Engineering, Princeton University, Princeton 08544, New Jersey, USA

Krisztina Nagy

Institute of Biophysics, Biological Research Centre, Temesvari krt. 62, H-6726 Szeged, Hungary

James C. Sturm

Department of Electrical Engineering, Princeton University, Princeton 08544, New Jersey, USA

Julia Bos

Departement Genomes et Genetics, Institut Pasteur, UMR3525, CNRS, Paris 75015, France

Robert H. Austin

Department of Physics, Princeton University, Princeton 08544, New Jersey, USA

<figure><img src="image_2.png" /></figure>

(Received 29 September 2019; revised 31 March 2020; accepted 20 May 2020; published 22 July 2020)

Bacteria which grow not on the featureless agar plates of the microbiology lab but in the real world must navigate topologies which are nontrivially complex, such as mazes or fractals. We show that chemosensitive motile *E. coli* can efficiently explore nontrivial mazes in times much shorter than a no-memory (Markovian) walk would predict, and can collectively escape from a fractal topology. The strategies used by the bacteria include individual power-law probability distribution function exploration, the launching of chemotactic collective waves with preferential branching at maze nodes and defeating of fractal pumping, and bet hedging in case the more risky attempts to find food fail.

DOI: 10.1103/PhysRevX.10.031017

Subject Areas: Biological Physics

## I. INTRODUCTION

The two topologies of mazes and fractals pose quite different challenges to motile bacteria. A maze typically has well-defined entrance and exit ports [1]. However, within a maze there may be nodes leading to dead ends and internal loops which greatly lengthen the time it takes to exit from the maze if followed. While exit from a maze by a

stochastic random walk is inevitable, the time to escape from a maze via a random walk can be quite long because the distance covered scales as the square root of time [2]. There are many different kinds of fractals; the ones we work with here are treelike fractals [3]. The key characteristic of a fractal is self-similarity: A fractal looks locally the same as you branch down into the fractal, hence there are no obvious physical clues as to how deep you are into the fractal, and this makes escape from a fractal more challenging from a maze. We show that chemotactic bacteria get temporarily trapped in a fractal but eventually escape in a collective manner.

The maze we designed is shown in Fig. 1(a). It is a nontrivial, non-simply-connected maze [4]. A calculation

Published by the American Physical Society under the terms of the Creative Commons Attribution 4.0 International license. Further distribution of this work must maintain attribution to the author(s) and the published article's title, journal citation, and DOI.
given in the Appendix A shows that we can expect a collection of identical random walkers to take anywhere from 150 h (10 walkers) to 20 h (10⁶ walkers) for the first walker to emerge on average, where the walkers travel along the shortest path of length $L = 3 \times 10^3$ µm, assuming an effective diffusion coefficient $D_b$ of 300 µm²/sec for each bacterium. Even a nonrandom walker, such as a wall follower, will take a long time to exit (or even fail) if the maze is not simply connected and contains internal loops. Figures 1(a) and 1(b) show the schematic of our maze, both the actual microfabricated design and broken down into its elements. As in any maze, there is an entrance and an exit, in our case the exit leads to a ring of microhabitats which are connected to an external food source by nanoslits [5].

The fractal tree we work with is presented in Fig. 1. It is a physical fractal of circular microhabitat “leaves,” with levels from 0 to $N = 6$. The leaves of the fractal tree are a series of microhabitats of radius $R_n = \zeta^n \times 425$ µm. The leaves are connected via long and narrow branches of width $w_m = \zeta^m \times 70$ µm and length $l_m = \zeta^m \times 2600$ µm, hence

the aspect ratio $\sigma$ is the same for every tunnel and preserves self-similarity, with $n \in [0, N]$, $m \in [0, N-1]$, and $\zeta = 5/8$. The number of microhabitats of level $n > 1$ is given by (see Appendix B)

$$ \mathcal{N} = \frac{(3 - \sqrt{3})(2 + \sqrt{3})^n + (3 + \sqrt{3})(2 - \sqrt{3})^n}{2} \quad (1) $$

For large $n \gg 1$, the value $\mathcal{N}$ obeys the self-similar power-law growth $\sim \gamma^n$ with $\gamma = 2 + \sqrt{3}$, indicative of a scale-free “heavy-tail” network with fractal dimension $D$ given by

$$ \lim_{n \to +\infty} \mathcal{N}(n) \sim (\zeta^n)^{-D} \Rightarrow D = -\ln \gamma / \ln \zeta. \quad (2) $$

For our fractal tree $D \approx 2.90$. The fractal dimension of the human lung $D_{\text{lung}} \approx 2.5$ [6], hence our fractal can be viewed as rather similar to a human lung. Although E. coli do not typically infect a lung, other species of bacteria can form very serious resistant infections in the human lung [7].

<figure><img src="image_3.png" /><figcaption>FIG. 1. (a) A non-simply-connected maze. Bacteria are introduced in the center. The shortest path is shown in blue hexagons. (b) Three nodes with high branching levels labeled A, B, and C are shown. (c) A fractal of dimension $D = 2.90$. Bacteria are introduced in the center hole.</figcaption></figure>
## II. METHODS

The chip topologies were microfabricated on a 100-mm silicon wafer using standard silicon etching techniques. We grew at 1000 °C in an O₂ atmosphere a 0.2-µm-thick SiO₂ layer to obtain a hydrophilic surface after the etching step. We observed that bacteria left behind a surface modification of the SiO₂ which prevented stable rewetting of the chip [8,9]. To enable fresh reruns the chip surfaces were cleaned by a wet HF strip of the SiO₂ surface followed by thermal regrowth of the SiO₂ surface. The top of the etched chip was sealed by pressing a 20-µm-thick gas-permeable LUMOX polymer film LUMOX (Sarstedt AB, Nümbrecht, Germany) using pressurized air (10⁴ Pa). Since LUMOX is highly gas permeable the bacteria in the chip were in equilibrium with 21% O₂ levels at all times. All experiments were done at 20 °C.

The chip was sterilized with an initial 70% ethanol rinse followed by 2 min of O₂ plasma sterilization in a Harrick PDC-001 plasma cleaner (Harrick Plasma, Ithaca, NY). The plasma treatment was also important in making the chip surface temporarily hydrophilic for enhanced wetting. The sterilized chip was wet with 20 g/l Luria-Bertani (LB) broth so the initial conditions were uniformly high food concentrations everywhere.

We used the bacterial strains W3110 for chemotactic experiments and isogenic W3110 cheA resulting from P1 transduction of a cheA deletion carrying strain (RP9535) that has lost its chemotaxis ability. To capture bacteria motion into the mazes, both strains express green fluorescent proteins (GFP) under the Plac promoter, which intrinsically express GFP. The bacteria were cultured in LB broth at 30 °C for 24 h to reach saturation, then 20 µL of the culture transferred into a fresh 2-mL LB broth tube for 3 h at 30 °C to maintain motility under constant shaking until mid-log phase (0.6 OD). Then 0.5 µL of the mid-log bacterial growth was taken directly from the culture tube and inoculated at the center of the chip, and immediately covered with a 3-mm-diameter cover glass to prevent evaporation.

Images were taken in a Nikon 90i upright microscope (Nikon Instruments Inc., Melville, NY) with an Andor Neo 5.5 sCMOS camera (Andor Inc., Concord, MA) using a Nikon 4X Plan APO λ objective. A 3 × 3 stitch field was used, with 0.5-sec exposure times per field, so each stitched field took approximately 5 sec to accumulate. Stitched fields were taken every 2 or 5 min. Images were stitched together using NIKON ELEMENTS software [10] and later analyzed with ImageJ software [11] and MATLAB software (MATLAB and Statistics Toolbox Release 2019b, The MathWorks, Inc., Natick, MA). Stitching of high-magnification images allowed us to detect individual bacteria while still observing the global dynamics of the bacteria.

## III. RESULTS

### A. Mazes

We first show the maze escape experiments. In a microfabricated maze with one inlet and one outlet but a large internal array of paths, it is virtually impossible to have zero pressure difference between the input and output ports, and thus there is typically a very gentle fluid flow through the device. We use 40-nm-diam red fluorescent beads in an attempt to track the flow, but the velocity of the flow, estimated to be under 1 µm/sec in the narrow channels and under 0.01 µm/sec in the open areas, is low and overwhelmed by diffusion of the beads, while larger beads simply sink and stick to the surfaces and are immobile.

Motile bacteria are sensitive to net biases in flow, called rheotaxis [12], and may also simply be unable to swim against too strong a flow velocity. As we show, depending on the sign of the flow into or out of the maze entrance, the collective bacteria population escape dynamics are quite different, which we attribute here to changes in the bacterial population dynamics rather than rheotaxis. Since the flow velocities are so low that they are difficult to directly measure, we assume a net flow to be outbound from the entrance to the exit if individual bacteria when inoculated immediately enter the maze. Figure 2 shows a series of images of a run with single bacterial resolution. Supplemental Material video smovie-1 [13] shows the full movie. Visualization of individual bacteria at the movie length scale shown is difficult to detect by eye, but easily captured using ImageJ software.

For an outflow situation, it should be no surprise that bacterial flow out of the maze along the shortest path even if they are not chemotactic, or even not motile due to pure advection of the medium. Since we are able to track the bacteria individually in the case of low number density it is also possible to measure the number density ρ(x, t) of the number of bacteria along the shortest path through the maze.

We compute at time t the number of bacteria S(x, t) which have gotten to a distance x or greater for both chemotactic and nonchemotactic bacterial strains, a form of a survival function [14]:

$$S(x, t) = 1 - \frac{\int_{L_{\text{ent}}}^{x} \rho(x') dx'}{\int_{L_{\text{ent}}}^{L_{\text{exit}}} \rho(x') dx'}, \quad (3)$$

where $L_{\text{ent}} \to L_{\text{exit}}$ is the path of length $L = L_{\text{exit}} - L_{\text{ent}}$ from entrance to exit. Figure 2 shows S(x, t) as a function of distance along the shortest path out of the maze versus time at 270 and 360 min for chemotactic bacteria and nonchemotactic bacteria. Figure 2 shows that the chemosensitive and chemoinsensitive bacteria have very different survival functions S(x, t), with the chemosensitive bacteria
<figure><img src="image_4.png" /><figcaption>FIG. 2. (a) Stitched traces of chemotactic bacteria entering the maze with an outward flow from time of entry to the maze to exit of the maze. We have superposed the maze with red hexagons; the shortest path is shown with blue hexagons. (b) Survivor curves for bacteria. The solid green and blue lines are for nonchemotactic and chemotactic bacteria respectively at $t = 360$ min from maze entry; the dashed green and blue lines are for nonchemotactic and chemotactic bacteria respectively at $t = 270$ min from maze entry. The solid and dashed red straight lines are power-law fits to the survival function for chemotactic bacteria.</figcaption></figure>

presenting a power-law decay for $S(x, t)$, while chemo-insensitive bacteria have an exponential survival curve.

We are most interested in the number distribution of the bacteria in the maze versus time. Since we see power-law distributions and not exponentials, this indicates some form of chemotaxis is occurring. One possibility is a biased random walk, which in the limit of all bacteria having the same bias still yields exponentials in contradiction to the data, but could yield rapid passage. However, we do not explicitly introduce known powerful chemoattractants such as L aspartate, and whatever gradient exists must be quite gentle since our path is $3 \times 10^4$-µm long. Thus, we would guess that the results of Nagy et al. [15] for weak chemoattractants such as L lysine over gradients on the order of 100 mM/1000 µm to be UPPER values for what biased chemotaxis in LB would yield since our gradient is about 1/20 their gradient. In the work of Nagy et al. it takes about 4 h for E. coli to segregate over 1/20 our length scale. With weak-biased chemotaxis a weak-biased random walk should take at least 80 h. We believe a homogeneous-biased walk does not explain our result.

Power-law probability distributions are indicative of a non-Markov (persistent) walk where the bacteria do not randomly choose step sizes after each step, but rather show a persistent distribution in step sizes $g(l_p)$, where $l_p$ is the

persistent step size of a given bacterium, which is maintained from step to step. Assuming then a power-law distribution of $g(l_p, t)$, we map this step size over to an effective diffusion constant distribution $g(D, t)$. The probability $P(x, t)$ then of finding a bacterium at position $x$ at time $t$ becomes, assuming a Gaussian kernel for $P_D(x, t)$ for a given diffusion constant,

$$P(x, t) = \int_{D_{\min}}^{D_{\max}} g(D, t) P_D(x, t) dD. \quad (4)$$

If we assume that $g(D, t) \sim D^{-\gamma(t)}$, the spatial-dependence part of the survival function becomes

$$S(x, t) \sim x^{1-2\gamma(t)}. \quad (5)$$

Since we see a power-law survival distribution as is predicted by Eq. (5), the conclusion seems to be that in a maze in outflow conditions the bacteria lock into a power-law distribution of step sizes in a non-Markovian walk, which is different from the Markovian-Levy random flight model of bacterial searching since each bacterium chooses stochastically a different step size with each iteration [16,17]. Here, we have long steppers and short steppers which are fixed phenotypes. Note that this distribution
$g(l_p, t)$ is rather like the power-law distribution of relaxation times seen in proteins frozen in at low temperatures [18]. The work of the Emonet group analyzing the motion of chemosensitive bacteria and spatial self-organization is related to what we see here [19].

The evolutionary advantage to such a power law might be that there exist chemotactic “pioneers” which explore regions rapidly tumbling, and conservatives which explore spaces more slowly, a theme which is now becoming evident from agar plate work [20,21] and now reveals itself in a more realistic maze environment with outflow.

The bacterial population dynamics in a maze for inflow conditions are very different but perhaps connected to the outflow situations we just presented. Figure 3 shows as a series of stitched images of a population of bacteria introduced to the center of the maze with what we believe was a net inward speed from the exit to the entrance in the narrow channels of under 1 µm/sec (which corresponds to about 0.03 µm/sec in the open hexagonal habitats). For a period of approximately 6 h the bacteria basically do not (possibly cannot individually) enter the maze but rather

build in density by reproduction until suddenly a collective surge of bacteria enters the maze, conquering the inward flow. Once the collective entry occurs a solitary wave of bacteria penetrates the maze and after a period of several hours collectively exits the maze, in a time far shorter than a simple random walk. Note that the maze fills out in a nonergodic manner, but not the sole path shown for outflow conditions. The full movie can be found in Supplemental Material video smovie-2 [13].

The average speed of the wave moving through the maze is approximately 1 µm/sec in the open habitat hexagons moving toward the exit. Note also that by no means do all of the bacteria track with the main wave front: There are bacteria which lead the main front; there are also bacteria which do not continue to move with the wave front through the maze but drop out, as shown in Fig. 3. These front-leading bacteria are presumably different from the bacteria which entered the maze before the wave formed. The wave also leaves behind “bet hedgers” bacteria no longer traveling with the wave front. Although passive chemical waves can navigate mazes [22], they show little of this

<figure><img src="image_5.png" /><figcaption>FIG. 3. Stitched images of bacteria entering a maze with a net collective inward flow at selected times. We have superposed the maze as red hexagons, the shortest path is shown with blue hexagons, in every other time slice.</figcaption></figure>
complexity. The biological origins of this complexity, which we assume provides a fitness advantage, we do not know.

It is clear from Fig. 3 that the wave-propagating bacterial front does not uniformly fill the array but rather that some areas are populated more than others. If the collective wave-propagation front is merely due to classic bacterial Patlak-Keller-Segel (PKS) chemotactic response [23,24], at every maze path junction the wave should bifurcate equally into all existing channels since initially there is no chemical clue which way to go. However, the wave seems to preferentially choose the path which has the shortest path to the next node. Figure 4 shows graphically an example of this: At node C in the maze an incoming solitary wave is faced exits to five outgoing channels, only one of which leads to the shortest path to the next major node. Although all five

nodes are entered, the majority of the wave population entering the node chooses the correct shortest path. Exactly how this preferred selection of the “correct path” occurs we do not know, but it may be connected to the leading edge pioneer bacteria.

## B. Fractals

Fractals pose a different challenge to bacteria but we see strategies related to the maze solutions. Since the fractal had no exit the flow issues of the maze work are not present, but we see both strategies observed in the maze experiment used in a fractal to good effect. Figure 5 presents six time frames of bacterial density vs time after bacterial inoculation in our fractal. A video of this can be seen in the Supplemental Material video smovie-3 [13]. In the first three frames the fractal traps

<figure><img src="image_6.png" /><figcaption>FIG. 4. (a) Inflow maze at $t = 710$ min after inoculation. The dotted square is node C in Fig. 1. (b) Enlarged view of node C at 710 min. (c) Bacteria number per hexagon at $t = 650$ min. The red line is a fit to the solitary-wave solution of the PKS equations: a sech²(x) function [25]. (d) Sequence of the scattering of a wave as it enters and leaves node C, frames taken every 2 min. (e) Bacterial wave entry and exit populations in maze node C. The width of the line presents the bacteria density at the peak of the wave, the slope of the line indicates the wave speed.</figcaption></figure>
<figure><img src="image_7.png" /><figcaption>FIG. 5. (a) Sequence of stitched images of chemosensitive bacteria after inoculation in a fractal at the indicated times. (b) Nonchemosensitive bacteria slowly diffuse into the fractal and show no pumping or collective dynamics.</figcaption></figure>

the chemosensitive bacteria, that is the fractal serves as a pump to chemotactic swimmers to the smallest length scale of the fractal.

We measure the probability distribution of this initial trapping by measuring the local bacterial density $ρ(r, t)$ at radius $r$ from the inoculation center occupied by bacteria. This trapping only occurs for chemosensitive bacteria. Simple random walkers, even in a fractal landscape, should show a Gaussian distribution for $ρ(r, t)$, which we verify both by running nonchemosensitive bacteria (strain RP9535 Δ cheA) as seen in Fig. 5, and by running a simulation on MATLAB (see Supplemental Material smovie-4, smovie-5, and Appendix D [13]).

For chemosensitive bacteria after inoculation the bacterial density distribution is initially a power-law distribution in space like the bacteria moving into a maze as we discussed above, as seen in Fig. 5(a). Because of the termination of fractal at the smallest scale, the leading bacteria become trapped and the distribution becomes *inverted*, with a probability distribution increasing with radius, rather than decreasing with distance, as seen in Fig. 5(b). This initial fractal trapping of bacteria shows no collective dynamics and can be compared to the outflow bacterial dynamics of the maze followed by pileup at the fractal cutoff scale due to fractal pumping.

After the fractal trapping stage, counterpropagating collective waves are launched throughout the fractal, one set is launched from the inoculation port side outward, the other set is launched from the fractal pumped termini of the smallest scale fractal leaves inward. These outgoing and ingoing waves collide, bifurcating and scattering as we show in Fig. 4 at fractal levels, with the scattered waves moving into all arms of the fractal tree. The synchronization of the two counterpropagating waves and the bifurcation of the colliding waves into regions of low bacterial density would seem to strongly argue for a high degree of bacterial communication during this collective dynamics. Although these synchronized waves are best appreciated in the Supplemental Material video smovie-3 [13], Fig. 6 shows some stages of the collective dynamics.

The net effect of these counterpropagating collective waves is to defeat the fractal-pumping phenomena and end with a uniformly filled (ergodic) fractal tree.

## IV. ANALYSIS

There are four fundamental phenomena seen here as we challenge bacteria with complex topologies: (1) individual bacterial exploration with a time-invariant non-Gaussian probability distribution; (2) collective waves which solve
<figure><img src="image_8.png" /><figcaption>FIG. 6. (a) Bacterial density (in unit of $8 \times 10^8$ cells/mL) vs distance from the inoculation port at $t = 45$ min after inoculation. The red line is a fit to power law. (b) Bacterial density (in unit of $8 \times 10^8$ cells/mL) from inoculation port to furthest fractal level at $t = 240$ min from inoculation showing population inversion due to fractal pumping. The red line is a fit to theoretical model using PKS equations (see Appendix C). (c) Image sequence of colliding collective waves scattering into adjacent fractal leaves. Green arrows display the incident and scattering waves.</figcaption></figure>

mazes by path selection at maze nodes; (3) bet hedging for a fraction of the collective wave bacteria; (4) escape for bacteria from fractal pumping by collective wave scattering.

The collective waves we see are not due to a Fisher-Kolmogorov population nonlinearity [26] because they are only observed for chemotactic bacteria, but rather are connected to PKS chemotactic waves. These waves are not true solitons since they collapse and scatter when they collide with each other. In the maze we constructed with loops this collapse of colliding waves serves to facilitate killing the endless looping in the maze: A wave that enters a loop can collide with another wave and the resultant collapse stops the entry process. However, the scattering process also seems to direct the incident wave into shortest path exit channels.

That the PKS equations by no means represent the full range of bacterial approaches to exploring a nontrivial maze can be seen from the outflow maze experiments, where no obvious collective waves form yet the maze is rapidly solved with a non-Gaussian probability distribution. For the

fractal a different phenomenon occurs: Fractal pumping traps bacteria and collective waves untrap the bacteria. The challenge in a fractal is different from a maze; unlike a maze a fractal is self-similar, there are no topological clues in a fractal as to where a walker is within the structure. Furthermore, scale invariance predicts that the habitat area $S_i$ and channel lengths $l_i$ connecting areas as your proceed down the fractal must satisfy the following scaling laws for a systems of habitats of size $\{S_n\}$ connected via tunnel of width $\{w_n\}$ and length $\{l_n\}$ with the scale decreasing at a constant factor $\zeta$ between consecutive levels:

$$ \frac{S_{n+1}}{S_n} = \zeta^2, \quad \frac{w_{n+1}}{w_n} = \frac{l_{n+1}}{l_n} = \zeta. \qquad (6) $$

In such a train of decreasing areas $S_n$ we expect that for chemosensitive bacteria there will be a continuous cascade of population collapse because the sign of $\kappa$ in the PKS equations drives bacterial aggregation. In our fractal device $\zeta = 5/8$. Chemotactic signaling driven collapse favors bacteria moving from large areas $S_{large}$ to smaller adjacent
areas $\zeta S_{large}$ because for the movement of a given bacteria from large to small the effective density of the bacteria increases $\rho$, and so does the effective concentration of the chemoattractant $c$. The actual time dependent nonlinear dynamics of this process is extremely complex (see Appendix C), but in the limit of assuming that the food concentration $f$ is fixed and ignoring bacterial growth and death processes, the bacterial density difference $\Delta\rho = \rho_{n+1} - \rho_n$ is roughly given by

$$ \partial_t \Delta\rho \sim \kappa\alpha \left(\frac{1}{\zeta} - 1\right) \Delta\rho\Delta c, \quad (7) $$

where we have lumped all fixed parameters in $\alpha$, and $\Delta c$ is the (time and bacterial density dependent) chemoattractant concentration difference $c_{n+1} - c_n$. Equation (7) although an approximation, cannot be integrated analytically but it demonstrates the qualitative phenomena of fractal pumping: There is no pumping if $\zeta = 1$ (see Appendix D), while decreasing $\zeta$ results in more rapid population collapse. Figure 6(b) shows a fit of Eq. (7) of the bacterial density along one sector of the fractal at $t = 240$ min after inoculation. This pumping is not stable but decays due to backward wave propagation.

In the absence of backward propagating collective waves a fractal is then a trap for chemosensing bacteria and there is no escape from the smallest structures of area $\zeta^{12}S_o$. This makes the fractal structures extremely dangerous both to the individual infected with bacteria and to the bacteria themselves since they will increase in numbers to very high densities driven by fractal pumping. The only way out is to launch collective waves in both directions; when two of the waves collide this results in the scattering of both waves, as is seen in Fig. 6, and the eventual ergodic filling of the entire fractal.

## V. CONCLUSIONS

Natural complex topologies form challenging existential puzzles for bacteria. Billions of years of evolution have shaped the response of bacteria to these puzzles, whose solutions can be found in how bacteria such as the common E. coli respond collectively and individually to challenges. We pose challenges to bacteria in forms of mazes and fractal spaces, and show the unexpected and clever, if we can say that word about bacteria, way in which they are able to path find their way through a non-simply-connected maze, and escape from the trap of fractal pumping.

There are controversial aspects of this work we freely admit. Modeling of the collective dynamics is difficult. Unfortunately the PKS equations are highly nonlinear and cannot be solved analytically. Assumption of fixed food concentration such as we have done is the simplification needed to get the solution of fractal pumping in a nice analytic form, which we expect to be due to geometric reasons (or at least insensitive to the food change).

We believe that you need both geometry and also chemo-tactic sensing to fully understand our results.

Even modeling of the individual bacterial behavior is challenging. While using the random-walk results provides a useful benchmark, we find that the biased random walk is informative for the presumed outflow case, but it fails miserably for the inflow case which is really driven by collective dynamics, launching wave against the flow.

A third possibility to help understand our results is modification of the environment itself by the bacteria in a semipermanent way by surface modification. In fact, we think something like this could be happening in the maze (this is called in the mathematics of maze solving literature the “Hansel and Gretel” mode of solving a maze, where an agent leaves a trail behind which can be followed later).

There are many puzzles to be continued as we explore these ancient organisms. Although we know a great deal about the basic biological physics of chemotaxis [27], it is clear that much remains to be done to clarify more complex collective aspects.

## ACKNOWLEDGMENTS

We gratefully acknowledge many provocative and helpful comments from the referees. This work was supported by NSF PHY-1659940, BBSRC (Grant No. BB/R012415/1), and Princeton Catalysis Initiative Fund 23800-B1034-FA199. We thank Howard Berg for the generous gift of bacterial strains.

## APPENDIX A: SEARCH TIMES IN MAZES

Finding the exit from a maze for bacteria can be quite formidable in terms of time if a simple random-walk algorithm is used because typically a very circuitous path of long length must be followed to the exit. If we assume that bacteria simply do a random walk over the shortest path of length $x_{final}$, it is straightforward to calculate the mean first-arrival time of N bacteria at a position $x_{final}$, ignoring the effects of dead ends and branching decisions. The probability density $\rho(x, t)$ of a bacteria to arrive at position $x$ after time $t$ for a random (Markov process) walker is given by a Gaussian distribution:

$$ \rho(x, t) = \frac{1}{\sqrt{\pi D_b t}} e^{-x^2/4D_b t}, \quad (A1) $$

where $D_b$ is the effective diffusion coefficient of a swimming bacteria. Hence, the probability $P_L(t)$ for a bacteria to reach the exit of the maze at time $t$ is

$$ P_L(t) = \int_L^\infty dx \rho(x, t) = \operatorname{erfc}\left(\frac{L}{\sqrt{4D_b t}}\right), \quad (A2) $$
where erfc is the error function. Therefore, the expected time T for 1 bacterium out of N total bacteria to reach the exit can be estimated to be

$$T = \left[ \text{erfc}^I \left( \frac{1}{N} \right) \right]^{-2} \frac{L^2}{4D_b}, \quad (A3)$$

where erfc^I is the inverse error function. Assuming for D_b a diffusion coefficient of 300 µm²/sec [28], this yields formidably long first-arrival times for bacteria. Increased numbers does not help much, the mean first-arrival times scale inversely with the log of the number of bacteria using the generalized Puiseux series for N ≫ 1:

$$T \approx \left[ \ln N - \frac{1}{2} \ln \left( \pi \ln N - \frac{\pi}{2} \ln \frac{\pi}{2} \right) \right]^{-1} \frac{L^2}{4D_b} \\ \sim \frac{1}{\ln N}. \quad (A4)$$

# APPENDIX B: FRACTAL ENVIRONMENT

## 1. Generating our fractal

Our fractal is built from habitats and tunnels at many different scales (see Fig. 7). A leaf is a single habitat with a single tunnel, connected to another habitat that we add it on. A linking number of a habitat is the number of tunnel connected to it. Our α-fold fractal is generated step by step as follows:

*Step 0.*—Create a single habitat.

*Step 1.*—Add α leaves to the habitat.

*Step n ≥ 2.*—For every habitat, given its linking number p: (1) If p = 1, add α − 1 leaves to it. (2) If p > 1, add p leaves to it.

It should be noted that the physical size of the leaves is decreasing with steps. The difference in length scale between leaves of consecutive steps is a constant scale factor ζ ≤ 1.

## 2. Calculating the fractal dimension

We follow Ref. [29] to calculate the fractal dimension. In short, given the number of structures N(n) (the number of leaves at step n) at the characteristic length scale λ(n) ~ ζ^n (the length scale of the leaves at step n), the fractal dimension D can be estimated by

<figure><img src="image_9.png" /><figcaption>FIG. 7. The building of our fractal with a-fold, step-by-step from left to right. Here the parameter α = 3.</figcaption></figure>

$$D = - \lim_{n \to +\infty} \frac{\ln \mathcal{N}(n)}{\ln \lambda(n)}. \quad (B1)$$

If this limit is well defined, our geometry has a definite fractal dimension.

Note that the number of added leaves is equal to the number of added habitats at every step n > 0. For n = 0, the number of added habitats is simply 1. Define the number of habitats added at step n to be N(n), then

$$\begin{aligned} \mathcal{N}(0) &= 1, & \mathcal{N}(1) &= \alpha, \\ \mathcal{N}(2) &= \alpha(\alpha - 1) + \alpha &= \alpha^2. \end{aligned} \quad (B2)$$

Given the rules generating our fractal, any habitat added at step n > 0 will be added (α − 1) leaves at step n + 1, α leaves at step n + 2, 2α leaves at step n + 3, ..., 2^kα leaves at step n + k + 2, .... Therefore, for every step n > 1 one has the recursion relation

$$\mathcal{N}(n) = (\alpha - 1)\mathcal{N}(n - 1) + \sum_{j=0}^{n-2} 2^{n-2-j}\alpha\mathcal{N}(j). \quad (B3)$$

Consider a shift by 1 in the recursion relation

$$\mathcal{N}(n + 1) = (\alpha - 1)\mathcal{N}(n) + \sum_{j=0}^{n-1} 2^{n-1-j}\alpha\mathcal{N}(j). \quad (B4)$$

Therefore,

$$\begin{aligned} \mathcal{N}(n+1) - 2\mathcal{N}(n) &= \left( (\alpha - 1)\mathcal{N}(n) + \sum_{j=0}^{n-1} 2^{n-1-j}\alpha\mathcal{N}(j) \right) \\ &\quad - \left( 2(\alpha - 1)\mathcal{N}(n-1) + \sum_{j=0}^{n-2} 2^{n-1-j}\alpha\mathcal{N}(j) \right) \\ &= (\alpha - 1)\mathcal{N}(n) + (2 - \alpha)\mathcal{N}(n-1). \end{aligned} \quad (B5)$$

The recursion relation now becomes much more local:

$$\mathcal{N}(n+1) = (\alpha + 1)\mathcal{N}(n) + (2 - \alpha)\mathcal{N}(n-1). \quad (B6)$$

Since Eq. (B3) holds only when n > 0, we can rewrite Eq. (B6) as followed when n > 2:

$$\mathcal{N}(n) = (\alpha + 1)\mathcal{N}(n - 1) + (2 - \alpha)\mathcal{N}(n - 2). \quad (B7)$$

From the initial values (B2), one solves the above recursion relation and arrives at a complicated expression of the form
$$
\begin{align}
\mathcal{N}(n) &= c_+ \gamma_+^n + c_- \gamma_-^n, \nonumber \\
c_\pm &= - \frac{\alpha[\alpha - 5 \pm \sqrt{(\alpha - 1)^2 + 8}]}{2(\alpha - 2)\sqrt{(\alpha - 1)^2 + 8}}, \nonumber \\
\gamma_\pm &= \frac{\alpha + 1 \pm \sqrt{(\alpha - 1)^2 + 8}}{2}. \tag{B8}
\end{align}
$$

Plug this into (B1), one gets

$$
\begin{align}
\mathcal{D} &= - \frac{\ln \gamma_+}{\ln \zeta} \nonumber \\
&= \frac{\ln 2 - \ln [\alpha + 1 \pm \sqrt{(\alpha - 1)^2 + 8}]}{\ln \zeta}. \tag{B9}
\end{align}
$$

For $\zeta = 1/2$ and $\alpha = 3$, $\mathcal{D} \approx 1.90$. For $\zeta = 5/8$ and $\alpha = 3$, the dimensionality is close to that of a human lung $\mathcal{D} \approx 2.80$.

APPENDIX C: GEOMETRICAL INFLUENCE ON BACTERIAL COLLECTIVE DYNAMICS

The amplification of bacterial collapse in a multiscale
environment can be explained theoretically with a non-
linear model of E. coli chemotaxis signaling network,
which will be described in this section.

Consider a simple geometry that captures the multiscale
nature—a system of habitats of size {$S_n$} connected via
tunnel of width {$w_n$} and length {$l_n$} with the scale
decreasing at a constant factor between consecutive levels.
We end this multiscale series at level N (see Fig. 8):

$$
\begin{align*}
& S_0 \xrightarrow{w_1, l_1} S_1 \xrightarrow{w_2, l_2} S_3 \xrightarrow{w_3, l_3} \dots \\
& \xrightarrow{w_n, l_n} S_n \xrightarrow{w_{n+1}, l_{n+1}} \dots \xrightarrow{w_N, l_N} S_N.
\end{align*}
\tag{C1}
$$

For level 0 being the largest structure, the factor $\zeta$ has to be
smaller than unity. The relation between consecutive levels'
geometrical values, as the length scale goes for a constant
scale factor $\zeta$:

$$
\begin{align*}
\frac{S_{n+1}}{S_n} &= \zeta^2 \Rightarrow S_n = \zeta^{2(n-N)} S_N, \\
\frac{w_{n+1}}{w_n} &= \zeta \Rightarrow w_n = \zeta^{n-N} w_N, \\
\frac{l_{n+1}}{l_n} &= \zeta \Rightarrow l_n = \zeta^{n-N} l_N.
\end{align*}
\tag{C2}
$$

The basic starting point for understanding collective
bacteria dynamics is the Patlak-Keller-Segel equations
[30,31], which in general are of the form

$$
\partial_t b = \chi_b(b, c, f) + D_b \nabla^2 b - \kappa_{bc} \nabla(b \nabla c), \quad (C3)
$$

$$
\partial_t c = \chi_c(b, c, f) + D_c \nabla^2 c, \quad (C4)
$$

$$
\partial_t f = -\chi_f(b, c, f) + D_f \nabla^2 f. \quad (C5)
$$

The densities of bacteria, chemoattractants, and food are
given by the field b, c, and f; the reproduction rate χb of
bacteria, the production rate χc of chemoattractants, and the
consumption rate χf of food in general depends on both b,
c, and f; the diffusivity coefficients of bacteria, chemo-
attractants, and food are Db, Dc, Df; the chemotaxis
signaling can be represented by the sensitivity of bacteria
to the chemo gradients, which has the sensitivity coef-
ficient κbc.

For simplification, we will look at the limit where there is
no bacterial production and food concentration stays fixed:

$$
\chi_b \to 0, \quad f \to f_* = \text{const.} \tag{C6}
$$

Now, for the explicit form of χc, we will use the model in
Brenner et al. [25]:

$$
\chi_c(b, c, f) = \beta fb. \tag{C7}
$$

Equations (C3) and (C4) become

$$
\partial_t b = D_b \nabla^2 b - \kappa_{bc} \nabla(b \nabla c), \quad (C8)
$$

$$
\partial_t c = \beta f_* b + D_c \nabla^2 c. \quad (C9)
$$

1. Bacteria collapse due to chemotaxis

Consider the geometry given in Fig. 8 with N = 1 (a
small habitat size S<sub>1</sub> connects to a big one size S<sub>0</sub> = ζ<sup>-1</sup>S<sub>1</sub>
via a long and narrow tunnel w<sub>1</sub> × l<sub>1</sub>), using the mean-field
approximation inside the habitats and across the tunnels
with the bacteria density {b<sub>0</sub>, b<sub>1</sub>} and chemo concentration
{c<sub>0</sub>, c<sub>1</sub>}, the dynamics becomes

$$
\begin{align}
\partial_t (S_0 b_0) &= D_b \frac{w_1}{l_1} (b_1 - b_0) - \kappa_{bc} \frac{w_1}{l_1} \frac{b_0 + b_1}{2} (c_1 - c_0), \nonumber \\
\partial_t (S_1 b_1) &= D_b \frac{w_1}{l_1} (b_0 - b_1) - \kappa_{bc} \frac{w_1}{l_1} \frac{b_0 + b_1}{2} (c_0 - c_1), \tag{C10}
\end{align}
$$

$$
\begin{align}
\partial_t (S_0 c_0) &= S_0 \beta f_* b_0 + D_c \frac{w_1}{l_1} (c_1 - c_0), \nonumber \\
\partial_t (S_1 c_1) &= S_1 \beta f_* b_1 + D_c \frac{w_1}{l_1} (c_0 - c_1). \tag{C11}
\end{align}
$$

<figure><img src="image_10.png" /><figcaption>FIG. 8. A simple multiscale geometry that can be used to demonstrate the amplification of bacterial collapse and fractal attraction.</figcaption></figure>
To demonstrate how chemotaxis signaling leads to the bacterial collapse phenomenon, drop diffusion terms from the equations. Define

$$ \Delta_b = b_1 - b_0, \quad \Delta_c = c_1 - c_0. \quad (C12) $$

Since there is no bacteria growth,

$$ \bar{b} = \frac{S_1 b_1 + S_0 b_0}{S_1 + S_0} = \frac{b_0 + \zeta^{-1} b_1}{1 + \zeta^{-1}} = \text{const.} \quad (C13) $$

From Eqs. (C10) and (C11), after some algebraic manipulations,

$$ \Delta_b = \frac{1}{\beta f_*} \partial_t \Delta_c, \\ \frac{\zeta}{1+\zeta} S_0 \partial_t^2 \Delta_c = \frac{\kappa_{bc} w_1}{2 l_1} \left( 2\bar{b} + \frac{1-\zeta}{1+\zeta \beta f_*} \frac{1}{\beta f_*} \partial_t \Delta_c \right) \Delta_c. \quad (C14) $$

Linear order gives instability

$$ \partial_t^2 \Delta_c \approx (1+\zeta) \kappa_{bc} \bar{b} \frac{w_1}{S_1 l_1} \Delta_c \\ \Rightarrow \Delta_b \sim \pm e^{\sqrt{(1+\zeta)\kappa_{bc}\bar{b}(w_1/S_1 l_1)t}}. \quad (C15) $$

Note that we arrive at the same behavior found by Park et al. [32]—an exponential collapse.

The $\pm$ indicates that the collapse seems to be able to happen both ways—into the small habitat or into the large one, in which the later is not physical and has not been observed experimentally. Indeed, to get rid of the unphysical solution from a theoretical point of view, one has to keep the full nonlinear order

$$ \partial_t^2 \Delta_c = (1+\zeta) \frac{\kappa_{bc} w_1}{2 S_1 l_1} \left( 2\bar{b} + \frac{1-\zeta}{1+\zeta \beta f_*} \frac{1}{\beta f_*} \partial_t \Delta_c \right) \Delta_c. \quad (C16) $$

From here then on, to get the positive or negative sign correctly, without loss of generality we consider $\zeta \le 1$ as similar considerations can be done with $\zeta \ge 1$ with sign flips.

For $\Delta_b \sim \partial_t \Delta_c$ (C14) negative $< 0$, the difference $\Delta_c$ cannot grow arbitrarily large negatively—it is bounded from below:

$$ \partial_t \Delta_c \ge -2 \frac{1+\zeta}{1-\zeta} \beta f_* \bar{b} \\ \Rightarrow \Delta_b \ge \Delta_b \Big|_{\min} = -2 \frac{1+\zeta}{1-\zeta} \bar{b}. \quad (C17) $$

Hence, collapse will not happen in that direction, and even fluctuation of density due to bacteria randomly walking around can already surpass such a limit (make the bacteria go back) when the number of bacteria in the system (as the average density) is low enough:

$$ -\Delta_b \Big|_{\min} \lesssim \frac{1}{hS_0} + \frac{1}{hS_1} \Rightarrow \bar{b} \lesssim \frac{2(1-\zeta)}{hS_1}. \quad (C18) $$

Note that $h$ is the depth of the environment. The above estimation is done by letting one single bacterium going from $S_1$ to $S_0$ cause a density change high enough to surpass $\Delta_b|_{\min}$. For $\zeta \ll 1$, just a few bacteria getting inside $S_1$ might already make the density $b_1$ much larger than that of $b_0$.

For $\Delta_b \sim \partial_t \Delta_c$ (C14) positive $> 0$, the difference $\Delta_c$ can grow arbitrarily large positively—it is unbounded from above. At large time $t$ behavior,

$$ \partial_t \Delta_c \gg 2 \frac{1+\zeta}{1-\zeta} \beta f_* \bar{b} \\ \Rightarrow \partial_t \Delta_c \approx (1+\zeta) \frac{\kappa_{bc} w_1}{4\beta f_* S_1 l_1} \partial_t (\Delta_c^2). \quad (C19) $$

Note that the solution here is singular—the bacteria density can grow to infinity in finite time, and the smaller $S_1$ the stronger the collapse. However, physically, there should be a cutoff on how much the density can be due to the volume $\Omega$ of a bacterium:

$$ b|_{\max} \lesssim \frac{1}{\Omega}. \quad (C20) $$

This concludes our theoretical analysis on how bacteria collapse $n$ into smallest structures.

## 2. A physical model for fractal pumping

Consider the geometry given in Fig. 8 with $N \gg 1$, using the mean-field approximation inside the habitats and across the tunnels with the bacteria density $\{b_n\}$ and chemo concentration $\{c_n\}$, the dynamics becomes

$$ \partial_t (S_n b_n) = D_b \frac{w_n}{l_n} (b_{n-1} - b_n) + D_b \frac{w_{n+1}}{l_{n+1}} (b_{n+1} - b_n) \\ - \kappa_{bc} \frac{w_n}{l_n} \frac{b_{n-1} + b_n}{2} (c_{n-1} - c_n) \\ - \kappa_{bc} \frac{w_{n+1}}{l_{n+1}} \frac{b_{n+1} + b_n}{2} (c_{n+1} - c_n), \quad (C21) $$

$$ \partial_t (S_n c_n) = S_n \beta f_* b_n + D_c \frac{w_n}{l_n} (c_{n-1} - c_n) \\ + D_c \frac{w_{n+1}}{l_{n+1}} (c_{n+1} - c_n). \quad (C22) $$

Since the physical cutoff comes from the smallest structures, having the length scale comparable to that of a bacteria, we will keep $S_N$, $w_N$, and $l_N$ fixed while the total number $N$ of levels can be changed:

$$ S_N = S_*, \quad w_N = w_*, \quad l_N = l_* \quad (C23) $$
Note that, for every tunnel, the aspect ratio is the same:

$$ \frac{w_n}{l_n} = \frac{w_*}{l_*} = \sigma. \qquad (C24) $$

Using the multiscale relations—Eq. (C2)—one arrives at

$$ \begin{aligned} \zeta^{2(n-N)} S_* \partial_t b_n = & \sigma D_b (b_{n+1} + b_{n-1} - 2b_n) \\ & - \sigma \kappa_{bc} \left( \frac{b_{n-1} + b_n}{2} (c_{n-1} - c_n) \right. \\ & \left. + \frac{b_{n+1} + b_n}{2} (c_{n+1} - c_n) \right), \end{aligned} \qquad (C25) $$

$$ \begin{aligned} \zeta^{2(n-N)} S_* \partial_t c_n = & \zeta^{2(n-N)} S_* \beta f_* b_n \\ & + \sigma D_c (c_{n+1} + c_{n-1} - 2c_n). \end{aligned} \qquad (C26) $$

The above system of 2N ordinary differential equations is very hard to deal with, analytically. To go further, we will use the continuous representation for n so that the system becomes 2 partial differential equations:

$$ b_n \rightarrow b(n), \quad c_n \rightarrow c(n), \qquad (C27) $$

$$ \zeta^{2(n-N)} S_* \partial_t b = \sigma D_b \partial_n^2 b - \sigma \kappa_{bc} \partial_n (b \partial_n c), \qquad (C28) $$

$$ \zeta^{2(n-N)} S_* \partial_t c = \zeta^{2(n-N)} S_* \beta f_* b_n + \sigma D_c \partial_n^2 c. \qquad (C29) $$

At stationary distribution of bacteria, Eq. (C28) leads to

$$ \begin{aligned} \partial_t b = 0 &\Rightarrow D_b \partial_n^2 b = \kappa_{bc} \partial_n (b \partial_n c) \\ &\Rightarrow b \sim e^{(\kappa_{bc}/D_b)c}. \end{aligned} \qquad (C30) $$

Bacteria density depends exponentially on chemo concentration is a feature of the nonlinearity of bacteria-chemo interaction.

To get some intuition, note that the physical role of the chemo to the random-walking self-propelled E. coli are similar to that of the energy potential (profile V) to particles (with density ρ) at thermal equilibrium (at temperature T):

$$ \begin{aligned} b &\sim e^{\kappa_{bc}/D_b c} \leftrightarrow \rho \sim e^{-V/k_B T} \\ c &\leftrightarrow -V. \end{aligned} \qquad (C31) $$

Hence, we will quantify the bacterial attraction with the chemo density c.

Equation (C29) can be rewritten as

$$ \partial_t c = \beta f_* b + \zeta^{-2(n-N)} \frac{\sigma}{S_*} D_c \partial_n^2 c. \qquad (C32) $$

In the fast chemoattractant diffusion limit $D_c \gg D_b$, for linear terms one can ignore the time-variation contribution $\sim \partial_t c$ compared to that of the spatial-variation contribution $\sim \partial_n^2 c$ and do the approximation

$$ D_c \rightarrow +\infty \Rightarrow 0 \approx \beta f_* b + \zeta^{-2(n-N)} \frac{\sigma}{S_*} D_c \partial_n^2 c. \qquad (C33) $$

Physically speaking, the chemoattractant field is treated as background. It should be noted that this approximation is also made in Brenner et al. [25].

Since bacterial collapse happens most strongly at the smallest scale structures, let us use the maximum possible bacteria density there $b(N) = B$. Define

$$ \Delta(n) = c(n) - c(N). \qquad (C34) $$

The boundary conditions for Δ at the smallest structure (level N):

$$ \Delta(N) = 0, \quad \partial_n \Delta(N) = 0. \qquad (C35) $$

Bacteria density can now be written as

$$ b = B e^{(\kappa_{bc}/D_b)\Delta}. \qquad (C36) $$

Equation (C33) becomes

$$ 0 = e^{(\kappa_{bc}/D_b)\Delta} + \zeta^{-2(n-N)} \frac{\sigma}{S_*} \frac{D_c}{\beta f_* B} \partial_n^2 \Delta. \qquad (C37) $$

Redefine

$$ \begin{aligned} \tilde{\Delta} &= \frac{\kappa_{bc}}{D_b} \Delta, & \tilde{\zeta} &= \zeta^{-2} \sqrt{(D_b D_c / \kappa_{bc} \beta f_* B)(\sigma / S_*)}, \\ \tilde{n} &= -\sqrt{\frac{\kappa_{bc} \beta f_* B S_*}{D_b D_c} \frac{\sigma}{\Delta}} (N-n). \end{aligned} \qquad (C38) $$

One then arrives at

$$ 0 = e^{\tilde{\Delta}} + \tilde{\zeta}^{\tilde{n}} \partial_{\tilde{n}}^2 \tilde{\Delta}. \qquad (C39) $$

The general solution of this equation has the form

$$ \tilde{\Delta} = \ln \left[ \frac{\delta_1}{2} \sech^2 \left( \frac{\sqrt{\delta_1}}{2} (\delta_2 + \tilde{n}) \right) \right] - \ln(\tilde{\zeta}) \tilde{n}. \qquad (C40) $$

From Eq. (C35), the boundary conditions are

$$ \tilde{\Delta}(\tilde{n} = 0) = 0, \quad \partial_{\tilde{n}} \tilde{\Delta}(\tilde{n} = 0) = 0. \qquad (C41) $$

The matching gives

$$ \begin{aligned} \delta_1 &= 2 + \ln^2(\tilde{\zeta}), \\ \delta_2 &= - \frac{\ln[1 + \ln^2(\tilde{\zeta}) + \ln(\tilde{\zeta})\sqrt{2 + \ln^2(\tilde{\zeta})}]}{\sqrt{2 + \ln^2(\tilde{\zeta})}}. \end{aligned} \qquad (C42) $$

It is quite a complicated expression. In the limit of a large number of fractal orders $N \gg 1$ and drastic change of scale $\zeta \ll 1$, as $n \rightarrow N$ one has the approximation $\tilde{\Delta} \sim \tilde{n}^2$.
<figure><img src="image_11.png" /><figcaption>FIG. 9. (a) The pumping effect in a $D \approx 1.90$ fractal environment (with $\zeta = 1/2$ and $\alpha = 3$). (b) The bacteria density (in the unit of $8 \times 10^8$ cells/mL) in the fractal environment 250 min after inoculation and its theoretical fit using Eq. (C36).</figcaption></figure>

To get bacteria distribution $b$ from $\Delta$, use Eq. (C36). The function can then be used to compare with results observed from experiments [see Figs. 9 and 6(b)].

## APPENDIX D: NONCHEMOSENSITIVE BACTERIA AND NO FRACTALS

We test the role that chemotaxis plays in the role of fractal pumping by inoculating a fractal with a strain of bacteria which while motile has no chemotaxis sensitivity, strain RP9535 $\Delta$ cheA. Supplemental Material video

smovie-4 [13] shows a full video of the bacterial movement, while Fig. 10 shows a snapshot of a simulation at 250 min. Without chemotaxis there is no fractal pumping.

The role of the fractal structure in driving bacteria can be tested using a simple branching with $\zeta = 1$. An example is shown in the Supplemental Material video smovie-6 [13]. This structure has branches which both simply terminate in dead ends and branches connected via nanoslits to food sources. There is no strong collective collapse into the dead ends and no back propagation away from food sources.

<figure><img src="image_12.png" /><figcaption>FIG. 10. Simulation of nonchemotactic bacterial 250 min after inoculation.</figcaption></figure>

[1] E. Shimon, *Graph Algorithms*, 2nd ed. (Cambridge University Press, Cambridge, 2011).

[2] H. C. Berg, *Random Walks in Biology* (Princeton University Press, Princeton, 1983).

[3] S. Lorthois and F. Cassot, *Fractal Analysis of Vascular Networks: Insights from Morphogenesis*, J. Theor. Biol. **262**, 614 (2010).

[4] M. Saar, T. Gilad, T. Kilon-Kallner, A. Rosenfeld, A. Subach, and I. Scharf, *The Interplay between Maze Complexity, Colony Size, Learning and Memory in Ants While Solving a Maze: A Test at the Colony Level*, PLoS One **12**, e0183753 (2017).

[5] Q. Zhang, G. Lambert, D. Liao, H. Kim, K. Robin, C. K. Tung, N. Pourmand, and R. H. Austin, *Acceleration of Emergence of Bacterial Antibiotic Resistance in Connected Microenvironments*, Science **333**, 1764 (2011).

[6] F. E. Lennon, G. C. Cianci, N. A. Cipriani, T. A. Hensing, H. J. Zhang, C. T. Chen, S. D. Murgu, E. E. Vokes, M. W. Vannier, and R. Salgia, *Lung Cancer—A Fractal Viewpoint*, Nat. Rev. Clin. Oncol. **12**, 664 (2015).

[7] E. Mathieu, U. Escribano-Vazquez, D. Descamps, C. Cherbuy, P. Langella, S. Riffault, A. Remot, and
M. Thomas, *Paradigms of Lung Microbiota Functions in Health and Disease, Particularly, in Asthma*, Front. Physiol. **9**, 1168 (2018).

[8] Z. T. Zhou, T. Zhou, S. Q. Zhang, Z. F. Shi, Y. Chen, W. J. Wan, X. X. Li, X. Z. Chen, S. N. G. Corder, Z. L. Fu, L. Chen, Y. Mao, J. C. Cao, F. G. Omenetto, M. K. Liu, H. Li, and T. H. Tao, *Multicolor t-Ray Imaging Using Multi-spectral Metamaterials*, Adv. Sci. **5**, 1700982 (2018).

[9] F. Viela, M. Mathelie-Guinlet, A. Viljoen, and Y. F. Dufrene, *What Makes Bacterial Pathogens So Sticky? Mol. Microbiol.**113**, 683 (2020).

[10] https://www.microscope.healthcare.nikon.com.

[11] https://imagej.nih.gov/ij/.

[12] Marcos, H. C. Fu, T. R. Powers, and R. Stocker, *Bacterial Rheotaxis*, Proc. Natl. Acad. Sci. U.S.A. **109**, 4780 (2012).

[13] See Supplemental Material at http://link.aps.org/supplemental/10.1103/PhysRevX.10.031017 for video smovie 1: Bacteria in a nontrivial topology maze, with a very small hydrodynamic outflow; for video smovie-2: Bacteria in a nontrivial topology maze, with a very small hydrodynamic inflow; for video smovie-3: Bacteria in a fractal environment; for video smovie-4: Comparison between the behavior of chemotactic and nonchemotactic bacteria in a fractal environment; for video smovie-5: A random-walk simulation of the bacteria in a fractal environment; and for video smovie-6: Bacteria in a trivial maze (one short path and one long path to the food source, the rest are dead ends), where the connected habitats are of the same size (the scale factor is $\zeta = 1$).

[14] T. R. Maarleveld, B. G. Olivier, and F. J. Bruggeman, *stochPy: A Comprehensive, User-Friendly Tool for Simulating Stochastic Biological Processes*, PLoS One **8**, e79345 (2013).

[15] K. Nagy, O. Sipos, S. Valkai, E. Gombai, O. Hodula, A. Kerenyi, P. Ormos, and P. Galajda, *Microfluidic Study of the Chemotactic Response of Escherichia Coli to Amino Acids, Signaling Molecules and Secondary Metabolites*, Biomicrofluidics **9**, 044105 (2015).

[16] F. Matthaus, M. Jagodic, and J. Dobnikar, *E. Coli Superdiffusion and Chemotaxis-Search Strategy, Precision, and Motility*, Biophys. J. **97**, 946 (2009).

[17] F. Detcheverry, *Generalized Run-and-Turn Motions: From Bacteria to Lévy Walks*, Phys. Rev. E **96**, 012415 (2017).

[18] R. H. Austin, K. Beeson, L. Eisenstein, H. Frauenfelder, I. C. Gunsalus, and V. P. Marshall, *Dynamics of Carbon Monoxide Binding by Heme Proteins*, Science **181**, 541 (1973).

[19] X. Fu, S. Kato, J. Long, H. H. Mattingly, C. He, D. C. Vural, S. W. Zucker, and T. Emonet, *Spatial Self-Organization Resolves Conflicts between Individuality and Collective Migration*, Nat. Commun. **9**, 2177 (2018).

[20] H. Mattingly and T. Emonet, *The Balancing Act of Growth and Expansion*, Nature (London) **575**, 602 (2019).

[21] J. Cremer, T. Honda, Y. Tang, J. Wong-Ng, M. Vergassola, and T. Hwa, *Chemotaxis as a Navigation Strategy to Boost Range Expansion*, Nature (London) **575**, 658 (2019).

[22] O. Steinbock, A. Toth, and K. Showalter, *Navigating Complex Labyrinths: Optimal Paths from Chemical Waves*, Science **267**, 868 (1995).

[23] K. J. Painter, *Mathematical Models for Chemotaxis and Their Applications in Self-Organisation Phenomena*, J. Theor. Biol. **481**, 162 (2019).

[24] H. M. Byrne and M. R. Owen, *A New Interpretation of the Keller-Segel Model Based on Multiphase Modeling*, J. Math. Biol. **49**, 604 (2004).

[25] M. P. Brenner, L. S. Levitov, and E. O. Budrene, *Physical Mechanisms for Chemotactic Pattern Formation by Bacteria*, Biophys. J. **74**, 1677 (1998).

[26] G. B. Zhang and X. Q. Zhao, *Propagation Dynamics of a Nonlocal Dispersal Fisher-KPP Equation in a Time-Periodic Shifting Habitat*, J. Differ. Eq. **268**, 2852 (2020).

[27] Y. H. Tu, *Quantitative Modeling of Bacterial Chemotaxis: Signal Amplification and Accurate Adaptation*, Ann. Rev. Biophys. **42**, 337 (2013).

[28] H. C. Berg, *E. Coli in Motion* (Springer Science & Business Media, Berlin, Heidelberg, 2008).

[29] K. Falconer, *Fractal Geometry: Mathematical Foundations and Applications* (John Wiley & Sons, New York, 2004).

[30] C. S. Patlak, *The Effect of the Previous Generation on the Distribution of Gene Frequencies in Populations*, Proc. Natl. Acad. Sci. U.S.A. **39**, 1063 (1953).

[31] E. F. Keller and L. A. Segel, *Initiation of Slime Mold Aggregation Viewed as an Instability*, J. Theor. Biol. **26**, 399 (1970).

[32] S. Park, P. M. Wolanin, E. A. Yuzbashyan, H. Lin, N. C. Darnton, J. B. Stock, P. Silberzan, and R. Austin, *Influence of Topology on Bacterial Social Interaction*, Proc. Natl. Acad. Sci. U.S.A. **100**, 13910 (2003).