A p-adic metric on a set of Boolean (or p-state) gene configurations measures distance by looking at how many leading digits of two configurations agree when written in base p. Two configurations that share the same first n digits are within distance p−n of each other — they live in the same ball of level n.
Geometrically, p-adic balls are nested: every ball of level n is partitioned into exactly p sub-balls of level n+1. This gives a rooted tree structure (the Cayley tree) that mirrors hierarchical gene regulatory logic. A permutation A of the gene indices determines which gene coordinates appear first, i.e., which biological variables define the hierarchy.
For each ball B at level n, we ask: do the images f(B) under the Boolean transition function spread further apart (expansion), stay at the same scale (indifferent), or cluster into a smaller ball (contraction/attraction)?
Formally, the diameter M of the image f(B) in the A-basis is the first position where image vectors disagree. Then:
The weighted counts μ_E, μ_A, μ_I assign each ball a weight equal to its number of configurations (pN−n), yielding a probability-like measure over the full state space. The fundamental invariant is:
Biologically: a network with high μ_A relative to μ_E is globally contracting — robust and canalizing. A network with high μ_E is sensitive and potentially multistable.
The scores depend on the choice of permutation A. The optimal ordering π* is the permutation that maximizes μ_A (or equivalently minimizes μ_E), uncovering the most stable hierarchical structure latent in the network. Finding π* requires searching over all N! permutations; for the networks studied here, it was computed by exhaustive or heuristic search.
The optimal ordering reveals which genes act as the "dominant" hierarchical variables: those listed first in π* control the coarsest partitioning of configuration space into stable attracting basins. This has direct biological meaning: top-ranked genes in π* tend to be master regulators.
You can analyze any synchronous Boolean (or p-state) gene regulatory network defined by a complete transition table. Prepare a CSV file with exactly pN rows and two columns:
config_from: integer 0 … pN−1, all configurations in base-p enumeration (bit 0 = gene 0, etc.). config_to: the image under f. All pN rows are required; the file must be complete.
Once loaded, go to the Analysis tab, choose "Custom CSV upload…", enter N and p, and use the permutation input to explore different orderings.