Skip to content

[Bug]: pattern.draw fails to find flow or flow #349

Description

@matulni

Bug description
The method Pattern.draw_graph fails to find a flow on a pattern transpiled from circuit if the parameter flow_from_pattern is set to True (default behaviour).

If flow_from_pattern == False, the flow search is done on the underlying open graph and the function correctly finds a flow.

To Reproduce

from graphix.transpiler import Circuit
circuit = Circuit(2)
circuit.cnot(0, 1)
pattern = circuit.transpile().pattern
pattern.standardize()
print(pattern) # X(3,{2}) Z(0,{1}) Z(3,{1}) M(2) M(1) E(1,2) E(2,3) E(0,2) N(3) N(2)
pattern.draw_graph() # The pattern is not consistent with flow or gflow structure.
pattern.draw_graph(flow_from_pattern=False) # Flow detected in the graph.

Additional comments

This issue goes back at least to 73bac1f (unable to find a particular commit which might have broken this functionality).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions