I am trying to figure out how to use the functions "_make_pred_succ_maps". Here is a description of the function from Github:

def _make_pred_succ_maps(self, n):
    """Return predecessor and successor dictionaries.
        n (int): reference to self.multi_graph node id
        tuple(dict): tuple(predecessor_map, successor_map)
            These map from wire (Register, int) to predecessor (successor)
            nodes of n.

Nevertheless, I do not understand how to interpret outputs like the following:

>>> circuit_name._make_pred_succ_maps(1)
({}, {(QuantumRegister(3, 'a'), 0): 10})

>>> circuit_name._make_pred_succ_maps(2)
({(QuantumRegister(3, 'a'), 0): 41}, {})

What do the individual numbers mean?

  • 1
    $\begingroup$ I'm not familar with this function, but QuantumRegister(3, 'a') describes a register of three qubits, with the register assigned the name 'a'. $\endgroup$ Commented Mar 8, 2019 at 15:20
  • $\begingroup$ @JamesWootton Thank you for this info. Do you know what the other numbers mean? $\endgroup$
    – Samuel
    Commented Mar 9, 2019 at 16:06

1 Answer 1


(QuantumRegister(3, 'a'), 0) means the 0th qubit in a QuantumRegister called 'a' of size 3.

The other numbers (10 and 41) are node ids for the predecessors and successors of the node.

So what ({(QuantumRegister(3, 'a'), 0): 41}, {}) is saying is there is an edge from node 41 along wire (QuantumRegister(3, 'a'), 0) that ends at node 2 (the node you provided) and that this node has no successors as the second dict is empty.

It is also worth noting this is a private function and so should not really be used in this way.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.