Skip to content

[Bug]: Measurement order arrow outside of frame in flow visualisation #535

@matulni

Description

@matulni

The "Layer" arrow in flow visualisation appears outside the plot frame for linear graphs.
In general, we expect it to be at a fixed, constant distance between the lower open graph nodes and the plot frame.

Incorrect behavior:

from graphix import OpenGraph, PauliExponential, Plane
import networkx as nx

og = OpenGraph(graph=nx.Graph([(0, 1), (1, 2), (2, 3)]), input_nodes=[0], output_nodes=[3], measurements=dict.fromkeys(range(3), Plane.XY))
flow = og.extract_causal_flow()

flow.draw()
Image

Correct behaviour (for non-linear open graphs):

from graphix import OpenGraph, PauliExponential, Plane
import networkx as nx

og = OpenGraph(graph=nx.Graph([(0, 2), (2, 4), (1, 3), (3, 5), (2, 3)]), input_nodes=[0, 1], output_nodes=[4, 5], measurements=dict.fromkeys(range(4), Plane.XY))
flow = og.extract_causal_flow()

flow.draw()
Image

The potential fix should make methods GraphVisualizer._set_plot_lims and GraphVisualizer._draw_layers in the visualization.py module more robust.

Metadata

Metadata

Assignees

No one assigned

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions