---
title: Double Port Graphs in Quantum-Classical Computation
url: https://www.emergentmind.com/topics/double-port-graphs
type: topic
---

# Double Port Graphs in Quantum-Classical Computation

Searching arXiv for the cited papers and closely related background to ground the article.
Double port graphs are a double-categorical generalization of port graphs introduced to represent adaptive quantum computation with explicit separation between quantum and classical information flow. In this framework, a diagram has a shared vertex set equipped with two port-graph structures: a horizontal one, intended for quantum wires, and a vertical one, intended for classical wires. The defining condition is that the totalisation obtained by combining both directions is acyclic, so the combined quantum-classical dependency structure respects causal order. This formalism was developed as part of a unified account of circuit, measurement-based, magic-state, and measurement-based Pauli computation models, together with a semantics in terms of adaptive instruments and a contextuality analysis via simplicial instruments [2510.25915]. A distinct graph-theoretic notion, the class of doubled graphs arising from double-split graphs in perfect graph theory, is unrelated except for the lexical similarity of the word “double” [1012.3680].

## 1. Definition and formal construction

The starting point is the ordinary notion of a port graph. An \((m,n)\)-pre-port graph \(\Gamma\) consists of a finite set of vertices \(X\), linearly ordered input and output port sets at each vertex, and a bijection
\[
\iota : \underline{m} \amalg O \longrightarrow I \amalg \underline{n},
\]
where \(O=\coprod_{x\in X}\mathrm{out}(x)\) and \(I=\coprod_{x\in X}\mathrm{in}(x)\). The associated internal flow graph has vertices \(X\amalg \underline{n}\amalg \underline{m}\) and edges \(\underline{m}\amalg O\), with sources and targets determined by the local ports and the wiring bijection. A port graph is then a pre-port graph whose internal flow graph is acyclic [2510.25915].

A 2-fold port graph consists of a pair \((\Gamma_v,\Gamma_h)\) of port graphs with the same vertex set \(X\). The interpretation given in the source is geometric and computational: \(\Gamma_h\) is the horizontal structure, drawn with solid wires and intended to represent quantum flow, while \(\Gamma_v\) is the vertical structure, drawn with dashed wires and intended to represent classical flow [2510.25915].

The passage from a 2-fold port graph to a double port graph is governed by totalisation. For each vertex \(x\), one forms
\[
\mathrm{in}(x):=\mathrm{in}_v(x)\oplus \mathrm{in}_h(x), \qquad
\mathrm{out}(x):=\mathrm{out}_v(x)\oplus \mathrm{out}_h(x),
\]
using ordinal sum on finite linearly ordered sets. The two wiring bijections are then merged into a single bijection defining an \((m+k,n+\ell)\)-pre-port graph \(\mathrm{Tot}(\Gamma_v,\Gamma_h)\). A double port graph is precisely a 2-fold port graph whose totalisation is an acyclic port graph [2510.25915].

This condition is the central structural constraint. It means that although quantum and classical dependencies are represented in different directions, no directed cycle may arise when the two are viewed together. The source states that this is the formal encoding of causal or temporal order for adaptive computations: one obtains a partial order of boxes compatible with both quantum and classical dependencies [2510.25915].

## 2. Double-category structure

Double port graphs form a strict double category \(\mathsf{DPG}\) with a single object \(*\), horizontal and vertical 1-cells both given by \(\mathbb N\), and 2-cells given by isomorphism classes of double port graphs of the appropriate boundary type [2510.25915]. The boundary counts record, respectively, the numbers of horizontal and vertical wires entering and leaving the square.

Two compositions are defined. Horizontal composition composes quantum wires:
\[
(\Gamma_v,\Gamma_h)\circ(\Xi_v,\Xi_h):=(\Gamma_v\amalg \Xi_v,\ \Gamma_h\circ \Xi_h),
\]
where the horizontal part is composed by port-graph concatenation and the vertical part is juxtaposed by disjoint union. Vertical composition composes classical wires:
\[
(\Gamma_v,\Gamma_h)\bullet(\Xi_v,\Xi_h):=(\Gamma_v\circ \Xi_v,\ \Gamma_h\amalg \Xi_h),
\]
so now the vertical part is concatenated and the horizontal part is juxtaposed [2510.25915].

These operations are associative and unital up to isomorphism at the port-graph level, and the authors summarize the resulting structure as a strict double category. The unit is the empty-vertex port graph with matching boundary, and the double port graph condition is preserved under both compositions [2510.25915].

Conceptually, \(\mathsf{DPG}\) is a purely combinatorial double category of wiring diagrams with two distinct directions of composition. The horizontal direction records one mode of process connectivity and the vertical direction records another, with the intended reading in the computational applications being quantum versus classical flow [2510.25915].

## 3. Labels, syntax, and pasting

To attach computational meaning to vertices, the theory introduces port labels. A set \(L\) of labels is equipped with four arity functions
\[
s^h,t^h,s^v,t^v : L\to N,
\]
assigning to each label its numbers of horizontal inputs, horizontal outputs, vertical inputs, and vertical outputs. An \(L\)-labeled double port graph is a double port graph together with a labeling \(lab:X\to L\) such that the number of ports at each vertex matches the specified arities [2510.25915].

For every label set \(L\), one obtains a double category \(\mathsf{DPG}_L\) whose 2-cells are isomorphism classes of \(L\)-labeled double port graphs. A morphism of label sets \(f:L\to M\) respecting the four arity maps induces a double functor
\[
\overline f:\mathsf{DPG}_L\to\mathsf{DPG}_M
\]
by relabeling vertices. The paper packages this as a functor
\[
\mathsf{DPG}:\mathsf{PL}\to\mathsf{DCat}
\]
from port label sets to double categories [2510.25915].

A central operation is pasting. If a double port graph has vertices labeled by squares of another double category \(\mathsf{DPG}_L\), each such label can be expanded into a representative labeled double port graph and inserted at the corresponding vertex. The resulting object is again a double port graph, and this construction yields a double functor
\[
\mathrm{paste}_L:\mathsf{DPG}_{Sq(\mathsf{DPG}_L)}\to\mathsf{DPG}_L.
\]
Combined with a labeling \(f:M\to Sq(\mathsf{DPG}_L)\), this gives a composite double functor \(f_*\) that implements expansion of high-level gadgets into lower-level primitives [2510.25915].

This pasting mechanism is the formal basis for translations between computational models. The source explicitly states that it is used for translation of circuit gates into MBQC patterns, translation of circuit gates into magic-state gadgets, and translation from MBPC to QCM [2510.25915]. A plausible implication is that the formalism is designed not merely to draw computations, but to support compositional compilation.

## 4. Semantics via adaptive instruments

The semantic target for double port graphs is a double category of adaptive instruments. For finite-dimensional Hilbert spaces \(V,W\), \(\mathrm{CP}(V,W)\) denotes completely positive linear maps \(L(V)\to L(W)\). An instrument with outcome set \(Y\) is a function \(\Phi:Y\to\mathrm{CP}(V,W)\) such that \(\sum_{y\in Y}\Phi^y\) is a channel. The adaptive version used in the paper is a square
\[
\Phi:X\times Y\to \mathrm{CP}(V,W)
\]
such that for each \(a\in X\),
\[
\sum_{b\in Y}\Phi_a^b
\]
is a channel [2510.25915].

The associated double category \(\mathsf{Inst}\) has a single object \(*\), vertical 1-cells given by Hilbert spaces, horizontal 1-cells given by sets, and 2-cells given by adaptive instruments. Horizontal composition is sequential composition of channels,
\[
(\Psi\circ\Phi)_{(a_1,a_2)}^{(b_1,b_2)}=\Psi_{a_2}^{b_2}\circ\Phi_{a_1}^{b_1},
\]
while vertical composition is parallel tensor composition followed by summation over shared classical outcomes,
\[
(\Psi\bullet\Phi)_{(a,c)}^{(x,z)}:=\sum_y \Phi_a^y\otimes\Psi_y^c
\]
[2510.25915].

For qubit systems and Boolean classical spaces, the paper restricts to the full sub-double-category \(\mathsf{QBit}\subset\mathsf{Inst}\), whose squares have qubit Hilbert spaces \((\mathbb C^2)^{\otimes m}\) and classical spaces \(Z_2^k\). In this setting,
\[
H(\mathsf{QBit})\cong \mathsf{QChan},
\qquad
V(\mathsf{QBit})\cong \mathsf{Bool}_D,
\]
so the horizontal category recovers qubit channels and the vertical category recovers the Kleisli category on Boolean spaces [2510.25915].

Semantics is then assigned by mapping labels to squares of \(\mathsf{QBit}\) and evaluating labeled double port graphs by pasting. The paper gives double functors
\[
\phi_L:\mathsf{DPG}_L\to \mathsf{QBit}
\]
for several label sets \(L\), including Boolean computation, circuit computation, MBQC, magic-state computation, and MBPC [2510.25915]. Under these functors, a double port graph is interpreted as an adaptive instrument, i.e. as a concrete quantum-classical process.

## 5. Quantum and classical flow in adaptive computation

The principal conceptual contribution of double port graphs is the explicit geometric separation of quantum and classical flow. The horizontal direction is identified with quantum flow, represented by solid wires and composed as quantum channels. The vertical direction is identified with classical flow, represented by dashed wires and composed as stochastic maps encoded via the distribution monad [2510.25915].

This differs from standard string-diagrammatic approaches in categorical quantum mechanics, where both quantum and classical information typically inhabit a single diagrammatic dimension and classicality is handled by additional algebraic structure. Here the distinction is built directly into the two-dimensional shape of the diagram [2510.25915].

A basic box in the formalism has left and right solid boundaries for quantum input and output, and top and bottom dashed boundaries for classical input and output. Formally it is a square in \(\mathsf{QBit}\) representing an adaptive instrument \(\Phi:X\times Y\to\mathrm{CP}(V,W)\) [2510.25915]. Adaptivity is expressed by dashed wires connecting the output of one box to the input of another, so that a classical outcome controls a later quantum operation or measurement basis.

The acyclicity of the totalisation forbids feedback loops that would violate causal order. The source emphasizes that one cannot use the outputs of a box to control a box earlier in the quantum flow, or earlier through some classical path [2510.25915]. This makes double port graphs especially suited to measurement-based and adaptive architectures, in which classical side-processing and quantum evolution interleave.

## 6. Representation of computational models

The formalism is used to define several syntactic double categories corresponding to standard computational models. Specific label sets are introduced for Boolean circuits \(B\), quantum circuits \(C\), MBQC \(M\), magic-state computation \(Q\), and MBPC \(P,\widetilde P\), leading to double categories such as \(\mathsf{DPG}_B\), \(\mathsf{DPG}_C\), \(\mathsf{DPG}_M\), and \(\mathsf{DPG}_Q\) [2510.25915].

For Boolean computation, the vertical direction suffices. The Boolean label set contains \(\mathbf 1\)-state, delete, xor, or, and copy, and its interpretation has trivial quantum part and purely classical stochastic semantics. When restricted to \(B_\oplus=B\setminus\{OR\}\), the image is exactly the category \(\mathsf{Aff}\) of affine Boolean maps over \(\mathbb Z_2\) [2510.25915].

For quantum circuits, the label set \(C\) contains \(N_Z\), \(H\), \(T\), \(E\), and \(M_Z\). The associated semantics functor
\[
\phi_C:\mathsf{DPG}_C\to\mathsf{QBit}
\]
interprets these as the corresponding preparations, unitaries, entangling gates, and measurements. The horizontal monoidal category of the image is the subcategory of \(\mathsf{Chan}\) whose morphisms are unitaries generated by these gates, and by Solovay–Kitaev this is dense in all unitaries \(\mathsf{QUni}\) on qubit Hilbert spaces [2510.25915]. The vertical monoidal category is \(\mathsf{Rev}_D\), reversible classical computation with probabilistic interpretation [2510.25915].

For MBQC and magic-state models, analogous label sets and semantics are provided. The paper states that \(M\) includes \(N_X,E\), \(X,Z\)-corrections \(C\), and angle measurements \(M_\alpha\), while \(Q\) includes magic state preparation \(N_T\), entangling \(E\), corrections \(S,H\), non-destructive measurement \(\widetilde M_Z\), and trace [2510.25915]. These models appear as double subcategories \(\mathsf{MBQC},\mathsf{QCM}\subset\mathsf{QBit}\).

A key feature is functorial model conversion. The paper exhibits double functors such as
\[
\kappa_{C,M[\pi/4]}:\mathsf{DPG}_C\to\mathsf{DPG}_{M[\pi/4]},
\qquad
\kappa_{C,Q}:\mathsf{DPG}_C\to\mathsf{DPG}_Q,
\]
with commuting semantics
\[
\phi_M\circ \kappa_{C,M[\pi/4]}=\phi_C,
\qquad
\phi_Q\circ \kappa_{C,Q}=\phi_C
\]
[2510.25915]. Thus conversion between syntactic models preserves the global adaptive instrument.

## 7. Contextuality, simplicial instruments, and computational power

The framework extends beyond syntax and ordinary semantics to a contextuality theory for adaptive computation. The paper upgrades instruments from sets to simplicial sets by defining a simplicial instrument as a simplicial map
\[
\Phi:X\to \mathrm{CP}_{V,W}(Y),
\]
where \(\mathrm{CP}_{V,W}\) is first defined on sets by sending \(X\) to the set of instruments \(X\to\mathrm{CP}(V,W)\), and then extended levelwise to simplicial sets [2510.25915]. This yields another one-object double category \(\mathsf{sInst}\), whose horizontal category is again \(\mathsf{Chan}\) and whose vertical category is the Kleisli category \(\mathsf{sSet}_D\) of simplicial distributions [2510.25915].

A simplicial distribution is a Kleisli arrow \(p:X\to D(Y)\). It is non-contextual if it lies in the image of the convex map
\[
\Theta: D(\mathsf{sSet}(X,Y))\to \mathsf{sSet}(X,D(Y)),
\]
and strongly contextual if its support is empty in the sense stated in the source [2510.25915]. The non-contextual fraction and contextual fraction are defined by
\[
\mathrm{NCF}(p):=\sup\{\lambda\in[0,1]:p=\lambda q+(1-\lambda)q',\ q\text{ non-contextual}\},
\qquad
\mathrm{CF}(p):=1-\mathrm{NCF}(p)
\]
[2510.25915].

The relevant adaptive scenarios are encoded using Bell instruments and simplicial sets built from joins of \(S^0=\Delta^0\amalg\Delta^0\). For an \(m\)-qubit Bell instrument \(\Phi\) and a state \(\rho\), one obtains a simplicial distribution
\[
p_\rho(\Phi):S^m\to D(\Upsilon^1)
\]
via the Born rule [2510.25915]. This provides a bridge from double-port-graph-based computation to contextuality measures.

The main computational result gives a quantitative bound. For a Boolean function \(f:Z_2^m\to Z_2^\ell\), an \(m\)-qubit state \(\rho\), an \(m\)-Bell instrument \(\Phi\), and an affine Boolean post-processing map \(h\), the average success probability satisfies
\[
p_{\mathrm{succ}(p(\rho,\Phi,h),f)}
\;\le\;
1-\mathrm{NCF}(p_\rho(\Phi))\,\nu(f),
\]
where \(\nu(f)\) is the distance from \(f\) to the affine Boolean functions [2510.25915]. The paper states the corollaries explicitly: if the underlying simplicial distribution is non-contextual, then deterministic computation forces \(f\) to be affine; if \(f\) is non-affine and the computation is perfect, then the simplicial distribution must be strongly contextual [2510.25915].

Within this analysis, double port graphs serve as the syntactic description of adaptive MBPC protocols whose semantic interpretation yields the instruments entering the contextuality theorem. This suggests that their role is not limited to diagrammatic convenience: they provide the combinatorial interface between model syntax, operational semantics, and resource-theoretic constraints.

## 8. Relation to graph theory and terminological disambiguation

The term “double port graph” should be distinguished sharply from graph-theoretic notions involving double-split or doubled graphs. In perfect graph theory, a double-split graph is a graph whose vertex set is partitioned into matched and antimatched parts satisfying an alignment condition, and a doubled graph is an induced subgraph of a double-split graph [1012.3680]. That theory culminates in a forbidden induced subgraph characterization with 44 minimal obstructions for doubled graphs [1012.3680].

Despite superficial lexical overlap, the two subjects differ in ontology, motivation, and formalism. The graph-theoretic doubled graphs of perfect graph theory are finite simple graphs studied through induced subgraphs, complements, and obstruction sets [1012.3680]. By contrast, double port graphs are 2-fold port graphs with total acyclicity, organized as 2-cells of a strict double category and used to model adaptive quantum-classical computation [2510.25915].

This distinction matters because both theories use the word “double” structurally, but only the latter uses ports, directional wiring, double-categorical composition, and semantics in adaptive instruments. A plausible implication is that the phrase “double port graph” is best reserved for the categorical-computational notion, while “doubled graph” should be retained for the induced-subgraph closure of double-split graphs in perfect graph theory.

Source: https://www.emergentmind.com/topics/double-port-graphs