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

Wires names #1130

Closed
Simone-Bordoni opened this issue Dec 11, 2023 · 1 comment · Fixed by #1134
Closed

Wires names #1130

Simone-Bordoni opened this issue Dec 11, 2023 · 1 comment · Fixed by #1134
Assignees
Labels
enhancement New feature or request

Comments

@Simone-Bordoni
Copy link
Contributor

Simone-Bordoni commented Dec 11, 2023

Add the possibility to define wires names in a circuit. They will be printed using circuit.draw() instead of the standard "q0", "q1", "q2"... This is useful when transpiling circuits on a subset of qubits to avoid deceptive printing.

example:

circuit = Circuit(3, wires_names = ['ancilla', 'hi', 'q2'])
circuit.draw()

ancilla: -------
hi : -------
q2 : --------

another possibility can be passing a dictionary used to rename only a subset of wires like:

circuit = Circuit(3, wires_names = {'q0': 'ancilla', 'q2': 'hi'})
circuit.draw()

ancilla: -------
q1 : -------
hi : --------

It is important that wires names is not just an argument of the draw function as the transpiled circuit should have the same name of the wires as the physical qubits.
for example:

topology = nx.Graph()
topology.add_nodes_from([0, 1, 2, 3, 4])
topology.add_edges_from([(0, 2), (1, 2), (2, 3), (2, 4)])
transpiler = Passes(connectivity=topology, qubits=[2,4])
circuit = Circuit(2)
transpiled_circuit, qubit_map = transpiler(circuit)
transpiled_circuit.draw()

q2 : -------
q4 : -------

@Simone-Bordoni Simone-Bordoni added the enhancement New feature or request label Dec 11, 2023
@Simone-Bordoni Simone-Bordoni self-assigned this Dec 11, 2023
@renatomello
Copy link
Contributor

I think both ways suggested are good and should be implemented. It gives flexibility.

@Simone-Bordoni Simone-Bordoni linked a pull request Dec 12, 2023 that will close this issue
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants