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 heterogeneous add_self_loop support #345

Merged

Conversation

AarSeBail
Copy link
Contributor

@AarSeBail AarSeBail commented Sep 26, 2023

Here is the PR as discussed in #329.

@AarSeBail AarSeBail marked this pull request as ready for review September 26, 2023 21:26
@AarSeBail
Copy link
Contributor Author

Regarding the method get_edge_weight_nullable, if it keeps popping up in heterogeneous graphs, it may be worth refining.


n = get(g.num_nodes, src_t, 0)

# By avoiding using haskey, this only calls ht_keyindex once instead of twice
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
# By avoiding using haskey, this only calls ht_keyindex once instead of twice

These kinds of performance concerns for dictionary queries are irrelevant. The heavy operations are the copies and the concatenations. Therefore the concern here should be to make the code has readable as possible, which means using haskey in my opinion.

s = [s; nodes]
t = [t; nodes]
else
nodes = [1:n;]
Copy link
Member

Choose a reason for hiding this comment

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

This creates a cpu array even if the rest of graph lives on gpu. We should create a new array similar to one in the existing relations.

@AarSeBail
Copy link
Contributor Author

I believe this to now be initializing edge arrays with the correct type, but please check to confirm. I also extended the test cases marginally.

Tests should pass on latest, but not on nightly, similarly to #356.

@CarloLucibello CarloLucibello merged commit fa584e5 into JuliaGraphs:master Jan 7, 2024
4 of 5 checks passed
@CarloLucibello
Copy link
Member

nice, thanks!

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.

2 participants