Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New implementation of a general graph mapper for ProjectQ #340

Open
wants to merge 25 commits into
base: develop
Choose a base branch
from

Conversation

Takishima
Copy link
Collaborator

This supersedes #324.

This implementation of a mapper for arbitrary graphs relies on storing the gates in a directed acyclic graph and then generating the swap operations in order to maximise the number of 2-qubit gates that can be applied simultaneously, while ensuring a minimal number of swaps.

Example of a use-case:

import networkx as nx
from projectq.cengines import GraphMapper

# Example of a 3x3 grid graph
mygraph = nx.Graph()
# Add horizontal edges
mygraph.add_edges_from((0, 1), (1, 2),  (3, 4), (4, 5),  (6, 7), (7, 8))
# Add vertical edges
mygraph.add_edges_from((0, 3), (3, 6),   (1, 4), (4, 7),  (2, 5), (5, 8))

mapper = GraphMapper(graph=mygraph)

# use as any other mapper

_graphmapper.py: minor updates
This new implementation is largely based on the SABRE algorithm [1].
Essentially, use cost functions to plan the next list of SWAP operations.

[1] https://arxiv.org/abs/1809.02573v2
TODO: rename the class and its associated file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant