Space partitioning is of interest in a wide spectrum of fields, ranging from materials science to medicine, with special relevance to computer graphics and the exploration of natural resources stored in soils. For example, if different companies want to explore an oil reservoir they are interested in determining the volumetric share corresponding to each one inside the ground1. An additional degree of complexity comes into play when water is injected into the soil to push the oil to enhance extraction2,3. Also in medical imaging, three-dimensional computed tomography scans need to be segmented to identify the different tissues. These pictures are discretized into pixels and a number is assigned to the bond between neighboring pixels corresponding to the intensity gradient. The resulting structure is similar to the one of a porous soil. By aggregating pixels pairwise from the lowest to the highest gradient it becomes possible to identify the boundaries of tissues4.

Both problems consist in dividing space into parts: either the shares of the companies in the oil field or the different tissues in the image processing. In both cases, regions are separated by division surfaces. Here we consider three regions and find that their division surfaces join in a fractal thread that crosses the medium, being surrounded by a cloud of disconnected loops (see Fig. 1). In the case of oil exploration these points, where all three division surfaces merge, are the places where water should be injected to assure that no oil is pushed out on the wrong side. In medical image processing, the simultaneous boundary between three parts might indicate, for example, the region where a tumor is nested between two other tissues.

Figure 1
figure 1

Set of lines on which all division surfaces between three parts are in contact for a typical random medium.

In addition to the backbone spanning the medium from left to right (shown in red), the set also contains a cloud of disconnected loops (green). The transparent planes are guides to the eye.

We consider a random medium consisting of pores arranged in a simple-cubic lattice connected through channels. To each channel k a threshold pk is randomly assigned following a uniform distribution in the interval [0, 1). The fraction of open channels is tuned by a parameter p, such that channels with pk < p are open while all the others are closed. Hereafter we use the language of fluids where p would correspond to the fluid pressure. For digital images, the pores would correspond to the pixels and the thresholds pk to the intensity gradient between pairs of neighboring pixels.

To find the partitioning of the medium into three parts, we divide the (four) vertical boundaries of a cubic system in three parts of about the same area. Each part corresponds to a different invading fluid distinguished by dyeing them with different colors: red (R), green (G) and blue (B) [see Fig. 2(a)]. In the illustration of Fig. 2 we see a medium of 5 × 5 × 5 pores. The pores are in the center of each cube and the edges are the bonds of the dual lattice of the pore network. The cubes have the color of the fluid contained in the corresponding pore. We invade the system simultaneously from all vertical walls.

Figure 2
figure 2

Illustration of the model.

(a) In the initial state (p = 0) the vertical faces of the cubic lattice are divided into three sets. (b) Example of the final state of the invasion (p = 1), dividing the medium into three parts: R, G and B. RGB edges and nodes are shown as thick black lines and spheres, respectively. In (c) we separate the three pieces to be able to look inside. Solid lines represent the edges of the dual lattice of the pore network. The color of each cube corresponds to the one of the fluid in the pore at the center of the cube. The channels connecting the pores are perpendicular to the faces of the cubes and for clarity they are not shown. The RGB edges and nodes are part of the dual lattice.

Starting with p = 0 (i.e., all channels closed), the channel with the lowest threshold, in the invasion front, is selected and the fluid pressure p is increased to the value of this threshold. This channel and the empty pore connected to it are then invaded and colored according to the type of fluid that penetrated into it. After that, invasion also cascades into all pores connected to this pore through channels with thresholds lower than the actual p. This process is repeated until all pores are invaded, under the constraint that the fluids can not displace each other, which does not allow to invade any pore by more than one fluid.

In the final state, the medium is divided into three parts corresponding to the pores filled either with an R, G, or B fluid. These parts are the maximum oil shares that each company could extract from the exploration regions. This division is solely determined by the distribution of local thresholds, thus being intrinsic to the medium (for algorithmic details see Section Methods). Here we will mainly focus on the final partitioning of the medium, corresponding to p = 1 (all pores invaded). However, we later also discuss the pressure pt at which two different fluids start to form an interface.

An example for the partitioning into three parts is shown in Fig. 2(b). To better visualize the partitioning, we separate the three parts in Fig. 2(c). Every face that separates two colors is part of a division surface. Edges are shared by four different cubes. If three of the cubes sharing a common edge have different colors, we call this an RGB edge (thick black lines in Fig. 2). In fact, all RGB edges are on lines where all three surfaces separating regions of different color meet. The vertices attached to RGB edges are the RGB nodes and we define every set of nodes connected through RGB edges as an RGB cluster. All RGB nodes and edges of a medium form its RGB set.


The surfaces dividing two colors are fractal objects of fractal dimension dsur = 2.49 ± 0.02, as seen in the inset of Fig. 3, numerically consistent with what has been reported for watersheds in three dimensions5,6. While these boundaries are singly connected, the RGB set consists of one spanning cluster connecting the two sides of the system surrounded by a cloud of smaller disconnected loops (see Fig. 1). As shown in Fig. 3, the entire RGB set is fractal of dimension dtot = 1.69±0.02, while the spanning cluster has a smaller fractal dimension dsc = 1.55 ± 0.03. To analyze the topology of the spanning cluster, we used the burning method proposed in Ref. [7]. We found that the spanning cluster has loops, however its backbone, elastic backbone, shortest path and its set of singly connected RGB edges all have fractal dimensions consistent with dsc.

Figure 3
figure 3

Mass scaling analysis.

The total mass Mtot (, total number of RGB nodes) and the mass of the spanning cluster Msc (, number of nodes in largest RGB cluster) are shown as function of the lattice length L. One observes that for large lattices the masses scale as power laws of the lattice size, i.e., and . The fractal dimensions are dtot = 1.69 ± 0.02 and dsc = 1.55 ± 0.03. In the inset we see the area of the division surfaces Msur () as function of the lattice size L. The fractal dimension of the division surfaces is dsur = 2.49 ± 0.02. Straight lines are guides to the eye.

The difference between dtot and dsc is due to the cloud of disconnected loops. These loops result from the entanglement of three compact regions, as illustrated in Fig. 4, which shows a transversal cross section of a medium, where the three regions are simultaneously in contact at different locations. In this particular case, the lower location (dashed circle) is where the spanning cluster intersects the cross section. The upper location (dotted circle) shows the cut through a disconnected loop: The G and B regions are in contact in an area completely surrounded by the R region, thus the contact line between the three forms a closed loop (discretization effects are discussed in the Supplementary Information ). The size distribution of the loops is shown in Fig. 5(a), where the size s is defined as the number of RGB nodes forming the loop. A power-law distribution is observed, p(s) ~ s–a, with a = 2.04 ± 0.04, revealing the absence of a characteristic size. The distribution of distances of disconnected loops from the spanning cluster decays exponentially, i.e., the loop cloud is mainly localized in the neighborhood of the spanning cluster (see Supplementary Information for data).

Figure 4
figure 4

Sketch explaining the presence of disconnected loops in the RGB set.

We see a horizontal cut through a partitioned medium. The two red regions are connected with each other somewhere above or below the shown plane. The arrows indicate the existence of a loop, as discussed in the main text. On the right, one sees examples of cubes of different colors sharing edges. RGB edges are shown as thick solid lines.

Figure 5
figure 5

Scale-free behavior.

(a) Number of loop sizes s divided by as function of s for different lattice sizes L (256 (), 362 () and 512 ()). For intermediate sizes the data follows a power law, p(s) ~ sa with a = 2.04 ± 0.04. (b) Size dependence of the total mass Mtot at and above the threshold pressure pt. At pt () the total mass decreases according to a power law, Mtot ~ Lt, where t = 0.69 ± 0.08. In contrast, above the threshold () the slope is given by the fractal dimension dtot. (c) Rescaled total mass MtotLt as a function of the scaling variable (ppt)Lθ for different lattice sizes L. Close to the threshold , where ζT = 2.0 ± 0.3. The solid lines are guides to the eye.

To understand how the RGB set emerges, we now consider its evolution with the control parameter p. Initially, when the fluids R, G and B start to invade from the boundary, the RGB set is empty. As p increases, at a typical value p = pt, two fluids for the first time try to invade the same channel in the bulk and with increasing p a division surface starts to form orthogonal to these channels. If, in addition, any of the four edges shared by two neighboring pores of different color is also shared by a pore of the third color, an RGB edge emerges. Figure 5(b) shows how the total number of RGB nodes, Mtot, depends on system size at p = pt and at p = pt + 0.03. While above pt results are consistent with the fractal dimension observed for the final state (p = 1), precisely at pt, a negative scaling exponent is obtained, Mtot ~ L–t, with t = 0.68 ± 0.08. This implies that, in the thermodynamic limit, the RGB set is empty at pt, while above pt it is fractal of fractal dimension dtot.

If we assume that the formation of RGB nodes at pt is the product of two uncorrelated processes, namely the formation of a dividing surface between two colors, we can show that t = d – 2b, where d is the spatial dimension and b is the fractal dimension of the dividing surfaces at pt (see Supplementary Information ). For the fractal dimension b of the set connecting two fluids at pt, Coniglio has shown in the context of percolation that b = 1/ν, where ν is the correlation-length critical exponent of percolation8. In three dimensions, ν = 0.8734 ± 0.00069,10,11, giving t = 3 – 2/ν ≈ 0.71, consistent with our numerical result. Above the threshold pt the argument leading to the expression for t does not hold, since in this regime the invasion is correlated. Accordingly, the fractal dimension of the RGB set is then different from the one of the intersection of the two division surfaces. We conjecture that the expression for t can be generalized to any dimension d and number of different fluids (colors) n, as far as 2 ≤ nd:

For two colors, n = 2, t = –1/ν = –b, as in percolation. In contrast for n ≥ 3, given the exact and numerical values for ν12, t is positive. Above d = 6, the upper-critical dimension of percolation, 1/ν = 2, such that t = (n – 2)d – 2(n – 1).

We find that Mtot scales with the distance to pt as with ζT = 2.0 ± 0.3. Therefore, we propose the following crossover scaling for the total number of RGB nodes:

This scaling behavior of Mtot(p,L) in p and L implies θ = (dtot + t)/ζT. In addition, the scaling function G[x] fulfills for x > 0. The Ansatz in Eq. (2) is confirmed by the scaling plot in Fig. 5(c).


We found a rich scale-free behavior in the partitioning of random media through simultaneous invasion by three fluids. The lines where all three fluids are simultaneously in contact form a fractal set, the RGB set, of dimension dtot = 1.69 ± 0.02, while its spanning cluster has dimension dsc = 1.55±0.03. The other clusters are loops and their size follows a powerlaw distribution. At the threshold where two fluids first form an interface, the size of the set of RGB nodes scales with a negative exponent in the system size. We propose a crossover scaling between this exponent and the fractal dimension dtot above the threshold.

For an oil reservoir shared by three companies, our study shows how the optimal injection regions scale with the reservoir size and how they are spatially distributed. In the second example, image analysis, our work establishes how the number of pixels forming the simultaneous boundary between three tissues scales with the image resolution. Besides these examples, our results have also implications to other fields. Let us consider a chemical reaction that requires three different reactants each entering a porous medium from another side. Supposing that all reactants have the same diffusion constant our results identify the disconnected fractal region in which the reaction will take place. Finally, knowing the properties of the partitioning of a porous medium is also relevant for planning of waste disposal. Often trash is buried under ground, in porous soils, such that its decomposition gases spread through pores and fractures13. These gases will eventually leave the soil and the partitioning of the soil determines where this will happen first. In particular, the fractal RGB set are the disposal regions where the escaping of gases occurs, simultaneously, in three regions.

The exact shape of the RGB set depends on the threshold distribution and on the injection areas of the fluids. We also tested the partition model with different sets of injection pores, namely, (1) division of the six faces of a cubic medium into three injection areas, corresponding each to two adjacent faces of the cube, (2) injection from three vertical faces of a cube and (3) injection from three edges of the cube, with periodic boundary conditions. For all cases, we obtained fractal dimensions consistent with dtot = 1.69±0.02. In contrast, for the following injection patterns, different values for dtot have been obtained: (1) division of the six faces such that each fluid is injected from two opposite faces, (2) injection pores uniformly distributed in the cube, with periodic boundary conditions and (3) three single injection pores in the cube, also with periodic boundaries. These observations suggest that two conditions on the injection areas, though not necessary, are sufficient to obtain the RGB fractal dimension reported here. First, the injection area of each color must be singly connected. Second, the division of the surface of the medium into these areas has to be such that no single fluid can isolate the remaining two fluids from each other.

The reported fractal dimensions were obtained for a uniform and uncorrelated distribution of thresholds. It is well-known that disorder in soils is typically characterized by spatial correlations, which can be described by their Hurst exponent H. The numerical values of the fractal dimensions reported here will in general depend on H14,15,16,17. Nevertheless, our qualitative and topological arguments should still be applicable.

Models of discontinuous percolation transitions are a subject of recent interest18,19,20,21,22,23,24,25,26,27. Some of these models lead to compact clusters with fractal perimeters25,26,27 and in some cases with a fractal dimension compatible with the one of division surfaces26. The simultaneous boundaries between three clusters are therefore quite likely related to RGB sets.


All numerical results have been obtained with Monte Carlo simulations. Random numbers have been generated with the algorithm proposed in Ref. [28]. Considering the labeling scheme by Newman and Ziff29,30, we kept track of the color properties as function of the fraction of sampled channels p. For Fig. 3, results have been averaged over at least 2800 realizations. In Fig. 5(a), (b) and (c), results have been averaged over at least 10000, 6400 and 300 realizations, respectively. Unless indicated otherwise, statistical error bars are smaller than the symbol size. The algorithmic procedure shares similarities with invasion percolation31,32 and the fracturing of ranked surfaces33. The self-similarity of the shortest path in the spanning cluster of the RGB set has been confirmed using the yardstick method34,35.