-
Notifications
You must be signed in to change notification settings - Fork 2
Building Quantum Circuits
The 'Quantum' node library can be used to build and run quantum programs in Node-RED.
The 'Quantum Circuit' node can generate a quantum circuit with qubits. The qubits will then flow through a certain set of nodes corresponding to quantum operations, or gates. Finally, all qubits must be connected to a single output node that will process the circuit and output the results.
The nodes are organised into 4 categories:
-
Input (gray)
Input nodes are used to set up a quantum circuit and output qubits.
To start with, use the 'Quantum Circuit' node to generate one qubit through each output.
-
Qubit nodes (blue)
Qubit nodes are used to keep track and manage qubits, such as resetting them.
The 'Qubit' node receives qubits as input but does not execute any operation on it. It can be used to identify qubits, by printing some text under the node, or to rearrange the position of qubits into the editor.
-
Quantum gate nodes correspond to quantum operations. When a qubit flow through a quantum gate node, the operation is executed on the qubit.
There are 2 type of quantum gates:
-
Singe qubit gates (purple)
Single qubit gates receive a qubit, execute an operation and output the qubit.
The 'NOT Gate' flips the state of the qubit (0 → 1 & 1 → 0).
-
Multi qubits gates (red)
Multi qubit gates receive a certain number of qubits, execute a control operation and output the qubits. Control operations correspond to the conditional execution of a single quantum gate. If the 'control' qubits are in the correct state, then the gate is applied on a 'target' qubit.
The 'CNOT Gate', operating on 2 qubits, applies a NOT gate on the 'target' qubit if the 'control' qubit is in the '1' state.
-
-
Output nodes (grey)
Output nodes are used to process the quantum circuit and generate an output. All qubits of the quantum circuit must be connected to the same output node for it to work. The output format varies between each node, please refer to the documentation.
The 'Local Simulator' node simulates a quantum computer using the local Qiskit library. It runs the quantum circuit and outputs the results.
-
Do not duplicate qubits
There should always be 1 instance of each qubit at all times.
A node can take multiple qubits as input but only one wire should be connected to each output. To do so, always input as many qubits as the node outputs.
-
Only 1 quantum cicuit per Node-RED tab
A maximum of 1 quantum circuit must be used on each Node-RED tab.
If an issue occurs with multiple circuits, please refresh the page.
-
Wait for quantum circuit to execute
Do not double-click the inject button, wait for the circuit to have finished executing before runnning it again.
If an issue occurs, please refresh the page.
Input nodes | Qubit nodes | Single qubit gate nodes | Multi qubits gate nodes | Output nodes |
---|---|---|---|---|
Click on the images to access more detailed documentation on each node.
For more information about Node-RED Quantum, please refer to the official documentation pages: