[1]:
from diskit import *
import warnings

warnings.filterwarnings("ignore")

Example to create a topology

[ ]:
circuit_topo = Topology()
circuit_topo.create_qmap(3, [2, 3, 3], "sys")
circuit_topo.qmap, circuit_topo.emap

In-built functions to support actions in topology class

[3]:
print("Total Number of Qubits in Topology : ", circuit_topo.num_qubits())
print("Total Number of QPUs in Topology: ", circuit_topo.num_hosts())

Qubit1 = circuit_topo.qmap["sys1"][2]
Qubit2 = circuit_topo.qmap["sys2"][1]
print("{} and {} are adjacent".format(Qubit1, Qubit2)
      if circuit_topo.are_adjacent(Qubit1, Qubit2) else
      "{} and {} are not adjacent".format(Qubit1, Qubit2))

for qubit in circuit_topo.qubits:
    print("Qubit: {} --------- Host: {}".format(qubit, circuit_topo.get_host(qubit)))
Total Number of Qubits in Topology :  8
Total Number of QPUs in Topology:  3
Qubit(QuantumRegister(3, 'sys1'), 2) and Qubit(QuantumRegister(3, 'sys2'), 1) are not adjacent
Qubit: Qubit(QuantumRegister(2, 'sys0'), 0) --------- Host: sys0
Qubit: Qubit(QuantumRegister(2, 'sys0'), 1) --------- Host: sys0
Qubit: Qubit(QuantumRegister(3, 'sys1'), 0) --------- Host: sys1
Qubit: Qubit(QuantumRegister(3, 'sys1'), 1) --------- Host: sys1
Qubit: Qubit(QuantumRegister(3, 'sys1'), 2) --------- Host: sys1
Qubit: Qubit(QuantumRegister(3, 'sys2'), 0) --------- Host: sys2
Qubit: Qubit(QuantumRegister(3, 'sys2'), 1) --------- Host: sys2
Qubit: Qubit(QuantumRegister(3, 'sys2'), 2) --------- Host: sys2