Interactive quantum circuit playground with a free-form builder and an algorithm walkthrough.
Live site: https://nomicflux.github.io/entangled-graphs/
The app has three top-level tabs:
- Free-Form
- Build and run your own circuits.
- The page is split into:
- Prepared State (left)
- Configure each qubit (
Q0,Q1, …) with Bloch sliders (theta,phi). - Use quick presets for common states:
100% |0>100% |1>50/50
- Circuit (middle)
- Time moves left to right by columns.
- Click/drag gates into slots on qubit rows.
- Supports single-qubit, multi-qubit, and custom gates.
- Measurement gates (
M) can be placed in-circuit. - Measurement (right)
- Click Measure to run a sample from the prepared state through the circuit.
- View output probabilities and recent sample outcomes.
- If in-circuit measurements exist, you can resample from specific measurement points.
- p-adic
- Free-form circuit workspace with p-adic preparation and model-weighted measurement.
- The page is also split into:
- Prepared State (left)
- Qubit count starts at
2, can be adjusted from1..8. - Per-qubit amplitudes are entered explicitly as raw values (
a,b), including simplepexpressions. - Prime selector is limited to
p in {2, 3, 5, 7}.
- Qubit count starts at
- Circuit (middle)
- Same interaction model as free-form (drag single-qubit, staged multi-wire, in-circuit
Mrow lock). - Includes a
p-adic State Maptied to selected stage snapshots. - Geometry modes:
padic_vector(digit-vector/fractal-style embedding from base-pdigits)valuation_ring(radius from valuation-derived norm, angle from residue class)
- Includes transition replay animation between stage selections.
- Gate palette only shows p-adic-supported gates:
- 1 qubit:
I,X,Z,M - 2 qubits: plus
CNOT,SWAP - 3+ qubits: plus
TOFFOLI,CSWAP
- 1 qubit:
- Custom gate builders are not shown in p-adic v1.
- Same interaction model as free-form (drag single-qubit, staged multi-wire, in-circuit
- Measurement (right)
- Measurement model is selectable:
valuation_weightcharacter_basedoperator_ensemble
- Results are shown as normalized model weights
w_pand support replay/resample from in-circuit measurement points. - Includes a
p-adic Value Inspectortable with per-basis:w_raw,w_p,v_p,|.|_p, residue class, base-pdigits.
- Measurement model is selectable:
- Algorithms
- Contains guided algorithm views.
- Current algorithm views:
- Teleportation
- Deutsch
- Set your initial qubit states in Prepared State.
- Build a circuit in the center panel.
- Click Measure to sample outcomes.
- Compare:
- Stage snapshots in the circuit panel
- Final output distribution in the measurement panel
- Recent sample history
- Switch to p-adic.
- Set prime
p(2,3,5, or7) and qubit count (1..8). - Enter prepared amplitudes for each qubit (
a,b) or use presets. - Build a circuit with the available p-adic gate palette.
- Choose a measurement model and click Measure.
- Compare:
- Model-weighted stage snapshots and Stage Inspector (
w_plabels) - p-adic State Map geometry + transition flow
- p-adic Value Inspector per-basis metrics
- Final output distribution (
w_p) - In-circuit outcome path and resample points
- Switch to Algorithms and open Teleportation.
- Set source
|q0⟩with sliders/presets. - Inspect the fixed teleportation backbone and stage snapshots.
- In Teleportation Outputs:
- Toggle correction mode:
AutoappliesZ(m0)andX(m1).Manuallets you chooseZandXseparately.
- Click Run Sample to execute one sampled run.
- Use Resample from this point on in-circuit measurement outcomes to replay from that measurement onward.
- Compare:
- Expected output distribution for the current correction mode
- Sampled output distribution
- Fidelity to source and branch table details
- Switch to Algorithms and open Deutsch.
- In Select mode:
- Choose one oracle from the standard four (
f=0,f=1,f=x,f=not x). - Edit
q0andq1inputs if you want to probe non-canonical setups.
- Inspect the fixed Deutsch backbone:
- Starts from your prepared
|q0 q1⟩with an explicit initialXonq1, - then
Hlayer,U_f, and finalHonq0.
- In Results:
- Read expected
q0verdict (constantvsbalanced) and full 2-qubit distribution. - Run sampled executions to compare sampled vs expected verdicts.
- Use Guess mode to hide oracle identity:
- infer class from outputs/interference,
- submit guess (
constantorbalanced), - reveal correctness, then start a new hidden round.
Mmeasures one row at its column.- After an
M, that row is locked for later columns. Mcollapses the state branch at that point (no automatic qubit reset/reprepare).- Entanglement effects propagate to other rows through the state.
- You can replay from any in-circuit measurement point in the Measurement panel.
- In p-adic mode, branch and final distributions are interpreted as normalized model weights (
w_p) under the selected measurement model. - In p-adic mode, stage-map coordinates come from selected geometry mode and do not change computed
w_p.
- Entanglement is shown directly on the circuit columns as arcs between rows.
- Pairwise arcs:
- Color reflects dominant Bell-basis component.
- Thickness/opacity reflect Bell-derived strength.
- Multipartite bands:
- Highlight components with 3+ qubits that are entangled as one component.
- Strength uses minimum cut entropy across cuts that split that component:
strength(C) = min S(rho_A)over all bipartitionsA | C\\Aof componentC.
- Arcs appear where entanglement increases along the circuit timeline.
- Hovering an arc or band shows its exact rows and strength metric.
In the Teleportation view, these overlays stay active on the fixed algorithm backbone. In the Deutsch view, overlays and stage snapshots update with oracle/input changes.
- Multipartite overlays appear only when a
3+qubit component exceeds strength thresholds used to keep the view readable. - Bell-arc strength is Bell-basis-derived and highlights dominant pairwise character; it is not a full entanglement monotone.
- Multipartite strength is cut-entropy-based and is strongest for highly non-separable components; near-zero values are visually suppressed.
- You can create custom single-qubit and multi-qubit gates from the circuit tools.
- Custom gates are saved and can be reused.
- Alt-click a custom gate chip to delete it.
- p-adic workspace does not expose custom gate builders in v1.
- p-adic amplitudes are currently normalized and evolved through the existing complex-number operator pipeline, then re-weighted by the selected p-adic measurement model.
- Stage map geometry is a deterministic embedding proxy (
padic_vector/valuation_ring), not a full p-adic manifold reconstruction. - Bloch visualization is retained as a secondary derived projection; p-adic map + inspector are the primary views.
- p-adic v1 gate set is intentionally limited to built-ins listed above.
- No p-adic custom gate builder in v1.
- Prime choices are restricted to
{2, 3, 5, 7}.
src/components/UI panels and interactionssrc/components/padic/p-adic workspace panels and interactionssrc/state/state model, selectors, and actionssrc/quantum/quantum simulation, measurement, Bloch, and entanglement logicsrc/quantum/padic/p-adic parsing, model weighting, ensemble simulation, and sampling modulessrc/operator.tsbuilt-in and constructed operatorstests/behavior and regression testsdocs/current-plans/active implementation plans