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 Katz Centrality to the C API #2192

Merged
merged 6 commits into from
Apr 11, 2022

Conversation

ChuckHastings
Copy link
Collaborator

@ChuckHastings ChuckHastings commented Apr 5, 2022

Add Katz Centrality to the C API. This will allow the work for #1759 to be done using the C API which should make things simpler and avoid doing the work twice.

This PR both defines and implements the Katz Centrality algorithm through the C API.

@ChuckHastings ChuckHastings requested review from a team as code owners April 5, 2022 20:43
@ChuckHastings ChuckHastings self-assigned this Apr 5, 2022
@ChuckHastings ChuckHastings added 2 - In Progress improvement Improvement / enhancement to an existing function non-breaking Non-breaking change labels Apr 5, 2022
@ChuckHastings ChuckHastings added this to the 22.06 milestone Apr 5, 2022
@codecov-commenter
Copy link

codecov-commenter commented Apr 5, 2022

Codecov Report

Merging #2192 (ea32dc8) into branch-22.06 (017baab) will decrease coverage by 3.00%.
The diff coverage is n/a.

@@               Coverage Diff                @@
##           branch-22.06    #2192      +/-   ##
================================================
- Coverage         72.41%   69.40%   -3.01%     
================================================
  Files               157      170      +13     
  Lines             10496    11036     +540     
================================================
+ Hits               7601     7660      +59     
- Misses             2895     3376     +481     
Impacted Files Coverage Δ
...tests/dask/test_mg_batch_betweenness_centrality.py 0.00% <0.00%> (-86.96%) ⬇️
.../dask/test_mg_batch_edge_betweenness_centrality.py 0.00% <0.00%> (-86.37%) ⬇️
...thon/cugraph/cugraph/tests/dask/test_mg_louvain.py 0.00% <0.00%> (-41.94%) ⬇️
...ython/cugraph/cugraph/tests/dask/test_mg_degree.py 0.00% <0.00%> (-41.67%) ⬇️
...cugraph/cugraph/tests/dask/test_mg_connectivity.py 0.00% <0.00%> (-34.49%) ⬇️
python/cugraph/cugraph/tests/dask/test_mg_sssp.py 0.00% <0.00%> (-33.34%) ⬇️
.../cugraph/cugraph/tests/dask/test_mg_replication.py 0.00% <0.00%> (-33.34%) ⬇️
...thon/cugraph/cugraph/tests/dask/test_mg_utility.py 0.00% <0.00%> (-29.86%) ⬇️
...hon/cugraph/cugraph/tests/dask/test_mg_pagerank.py 0.00% <0.00%> (-26.42%) ⬇️
...raph/cugraph/tests/dask/test_mg_katz_centrality.py 0.00% <0.00%> (-26.32%) ⬇️
... and 27 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 017baab...ea32dc8. Read the comment docs.

* @return type erased array view of centrality values
*/
cugraph_type_erased_device_array_view_t* cugraph_centrality_result_get_values(
cugraph_centrality_result_t* result);
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't this an update happened in one of the previous PRs? It seems like this PR includes updates for PageRank, HITS, and so on in addition to the updates for Katz. Is this because this PR is showing updates from other PRs or these are indeed new updates in this PR?

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 felt like the algorithms.h file was getting too large to keep track of. This PR (as well as #2185) starts moving like algorithms into a separate file. In this case I'm moving all of the centrality based algorithms into centrality_algorithms.h.

So the definition of this function was in an earlier PR, this is just moving it to a new file.

Copy link
Contributor

Choose a reason for hiding this comment

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

Gotcha, makes sense. Not for this PR, but to be consistent, PageRank is currently under link_analysis. Maybe in a separate PR, shouldn't we better move PageRank to the centrality directory? (in C/C++/Python).

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah...and we also should start thinking about splitting algorithms.hpp to put the C & C++ parts in sync.

Copy link
Contributor

Choose a reason for hiding this comment

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

Unlike the previous PR where you defined the centrality result types in both C and pylib, here you're splitting up algorithms.h into itself and centrality_algorithms.h. I think it would be better and easier to follow along if I do the same in my pylibcugraph wrapper PR for algorithms.pxd and centrality_algorithms.pxd. It would likely prevent a merge conflict and I can keep pulling from your branch whenever changes are being made

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@betochimas - that makes sense. Did you want me to split that in this PR, or are you going to handle it in #2201?

Copy link
Contributor

Choose a reason for hiding this comment

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

@ChuckHastings I can handle it in #2201

Copy link
Contributor

Choose a reason for hiding this comment

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

yep, I think @betochimas is saying this too: we've been keeping the .pxd files in pylibcugraph/_cugraph_c in sync with the C API headers to make it easy to follow, so we'd want the same reorg in pylibcugraph. I think it can be done in #2201.

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.

* @return type erased array view of centrality values
*/
cugraph_type_erased_device_array_view_t* cugraph_centrality_result_get_values(
cugraph_centrality_result_t* result);
Copy link
Contributor

Choose a reason for hiding this comment

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

yep, I think @betochimas is saying this too: we've been keeping the .pxd files in pylibcugraph/_cugraph_c in sync with the C API headers to make it easy to follow, so we'd want the same reorg in pylibcugraph. I think it can be done in #2201.

@ChuckHastings
Copy link
Collaborator Author

@gpucibot merge

@rapids-bot rapids-bot bot merged commit c3b3b83 into rapidsai:branch-22.06 Apr 11, 2022
rapids-bot bot pushed a commit that referenced this pull request Apr 20, 2022
…raph (#2201)

This PR adds Single-GPU (SG) Katz Centrality to the pylibcugraph software stack, as well as refactoring SG Katz Centrality for the cugraph software stack. Both Katz Centrality algorithms are wrappers calling a lower level version of the algorithm, originally based on the C API. This PR directly depends on #2192, and combined with it, should close #1759.

Authors:
  - https://github.com/betochimas
  - Chuck Hastings (https://github.com/ChuckHastings)

Approvers:
  - Rick Ratzel (https://github.com/rlratzel)

URL: #2201
@ChuckHastings ChuckHastings deleted the fea_c_api_katz branch August 4, 2022 18:26
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.

5 participants