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

Add support to CouplingMap for disjoint qubits #9710

Merged
merged 28 commits into from Mar 24, 2023

Commits on Mar 2, 2023

  1. Add support to CouplingMap for disjoint qubits

    Previously the CouplingMap class only supported graphs which were fully
    connected. This prevented us from modeling potential hardware which
    didn't have a path between all qubits. This isn't an inherent limitation
    of the underlying graph data structure but was a limitation put on the
    CouplingMap class because several pieces of the transpiler assume a path
    always exists between 2 qubits (mainly in layout and routing). This
    commit removes this limitation and also adds a method to get a subgraph
    CouplingMap for all the components of the CouplingMap. This enables us
    to model these devices with a CouplingMap, which is the first step
    towards supporting these devices in the transpiler.
    
    One limitation with this PR is most fo the layout and routing algorithms
    do not support disjoint connectivity. The primary exception being
    TrivialLayout (although the output might be invalid) VF2Layout and
    VF2PostLayout which inherently support this already. This commit lays
    the groundwork to fix this limitation in a follow-up PR but for the time
    being it just raises an error in those passes if a disconnected
    CouplingMap is being used. The intent here is to follow up to this commit
    soon for adding support for SabreLayout, SabreSwap, DenseLayout,
    and StochasticSwap to leverage the method get_component_subgraphs added
    here to make them usable on such coupling maps.
    mtreinish committed Mar 2, 2023
    Configuration menu
    Copy the full SHA
    4d134bb View commit details
    Browse the repository at this point in the history
  2. Remove coupling map connected check from NoiseAdaptiveLayout

    Noise adaptive layout doesn't use a CouplingMap so we can't check for a
    disconnected coupling map in it.
    mtreinish committed Mar 2, 2023
    Configuration menu
    Copy the full SHA
    b506d88 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    6b56517 View commit details
    Browse the repository at this point in the history
  4. Rename get_component_subgraphs to components and cache result

    This commit renames the get_component_subgraphs() method to components()
    which is much more consise name. At the same time this adds caching to
    the return just in case building the component subgraphs is expensive to
    compute we only need to ever do it once.
    mtreinish committed Mar 2, 2023
    Configuration menu
    Copy the full SHA
    25d3379 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    4113586 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    4d293ba View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    033b959 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    3d47405 View commit details
    Browse the repository at this point in the history

Commits on Mar 3, 2023

  1. Ensure self loops in CouplingMap.distance() return 0

    In a previous commit the distance() method was updated to handle
    disjoint graphs correctly. Prior to this PR it was expected to raise
    when a path didn't exist between 2 qubits by nature of the distance
    matrix construction failing if there was a disconnected coupling map.
    Since that isn't the case after this PR the error condition was
    changed to check explicitly that there is no path available and then
    error. However, there was an issue in this case and self loops would
    incorrectly error as well when instead they should return 0. This commit
    updates the error check to ignore self loops so they return correctly.
    mtreinish committed Mar 3, 2023
    Configuration menu
    Copy the full SHA
    e50a4c6 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    15500e9 View commit details
    Browse the repository at this point in the history
  3. Fix lint

    mtreinish committed Mar 3, 2023
    Configuration menu
    Copy the full SHA
    9111a7a View commit details
    Browse the repository at this point in the history

Commits on Mar 7, 2023

  1. Update CouplingMap.components() docstring

    Co-authored-by: Kevin Krsulich <kevin@krsulich.net>
    mtreinish and kdk committed Mar 7, 2023
    Configuration menu
    Copy the full SHA
    850e581 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    c4f2da5 View commit details
    Browse the repository at this point in the history
  3. Expand test coverage

    mtreinish committed Mar 7, 2023
    Configuration menu
    Copy the full SHA
    df6b891 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    8079699 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    654a965 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    b847ebc View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    42474df View commit details
    Browse the repository at this point in the history

Commits on Mar 8, 2023

  1. Rename CouplingMap.components to connected_components()

    THis commit renames the CouplingMap.components() method to
    connected_components(). It also adds an example to the docstring to
    better explain what a connected component is.
    mtreinish committed Mar 8, 2023
    Configuration menu
    Copy the full SHA
    0936fb0 View commit details
    Browse the repository at this point in the history
  2. Fix typo in relaese note

    mtreinish committed Mar 8, 2023
    Configuration menu
    Copy the full SHA
    91b8a0d View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    a4d2133 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    8957997 View commit details
    Browse the repository at this point in the history

Commits on Mar 15, 2023

  1. Configuration menu
    Copy the full SHA
    6ee0c34 View commit details
    Browse the repository at this point in the history

Commits on Mar 22, 2023

  1. Configuration menu
    Copy the full SHA
    55df39e View commit details
    Browse the repository at this point in the history
  2. Restore previous reduce() behavior

    The current reduce() error behavior of raising on trying to reduce to a
    disconnected coupling map is being depended on in other locations. To
    avoid a potentially breaking change this commit reverts the removal of
    that limitation in the method. We can look at doing that in the future
    independently of this PR because removing this specific restriction on
    the reduce() method is not 100% tied to generally allowing disconnected
    coupling map objects.
    mtreinish committed Mar 22, 2023
    Configuration menu
    Copy the full SHA
    a3cf7ff View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    2d13b6a View commit details
    Browse the repository at this point in the history
  4. Add missing import

    mtreinish committed Mar 22, 2023
    Configuration menu
    Copy the full SHA
    acebb43 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    f7112dd View commit details
    Browse the repository at this point in the history