Vignette: Transition Networks, Irreversibility & Recurrence Graph Topology
Transforming symbolic sequences and recurrence matrices into graphs reveals dynamical properties—such as non-equilibrium driving (time-reversal asymmetry) and attractor manifold dimension—that cannot be seen from marginal distributions or single-step entropy rates alone.
1. Non-Equilibrium Driving vs. Detailed Balance (symbolic_transition_network, cycle_asymmetry_test)
Consider 600 discrete phase-quadrant observations (1, 2, 3, 4) recorded from two cyclic systems—for example, a driven physiological oscillator (such as cardiac phase progression) versus a passive Brownian system fluctuating around equilibrium:
- Driven system: Advances clockwise
1 -> 2 -> 3 -> 4 -> 1with $80\%$ probability, dwells with $10\%$, and steps backward with $10\%$. - Equilibrium system: Moves clockwise or counterclockwise with equal $50\%$ probability.
using Random, RecurrenceAnalysis, SymbolicInference
rng = MersenneTwister(314)
syms_drv = let st = 1, s = Int[]
for _ in 1:600
push!(s, st)
r = rand(rng)
st = r < 0.80 ? mod1(st + 1, 4) : (r < 0.90 ? st : mod1(st - 1, 4))
end
s
end
syms_equ = let st_e = 1, s = Int[]
for _ in 1:600
push!(s, st_e)
st_e = rand(rng) < 0.5 ? mod1(st_e + 1, 4) : mod1(st_e - 1, 4)
end
s
end
stn_drv = symbolic_transition_network(syms_drv; m=4, lag=1)
# entropy_rate = 0.6468 nats/step, topological_entropy = 1.0986
stn_equ = symbolic_transition_network(syms_equ; m=4, lag=1)
# entropy_rate = 0.6836 nats/step, topological_entropy = 0.6931
asy_drv = cycle_asymmetry_test(syms_drv, [1, 2, 3, 4])
# obs_edge_fwd = 476, obs_edge_rev = 61, net_edge_flux = 415
# z_flux = 17.93, p_flux = 7.21e-72
asy_equ = cycle_asymmetry_test(syms_equ, [1, 2, 3, 4])
# obs_edge_fwd = 318, obs_edge_rev = 281, net_edge_flux = 37
# z_flux = 1.53, p_flux = 0.1261Interpretation of Results: Both recordings exhibit nearly identical local transition uncertainty (entropy_rate of 0.647 vs. 0.684 nats/step), so entropy alone cannot distinguish active driving from passive fluctuation. Under the symmetrized detailed-balance Markov null (expected_flux = 0.0), cycle_asymmetry_test detects overwhelming net circulation in the driven system ($476$ forward vs. $61$ reverse transitions, $Z_{\text{flux}} = 17.93, p = 7.21 \times 10^{-72}$), quantifying broken time-reversal symmetry (positive entropy production). In contrast, the equilibrium series ($318$ vs. $281$, $Z_{\text{flux}} = 1.53, p = 0.126$) is statistically consistent with reversible detailed balance.
2. Attractor Geometry via Recurrence Network Motifs (recurrence_network_motifs)
Treating a thresholded RecurrenceMatrix (with main-diagonal Theiler band $|i - j| < \text{theiler}$ removed) as an undirected network maps each sampled state $x_i$ to a vertex and connects states within distance $\epsilon$.
Compare a 120-sample periodic orbit (steady electromechanical limit cycle) against 120 samples of uncorrelated 2D Gaussian noise at $\epsilon = 0.55$:
t_rn = collect(0:119) .* 0.25
rm_lc = RecurrenceMatrix(StateSpaceSet(hcat(sin.(t_rn), cos.(t_rn))), 0.55)
rm_wn = RecurrenceMatrix(StateSpaceSet(randn(rng, 120, 2)), 0.55)
rn_lc = recurrence_network_motifs(rm_lc; theiler=1)
# edge_count = 1246, edge_density = 0.175
# n_triangles = 5890.0 (ER null = 1492.5), transitivity = 0.714, topological_entropy = 3.058
rn_wn = recurrence_network_motifs(rm_wn; theiler=1)
# edge_count = 499, edge_density = 0.070
# n_triangles = 983.0 (ER null = 95.9), transitivity = 0.612, topological_entropy = 2.531
Interpretation of Results:
- Transition heatmaps (Left & Middle): The driven system concentrates probability mass along the superdiagonal cycle $1 \to 2 \to 3 \to 4 \to 1$, whereas the equilibrium walk distributes transitions symmetrically across forward and backward neighbors.
- Network transitivity (Right): Global transitivity measures the probability that two neighbors of a state are also neighbors of each other (triangle closure). Because Euclidean distance obeys the triangle inequality, even 2D white noise exceeds a non-metric Erdős–Rényi random graph ($0.612$ vs. $0.070$). Crucially, the periodic limit cycle exhibits higher transitivity ($0.714$) and higher spectral topological entropy ($3.058$ vs. $2.531$), reflecting a dense 1D closed manifold rather than a diffuse 2D cloud.
- State-space baseline:
rn_lc.random_mapping_baselineprovides the exactAnalyticComb.random_mapping_moments(120)expectation ($13.41$ periodic states across $3.07$ connected basins) as a reference for random finite-state deterministic maps of the same size.