Home▸Algorithms & AI▸Boolean Network — Kauffman NK Model (2D)

Boolean Network — Kauffman NK Model (2D)

A 2D Canvas companion to the Kauffman NK Boolean network: two synchronous state trajectories scroll live as coloured strips, a Hamming-distance plot tracks how far they've drifted apart, and N/K sliders let you cross the order-chaos boundary directly.

Algorithms & AI2DModerate60 FPS📱 Mobile-adapted⇄ 3D version
2d-boolean-network ↗ Open standalone

The 3D version renders the Kauffman NK Boolean network as an instanced grid inside a WebGL scene; this 2D companion draws the identical model — the same random wiring, the same random truth tables, the same synchronous update rule — as two scrolling strip-charts on a plain Canvas 2D surface. State A and State B start one bit apart and update in lockstep every tick; the Hamming-distance plot underneath is the live measurement of how far apart they drift, which is the whole story of the order-chaos transition in one number.

⚙ Under the hood

N binary nodes, each wired to K random inputs and governed by an independently randomised Boolean truth table, updated synchronously every step. Two trajectories (State A, State B) start one bit apart; their Hamming distance is tracked every tick and a simple state-hash lookup detects the first repeated state to report attractor cycle length.

Boolean networkKauffmanNK modelchaosattractor

2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install

Frequently Asked Questions

Why does the same K value always end up ordered, critical, or chaotic?

Each node's output is a random Boolean function of K inputs, so on average a perturbation propagates to a downstream node with probability 1/2. If K × 1/2 < 1 (K = 1) perturbations shrink — ordered. If K × 1/2 > 1 (K ≥ 3) they grow — chaotic. At K = 2 the branching ratio is exactly 1: the critical point, also called the edge of chaos.

What does the Hamming-distance plot actually show?

It counts how many of the N nodes differ between State A and State B at every tick. State B starts exactly one bit away from State A; watching whether that single-bit gap heals toward 0, settles at a stable value, or grows toward N/2 is the network's analogue of a Lyapunov exponent.

How is the cycle length detected?

Since a network with N nodes has only 2^N possible states, a deterministic trajectory must eventually repeat one. The simulator hashes every state of Trajectory A into a list and checks each new state against it; the first repeat's distance back to its earlier occurrence is the attractor's cycle length.

What did you find?

Add reproduction steps (optional)