Skip to content

Heterogeneous temporal sampling fixes - #5691

Merged
rapids-bot[bot] merged 6 commits into
rapidsai:mainfrom
ChuckHastings:heterogeneous_temporal_sampling_fixes
Oct 6, 2026
Merged

rapids-bot[bot] merged 6 commits into
rapidsai:mainfrom
ChuckHastings:heterogeneous_temporal_sampling_fixes

Conversation

@ChuckHastings

Copy link
Copy Markdown
Contributor

Temporal sampling for heterogeneous graphs needs to support the idea that some types won't have edge times.

This PR changes the logic for times. Since a time is required for every edge in our data structure, we can use a sentinel value to indicate that no time is specified. We chose the value std::numeric_limits<edge_time_t>::lowest() as this sentinel value.

If an edge time is set to that value then the software will now treat that edge as if it passes any time filter. We also added logic for special cases:

  1. If you're doing temporal sampling where the times need to be in order, each frontier vertex has a time that reflects the boundary for comparing the edge times. If an edge is selected then the next frontier gets the time of that edge. If the selected edge has no time (the time is lowest()) then the time for the vertex inserted in the next frontier is the time from the previous frontier (we don't update the time). This allows time ordering to be preserved
  2. For last-n sampling, we need to treat edges that have a type with no time differently, doing uniform random selection among edges for that type, and last-n only for the edge types that have times.

@copy-pr-bot

copy-pr-bot Bot commented Oct 2, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@alexbarghi-nv alexbarghi-nv left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good functionally - I'll defer to Seunghwa on performance

@ChuckHastings ChuckHastings added improvement Improvement / enhancement to an existing function non-breaking Non-breaking change labels Oct 6, 2026
@ChuckHastings
ChuckHastings marked this pull request as ready for review October 6, 2026 16:12
@ChuckHastings
ChuckHastings requested a review from a team as a code owner October 6, 2026 16:12

@seunghwak seunghwak left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor complaints about documentation but otherwise LGTM.

* increasing modes, earlier times (last in decreasing order) for decreasing modes.
* int32 start times rank exactly over the full signed range; int64 ranks exactly
* on [-2^52, 2^52 - 1]. Outside that int64 range, ordering is preserved but ties
* A start time equal to the minimum of the timestamp type is ranked by a uniform key in

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minimum=>numeric_limits<time_stamp_t>::lowest() to be consistent with the above documentation?

* decreasing order) for decreasing comparisons. LAST requires temporal sampling, ignores
* edge biases, and rejects with-replacement. int32 start times rank exactly over the full
* signed range; int64 ranks exactly on [-2^52, 2^52 - 1] (typical unix
* decreasing order) for decreasing comparisons. An edge start time equal to the minimum

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may pick minium or numeric_limits<time_stamp_t>::lowest() and use consistently rather than mixing them.

* Sampling is non-temporal unless cugraph_sampling_set_temporal_sampling_comparison has been
* called on @p sampling_options; all temporal arguments must then be NULL. When temporal,
* called on @p sampling_options; all temporal arguments must then be NULL. When temporal, an edge
* start time equal to the minimum value of the timestamp type (INT32_MIN or INT64_MIN) means the

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here. We are mixing mininum and numeric_limits<time_stamp_t>::lowest in documentation.

@ChuckHastings

Copy link
Copy Markdown
Contributor Author

/merge

@rapids-bot
rapids-bot Bot merged commit d595c09 into rapidsai:main Oct 6, 2026
67 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement Improvement / enhancement to an existing function non-breaking Non-breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants