-
Notifications
You must be signed in to change notification settings - Fork 304
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 in C API for handling unweighted graphs in algorithms that expect weights #3513
Changes from 2 commits
7a29d57
b1f9fa7
a44483e
442e1ce
d2ba15f
90eb5cc
0551b7f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ | |
|
||
#pragma once | ||
|
||
#include <cugraph/detail/utility_wrappers.hpp> | ||
#include <cugraph/utilities/dataframe_buffer.hpp> | ||
#include <cugraph/utilities/thrust_tuple_utils.hpp> | ||
|
||
|
@@ -126,6 +127,26 @@ class edge_dummy_property_t { | |
auto view() const { return edge_dummy_property_view_t{}; } | ||
}; | ||
|
||
template <typename GraphViewType, typename T> | ||
auto create_constant_edge_property(raft::handle_t const& handle, | ||
GraphViewType const& graph_view, | ||
T constant_value) | ||
{ | ||
edge_property_t<GraphViewType, T> edge_property(handle, graph_view); | ||
|
||
auto mutable_view = edge_property.mutable_view(); | ||
|
||
std::for_each( | ||
thrust::make_zip_iterator(mutable_view.value_firsts().begin(), | ||
mutable_view.edge_counts().begin()), | ||
thrust::make_zip_iterator(mutable_view.value_firsts().end(), mutable_view.edge_counts().end()), | ||
[&handle, constant_value](auto tuple) { | ||
detail::scalar_fill(handle, thrust::get<0>(tuple), thrust::get<1>(tuple), constant_value); | ||
}); | ||
|
||
return edge_property; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have So, it will be more consistent to create There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Merged your PR and then my change to use it. |
||
|
||
template <typename edge_t, typename... Ts> | ||
auto view_concat(edge_property_view_t<edge_t, Ts> const&... views) | ||
{ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this include still necessary?