| Deg | Vertices |
|---|
Vertices are all binary strings of length n with exactly k zeros — equivalently, k-element subsets of {1,…,n}. Two vertices are adjacent when swapping two neighboring positions (i, i+1) changes the string (one is 0, the other 1). The graph has |V| = C(n,k) vertices and is the Schreier coset graph of Sn over Sk × Sn−k.
Let zi = 1-based position of the i-th zero. A = 0k1n−k is the canonical vertex; A* = 1n−k0k is its antipode.
Selecting source = A in the right panel shows the full I(B) term-by-term breakdown. For an arbitrary source, the general Σ|xᵢ−yᵢ| formula is expanded.
Switch modes with the Node Color radio buttons in the left panel. Rings on A and A* are always visible regardless of mode.
1 — By degree (default)
Color = degree (number of incident edges = count of 01/10 bigrams in the string). A and A* always have degree 1.
| 1 | 2 | 3 | 4 | 5 | 6 | 7+ |
2 — d from A
Color = BFS distance from A, precomputed at build time. Green (d=0, A itself, gold) → red (d=k(n−k), which is always A*). Visualises the I-statistic I(B) = Σ(zᵢ−i) across the whole graph. Click-independent.
3 — d from A*
Exact complement of mode 2: color = BFS distance from A*. A* is gold; A is red. Nodes that were green in mode 2 are now red and vice versa.
4 — d from clicked source
BFS from whichever node you click. Gradient updates live. Falls back to degree coloring until a source is picked.
Permanent overlays (all modes)
Instantly stops all physics. All node velocities are zeroed. While frozen, A and A* get prominent text callouts with leader lines so they are easy to identify. The button turns amber and reads ▶ Unfreeze. Press again to resume physics. Useful when generating large graphs (e.g. n=10, k=4 has 210 nodes) that take a long time to settle before you want to use Sort Vertices or d(X,Y).
Click the button to enter pick mode: the canvas dims, the cursor becomes a crosshair, and a banner prompts you to click any node U as the BFS root. Press Esc to cancel.
BFS from U partitions all nodes into layers Ld = {v : d(U,v) = d}. Two sub-modes:
⬤ Concentric Rings
U sits at the center. The canvas radius is divided into nL equal bands (nL = number of layers). Layer d occupies the annular band [d·w, (d+1)·w] and nodes are placed at its mid-radius. Solid black boundary circles mark each ring boundary on a white disc background. Labels on the left and right show d=… / c=… (layer index / node count). The ring is rotated so the most-connected node to the previous layer sits at the top.
≡ Layered Rows
The canvas is divided into nL equal horizontal bands. Layer d fills band d, with nodes centered in the band. Within each row, nodes are ordered by the barycenter heuristic (average neighbor position in the previous row) to minimise crossings. Dashed separators and d=… / c=… badges mark each row. Use ▼ Top→Down / ▲ Bottom→Up to flip direction.
Node radius is auto-scaled so nodes fit inside their band when the graph has many layers. Exit via ✕ Exit Sort Mode, Esc, Shake, Generate, or Grid.
Click the button to open the calculator. Pick nodes X and Y by clicking them on the graph (they highlight with a blue ring and blue label) or by typing their bit-string labels in the input boxes. Once both are set, click ↳ Compute d(X,Y).
Three values are computed and shown in the right panel:
After computing, click any node to pick a new X and start a fresh query without leaving the mode. Click ✕ Exit to close.
The Distance Formulas panel always shows the closed-form diameter k(n−k). When |V| ≤ 350, a full BFS-from-every-vertex check is run at build time and the result is shown as BFS=24 ✓ (match) or BFS=4 ⚠ (mismatch, indicating a bug).