cirq.get_placements
Get 'placements' mapping small_graph nodes onto those of big_graph
.
cirq.get_placements(
big_graph: nx.Graph, small_graph: nx.Graph, max_placements=100000
) -> List[Dict]
Used in the notebooks
This function considers monomorphisms with a restriction: we restrict only to unique set
of big_graph
qubits. Some monomorphisms may be basically
the same mapping just rotated/flipped which we purposefully exclude. This could
exclude meaningful differences like using the same qubits but having the edges assigned
differently, but it prevents the number of placements from blowing up.
Args |
big_graph
|
The parent, super-graph. We often consider the case where this is a
nx.Graph representation of a Device whose nodes are cirq.Qid s like GridQubit s.
|
small_graph
|
The subgraph. We often consider the case where this is a NamedTopology
graph.
|
max_placements
|
Raise a value error if there are more than this many placement
possibilities. It is possible to use big_graph , small_graph combinations
that result in an intractable number of placements.
|
Raises |
ValueError
|
if the number of placements exceeds max_placements .
|
Returns |
A list of placement dictionaries. Each dictionary maps the nodes in small_graph to
nodes in big_graph with a monomorphic relationship. That's to say: if an edge exists
in small_graph between two nodes, it will exist in big_graph between the mapped nodes.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-06-27 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-06-27 UTC."],[],[]]