Skip to content

Commit

Permalink
fix of router hanging #2282 (#2619)
Browse files Browse the repository at this point in the history
break if no adjacent connections
  • Loading branch information
askolik authored and bryano committed Dec 6, 2019
1 parent 2b88d34 commit 6d81ddb
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cirq/contrib/routing/greedy.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,13 @@ def apply_next_swaps(self):
]
if len(candidate_swap_sets) == 1:
self.apply_swap(*candidate_swap_sets[0])
return

if list(
self.remaining_dag.findall_nodes_until_blocked(
self.acts_on_nonadjacent_qubits)):
return
else:
break

frontier_edges = sorted(time_slices[0].edges)
self.bring_farthest_pair_together(frontier_edges)
Expand Down

0 comments on commit 6d81ddb

Please sign in to comment.