Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support to create temporal graphs #4819

Open
wants to merge 15 commits into
base: branch-25.02
Choose a base branch
from

Conversation

ChuckHastings
Copy link
Collaborator

@ChuckHastings ChuckHastings commented Dec 9, 2024

Adds two optional edge properties (edge_start_times and edge_end_times) that can be used to represent times when edges are active in the graph. This will support providing views of the graph at a particular time, or using edge times to control traversal in a reasonable time order.

Marked as breaking. Most of the old APIs are still supported, but since I updated all of the tests to use the new APIs, we don't actually test the old APIs.

Copy link

copy-pr-bot bot commented Dec 9, 2024

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.

@ChuckHastings ChuckHastings self-assigned this Dec 9, 2024
@ChuckHastings ChuckHastings added this to the 25.02 milestone Dec 9, 2024
@ChuckHastings ChuckHastings added the breaking Breaking change label Dec 9, 2024
Copy link
Contributor

@seunghwak seunghwak left a comment

Choose a reason for hiding this comment

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

The implementation looks reasonable to me.

Commented about documentation & cosmetic issues.

Haven't reviewed the test code yet.

cpp/include/cugraph/detail/shuffle_wrappers.hpp Outdated Show resolved Hide resolved
cpp/include/cugraph/detail/shuffle_wrappers.hpp Outdated Show resolved Hide resolved
cpp/include/cugraph/graph_functions.hpp Show resolved Hide resolved
cpp/include/cugraph/graph_functions.hpp Show resolved Hide resolved
cpp/src/structure/symmetrize_edgelist_impl.cuh Outdated Show resolved Hide resolved
cpp/src/structure/symmetrize_edgelist_impl.cuh Outdated Show resolved Hide resolved
cpp/src/utilities/shuffle_vertex_pairs.cuh Outdated Show resolved Hide resolved
cpp/src/utilities/shuffle_vertex_pairs.cuh Outdated Show resolved Hide resolved
@ChuckHastings ChuckHastings added the improvement Improvement / enhancement to an existing function label Jan 14, 2025
@ChuckHastings ChuckHastings marked this pull request as ready for review January 15, 2025 18:30
@ChuckHastings ChuckHastings requested review from a team as code owners January 15, 2025 18:30
@seunghwak
Copy link
Contributor

This PR is still awaiting C++ unit tests for temporal graphs, but the logic is fully implemented.

Is this PR still a work-in-progress?

@ChuckHastings
Copy link
Collaborator Author

This PR is still awaiting C++ unit tests for temporal graphs, but the logic is fully implemented.

Is this PR still a work-in-progress?

No, this is ready for review. I updated the description.

Copy link
Contributor

@seunghwak seunghwak left a comment

Choose a reason for hiding this comment

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

LGTM besides few minor cosmetic issues.

@@ -40,6 +40,7 @@ namespace detail {
* @tparam edge_t Type of edge identifiers. Needs to be an integral type.
* @tparam weight_t Type of edge weights. Needs to be a floating point type.
* @tparam edge_type_t Type of edge type identifiers. Needs to be an integral type.
* @tparam edge_time_t The type of the edge time stamp. Needts to be an integral type.
Copy link
Contributor

Choose a reason for hiding this comment

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

Needts => Needs

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed

};

if (edge_property_count == 0) {
// TODO: Consider flipping the outer if and doing edge_property_count test first...
Copy link
Contributor

Choose a reason for hiding this comment

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

Any benefits of doing this? If not, we may just delete this. (and aren't we using FIXME instead of TODO?)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Deleted this old message. I tend to use TODO for things I want to fix while developing and FIXME for things I want to defer. In this case, I did flip this to get the code that's here so the message is obsolete. My first attempt had been to have groupby_and_count_local_partition_by_minor as the outer if... which let me create the one _op functor or the other. But that resulted in too much duplication of code. So I implemented the comment in this TODO but forgot to delete it.

@@ -202,7 +202,7 @@ neighbor_sample_impl(raft::handle_t const& handle,
? std::make_optional(rmm::device_uvector<label_t>(0, handle.get_stream()))
: std::nullopt;

for (auto edge_type_id = 0; edge_type_id < num_edge_types; edge_type_id++) {
for (edge_type_t edge_type_id = 0; edge_type_id < num_edge_types; edge_type_id++) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Something very minor but should we better rename "edge_type_id" to "edge_type" as well?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed.

group_multi_edges(raft::handle_t const& handle,
rmm::device_uvector<vertex_t>&& edgelist_srcs,
rmm::device_uvector<vertex_t>&& edgelist_dsts,
rmm::device_uvector<value_t>&& edgelist_values,
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess this wont' work if value_t is thrust::tuple. We may not need this for now, but should we better keep this as is to be future proof? Updating this code to support just a scalar value_t doesn't make this code much simpler...

Copy link
Contributor

Choose a reason for hiding this comment

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

decltype(allocate_dataframe_buffer<edge_value_t>(0, rmm::cuda_stream_view{})) can now be dataframe_buffer_type_t<value_t> (https://github.com/rapidsai/cugraph/blob/branch-25.02/cpp/include/cugraph/utilities/dataframe_buffer.hpp#L91) to simplify the function definition a bit.

Copy link
Collaborator Author

@ChuckHastings ChuckHastings Jan 16, 2025

Choose a reason for hiding this comment

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

Edited back to the original implementation with suggested improvements in the next push.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking Breaking change CMake cuGraph improvement Improvement / enhancement to an existing function
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants