Skip to content

Conversation

@ChuckHastings
Copy link
Collaborator

So far this just defines the proposed new symmetrization function signatures.

@copy-pr-bot
Copy link

copy-pr-bot bot commented Oct 3, 2025

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 added improvement Improvement / enhancement to an existing function DO NOT MERGE Hold off on merging; see PR for details breaking Breaking change labels Oct 3, 2025
@ChuckHastings ChuckHastings self-assigned this Oct 3, 2025
std::optional<rmm::device_uvector<edge_time_t>>&& edgelist_edge_end_times,
bool reciprocal);
std::vector<arithmetic_device_uvector_t>>
add_reciprocal_edges(
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this name is confusing.

This sounds like we are adding reciprocal edges to another edge list. But isn't this inspecting the input edge list and keeping only the reciprocal edges?

I think we need a clearer name.

And the function below...

Isn't removing non-reciprocal edges same to the previous symmetrize_edgelist function with reciprocal = true. The comment is saying the opposite.

So, there are two ways to symmetrize.

  1. Only keep the reciprocal edges. Remove all non-reciprocal edges.
  2. Add inverse edges for all non-reciprocal edges.

I think we'd better rename the functions to make this more intuitive...

I asked this to ChatGPT, and these are the names ChatGPT suggested...

make_reciprocal_edges() <= But I think these names are bad... Still confusing.
make_symmetric_edges()

symmetrize_edgelist_union() <= Sounds better... not sure reciprocal & intersection aligns 100%
symmetrize_edgelist_intersection()

keep_reciprocal_edges() <= If I need to pick one out of the three.. I may go with this.
add_inverse_edges()

But there might be better names than this... Just a starting point...

* @brief Rule for combining edge properties when adding reciprocal edges.
*/
enum class edge_property_combining_rule_t {
PART_OF_UNIQUENESS, /// This property is part of the uniqueness of the edge.
Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah... I am not sure about this... This is not really a combining rule...

And if this is selected for an edge property... how do we consider that in symmetrization.

Say edge ID is selected as "PART_OF_UNIQUENESS" property.

In (src, dst, ID) triplets, how do we symmetrize (3, 5, 1) and (5, 3, 1) with reciprocal = true/false? What about (3, 5, 1) and (5, 3, 2)?

I think we should make this cleaner and better document the expected behavior. Just reading the names, I can't properly guess how these functions will work.

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.

I like edge_key_selector_t. I still few some questions.

* @brief Add reciprocal edges and merge the edges. This was formerly called symmetrize_edgelist
* with reciprocal set to false.
*
* The input edge list is replicated as reciprocal edges. Then the original edges and the
Copy link
Contributor

Choose a reason for hiding this comment

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

I am wondering we should use "reciprocal" here or use "inverse" instead. I am not sure what "reciprocal" exactly means. Some quick search says it is a pair of edges going in both directions between a pair of vertices.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm fine switching to inverse here if that's more intuitive to you. I suppose by the definition you found we're really creating reciprocal edges here by adding the inverse edge. So that's probably more correct.

rmm::device_uvector<vertex_t>&& edgelist_srcs,
rmm::device_uvector<vertex_t>&& edgelist_dsts,
std::vector<arithmetic_device_uvector_t>&& edgelist_edge_properties,
std::vector<edge_key_selector_t> const& edge_key_selector,
Copy link
Contributor

Choose a reason for hiding this comment

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

We don't need std::vector<edge_value_combining_rule_t> const& edge_value_combining_rule here? If we have a reciprocal edges, are there no use-cases we need to combine edge properties? (e.g. update the edge weights to the average)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, I suppose we do. I hadn't considered that case. But if we have (1,2,1.0) and (2,1,2.0) then we would need to have the edge_value_combining_rule_t for that edge property to determine what value to assign to the pair of edges. In that case NONE would leave the edges unmodified (and different in each direction), ANY would arbitrarily pick one of them to make them match.

FIRST, /** Use the value of the first edge property. */
LAST, /** Use the value of the last edge property. */
ANY, /** Use the value of any edge property. */
NONE /** Do not combine the values. */
Copy link
Contributor

Choose a reason for hiding this comment

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

This is just to keep the original values, right? Should we explain this in little more detail?

I initially thought we don't need NONE here as we now have edge_key_selector_t. But now I think this is still necessary as we may consider two different edges with the matching source/destination pairs as reciprocal but in some cases, we don't want to combine there edge properties. This may not be clear to everyone from the beginning.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'll add some text to clarify the different use cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking Breaking change DO NOT MERGE Hold off on merging; see PR for details improvement Improvement / enhancement to an existing function

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants