Skip to content

Commit

Permalink
Simplify star pre-routing sort_key logic
Browse files Browse the repository at this point in the history
  • Loading branch information
mtreinish committed Jan 27, 2025
1 parent 14225cb commit 55b0ddf
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions qiskit/transpiler/passes/routing/star_prerouting.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,12 +342,11 @@ def tie_breaker_key(node):
processing_order = processing_order_index_map.get(node, None)
if processing_order is not None:
return processing_order
else:
if isinstance(node, (DAGInNode, DAGOutNode)):
return str(node.wire)
return ",".join(
f"{dag.find_bit(q).index:04d}" for q in itertools.chain(node.qargs, node.cargs)
)
if isinstance(node, (DAGInNode, DAGOutNode)):
return str(node.wire)
return ",".join(
f"{dag.find_bit(q).index:04d}" for q in itertools.chain(node.qargs, node.cargs)
)

rust_processing_order = _extract_nodes(dag.topological_op_nodes(key=tie_breaker_key), dag)

Expand Down

0 comments on commit 55b0ddf

Please sign in to comment.