Skip to content

Fix unbatch for COO batches with zero-edge graphs#652

Merged
CarloLucibello merged 2 commits intoJuliaGraphs:masterfrom
Parvm1102:fix/unbatch-zero-edge-graphs
Mar 22, 2026
Merged

Fix unbatch for COO batches with zero-edge graphs#652
CarloLucibello merged 2 commits intoJuliaGraphs:masterfrom
Parvm1102:fix/unbatch-zero-edge-graphs

Conversation

@Parvm1102
Copy link
Copy Markdown
Contributor

closes #650

The previous implementation inferred edge boundaries by looking for the first edge of the next graph, which breaks when an intermediate graph has no edges. This could assign edges to the wrong graph during unbatch.

FIX

  • replace boundary inference in _unbatch_edgemasks with direct edge bucketing by graph
  • it creates one edge bucket per graph
  • it iterates over edges once
  • for each edge, it computes the owning graph from the source node’s interval in cumnum_nodes
  • it pushes that edge into the correct bucket

TESTS

  • add regression tests for zero-edge graphs in COO batches, including feature roundtrips

@CarloLucibello CarloLucibello merged commit b9cdc0f into JuliaGraphs:master Mar 22, 2026
8 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MLUtils.unbatch corrupts COO batches when an intermediate graph has zero edges

2 participants