Skip to content

[Bug]: _check_flow_general_properties rejects empty graphs #531

@thierry-martinez

Description

@thierry-martinez

_check_flow_general_properties rejects empty graphs with PartialOrderError(PartialOrderErrorReason.Empty), even though the formal definitions of flows do not exclude empty graphs. As a result, flow‑extraction procedures return an empty flow object for an empty graph, but that object then fails the well‑formedness check.

def test_empty_graph() -> None:
    og = OpenGraph(graph=nx.Graph(), input_nodes=[], output_nodes=[], measurements={})
    pf = og.extract_causal_flow()
    pf.check_well_formed() # raises PartialOrderError(PartialOrderErrorReason.Empty)

Edit: I copy-pasted the wrong exception. In this example, pf.check_well_formed() raises graphix.flow.exceptions.PartialOrderLayerError: The first layer of the partial order must contain all the output nodes of the open graph and cannot be empty. First layer: frozenset().

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions