Skip to content

Preserve fetched original edges for hetero PPR - #743

Open
mkolodner-sc wants to merge 28 commits into
mainfrom
mkolodner-sc/ppr-preserve-original-edges
Open

Preserve fetched original edges for hetero PPR#743
mkolodner-sc wants to merge 28 commits into
mainfrom
mkolodner-sc/ppr-preserve-original-edges

Conversation

@mkolodner-sc

@mkolodner-sc mkolodner-sc commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Summary

This PR adds opt-in preservation of original graph edges for heterogeneous PPR sampling.

When include_original_edges_in_ppr_subgraph=True, the PPR sampler now emits original graph edges whose endpoints are already present in the PPR-selected node set and whose adjacency rows were fetched during PPR traversal. The default remains False, which is the more faithful behavior relative to PyG’s get_ppr API: output only virtual seed-to-PPR-node edges.

Changes

  • Stores fetched PPR adjacency in the C++ PPRForwardPush cache with optional edge IDs.
  • Adds C++ extraction for original edges from completed PPR cache state.
  • Reuses the same extraction path for typed and untyped heterogeneous PPR.
  • Deduplicates shared fetched rows across typed PPR channel states.
  • Keeps Python throughput-friendly:
    • no extra _sample_one_hop pass
    • extraction runs via run_in_executor
    • pybind wrapper releases the GIL during C++ cache scanning
  • Preserves edge IDs when available so existing edge-feature fetching can continue to work.
  • Leaves homogeneous Data support explicitly unsupported for this flag.
  • Does not include GraphTransformer/model consumption changes.

Output Behavior

For heterogeneous PPR:

  • Virtual PPR edges remain under ("seed_type", "ppr", "neighbor_type").
  • Preserved original graph edges are emitted through the regular sampled-edge channel.
  • Original edges follow the same edge_dir orientation convention as k-hop sampling.
  • The preserved original-edge set is not guaranteed to be a full induced subgraph because it is limited to adjacency rows already fetched during PPR.

Validation

  • make -C gigl-core unit_test_cpp
  • Focused distributed sampler tests:
    • test_typed_ppr_sampler_loader_outputs_channel_attrs
    • test_ppr_sampler_can_preserve_original_edges_for_selected_nodes
  • git diff --check
  • make -C gigl-core check_format_cpp
  • ruff check on touched Python/stub files

Local Benchmark

Synthetic no-edge-feature dataloader benchmark, flag off vs on:

Degree Mean Delta Mean % Delta Original Edges / Batch
4 -0.014 ms/batch -0.13% ~10.5k
8 +1.555 ms/batch +12.83% ~33.3k
16 +2.458 ms/batch +14.12% ~77.8k

Average across these cases: approximately +1.33 ms/batch mean overhead. While nonzero, this slowdown is relatively negligible.

Comment thread gigl-core/core/sampling/python_ppr_forward_push.cpp
Comment thread gigl-core/core/sampling/ppr_forward_push.cpp Outdated
Comment thread gigl-core/core/sampling/ppr_forward_push.cpp
Comment thread gigl-core/core/sampling/ppr_forward_push.cpp Outdated
Comment thread tests/unit/distributed/utils/neighborloader_test.py Outdated
Comment thread gigl/distributed/dist_ppr_sampler.py
Comment thread gigl/distributed/dist_ppr_sampler.py
Comment thread gigl-core/core/sampling/ppr_forward_push.h
Comment thread gigl-core/core/sampling/ppr_forward_push.cpp Outdated
Comment thread gigl-core/core/sampling/ppr_forward_push.cpp
Comment thread gigl-core/core/sampling/ppr_forward_push.cpp Outdated
Comment thread gigl-core/core/sampling/ppr_forward_push.cpp
Comment thread gigl-core/core/sampling/ppr_forward_push.cpp
Comment thread gigl-core/core/sampling/ppr_forward_push.h Outdated
Comment thread gigl-core/core/sampling/ppr_forward_push.h Outdated
Comment thread gigl/distributed/dist_ppr_sampler.py Outdated
Comment thread gigl/distributed/dist_ppr_sampler.py Outdated
Comment thread gigl/distributed/sampler_options.py
Comment thread gigl/distributed/sampler_options.py Outdated
Comment thread gigl-core/core/sampling/ppr_forward_push.cpp Outdated
Comment thread gigl/distributed/dist_ppr_sampler.py Outdated
Comment thread tests/unit/distributed/dist_ppr_sampler_test.py
Comment thread gigl/distributed/sampler_options.py Outdated
Comment thread gigl-core/src/gigl_core/ppr_forward_push.pyi
Comment thread gigl/distributed/dist_ppr_sampler.py Outdated
Comment thread gigl/distributed/dist_ppr_sampler.py
@mkolodner-sc
mkolodner-sc marked this pull request as ready for review August 12, 2026 18:30
@mkolodner-sc
mkolodner-sc added this pull request to the merge queue Aug 12, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 12, 2026
@mkolodner-sc
mkolodner-sc added this pull request to the merge queue Aug 13, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 13, 2026
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.

3 participants