Skip to content

[Bug]: GraphVisualizer __init__ generates measurements on output nodes when no measurement planes supplied #350

Description

@emlynsg

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

# Graph with no measurement planes (fails with error)
from __future__ import annotations
import networkx as nx
from graphix.visualization import GraphVisualizer

nodes = [1, 2, 3]
edges = [(1, 2), (1,3), (2, 3)]
inputs = {1}
outputs = {2}
graph: nx.Graph[int] = nx.Graph()
graph.add_nodes_from(nodes)
graph.add_edges_from(edges)
vis = GraphVisualizer(graph, inputs, outputs, meas_plane=None)
vis.visualize(show_measurement_planes=False)

Expected behavior
Expect init to follow the same process of checking the measurement nodes are provided as input. If they are not, it should only generate measurements for non-output nodes.

Environment:

  • OS: Ubuntu 24.04.3 LTS
  • Python version: 3.13.7
  • Related module versions if applicable: As per requirements.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions