Skip to content

Align RXFilter edge query semantics with SQLFilter#314

Merged
JoOkuma merged 2 commits into
royerlab:mainfrom
JoOkuma:fix-rxfilter-edge-semantics
Jul 1, 2026
Merged

Align RXFilter edge query semantics with SQLFilter#314
JoOkuma merged 2 commits into
royerlab:mainfrom
JoOkuma:fix-rxfilter-edge-semantics

Conversation

@JoOkuma

@JoOkuma JoOkuma commented Jul 1, 2026

Copy link
Copy Markdown
Member

Two defects in the rustworkx filter's edge queries:

  1. With include_sources=True, edges with both endpoints selected were returned twice (visited via both out_edges and in_edges).
  2. Endpoint membership was only enforced with explicit node_ids and no include flags, so edges leaked outside the selection — e.g. filter(NodeAttr("t") == 1).edge_attrs() returned edges into t == 2, disagreeing with SQLGraph and with the same filter's subgraph().

Deduplicate visited edges and enforce SQLFilter's rule: source must be selected unless include_sources, target unless include_targets.

Added a backend-parametrized regression test.

The rustworkx backend's filter returned wrong edges in two ways:

1. With include_sources=True, an edge whose endpoints were both
   selected was visited twice (out_edges of its source and in_edges of
   its target) and returned duplicated.

2. Endpoint membership was only enforced when explicit node_ids were
   given AND no include flag was set. Edges leaving the selected set
   leaked into the result for attribute-filtered queries (e.g.
   filter(NodeAttr('t') == 1).edge_attrs() returned edges into t == 2)
   and whenever include_sources/include_targets was set. This also made
   filter(...).edge_attrs() disagree with filter(...).subgraph() and
   with the SQL backend.

Deduplicate visited edges and enforce SQLFilter's rule: the source must
be in the selected set unless include_sources, the target unless
include_targets.
@JoOkuma JoOkuma merged commit c78374f into royerlab:main Jul 1, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant