-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
area/devicesgood first issueThis issue can be resolved by someone who is not familiar with the codebase. A good starting issue.This issue can be resolved by someone who is not familiar with the codebase. A good starting issue.kind/feature-requestDescribes new functionalityDescribes new functionalitytriage/acceptedA consensus emerged that this bug report, feature request, or other action should be worked onA consensus emerged that this bug report, feature request, or other action should be worked on
Description
Routing utilities currently present in cirq contrib expect a networkx graph of device (/target topology) where each node is a cirq.Qid
. NamedTopology
stores topology graphs where each node is a number / tuple.
TiltedSquareLattice
has a nodes_to_gridqubits
method which can provide a mapping from the graph nodes to the corresponding grid qubits.
def nodes_to_gridqubits(self, offset=(0, 0)) -> Dict[Tuple[int, int], 'cirq.GridQubit']: |
This can be used to quickly get the graph needed for routing circuits from the topology graph as follows:
routing_graph = nx.relabel_nodes(topology.graph, topology.nodes_to_gridqubits())
A similar convenience method, nodes_to_linequbits
, should be added to the LineQubit
named topology as well.
cc @mpharrigan
Metadata
Metadata
Assignees
Labels
area/devicesgood first issueThis issue can be resolved by someone who is not familiar with the codebase. A good starting issue.This issue can be resolved by someone who is not familiar with the codebase. A good starting issue.kind/feature-requestDescribes new functionalityDescribes new functionalitytriage/acceptedA consensus emerged that this bug report, feature request, or other action should be worked onA consensus emerged that this bug report, feature request, or other action should be worked on