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

[FEA]: Implement spectral_ordering #4793

Open
2 tasks done
Tracked by #3337
adsharma opened this issue Nov 27, 2024 · 5 comments
Open
2 tasks done
Tracked by #3337

[FEA]: Implement spectral_ordering #4793

adsharma opened this issue Nov 27, 2024 · 5 comments
Labels
feature request New feature or request

Comments

@adsharma
Copy link

Is this a new feature, an improvement, or a change to existing functionality?

New Feature

How would you describe the priority of this feature request

Critical (currently preventing usage)

Please provide a clear description of problem this feature solves

networkx implements a spectral_ordering algorithm that's useful for some applications. I couldn't find a GPU accelerated variant in cugraph.

I see two spectral clustering algorithms, which are not the same.

Describe your ideal solution

Implement a cugraph equivalent of nx.spectral_ordering()

Describe any alternatives you have considered

Used the CPU variant. It was slow.

Additional context

No response

Code of Conduct

  • I agree to follow cuGraph's Code of Conduct
  • I have searched the open feature requests and have found no duplicates for this feature request
@adsharma adsharma added ? - Needs Triage Need team to review and classify feature request New feature or request labels Nov 27, 2024
@adsharma
Copy link
Author

Some research on why existing spectral clustering algorithms in cugraph are insufficient:

https://journals.aps.org/prresearch/abstract/10.1103/PhysRevResearch.5.023006

@adsharma
Copy link
Author

Extracted networkx code for easier testing:

https://github.com/adsharma/nx-spectral-ordering

Here's my attempt to speed it up:
adsharma/nx-spectral-ordering@6bb1373

Runs an algorithm copied from cupy.dev (link in the commit), but fails functional testing. Needs more debug.

Also I heard that cuSparse has a PCG solver. Not sure how to invoke it from python.

@adsharma
Copy link
Author

Modified the networkx PCG solver to use cupy. It works, but is not faster.

https://github.com/adsharma/nx-spectral-ordering/compare/f2073213a8984e2db4816f1cfa21d61fd0402531..7104b1d74139875bab500652b316d1e6ad06995b

Still interested in exploring if cuSparse PCG solver is a better solution.

@ChuckHastings
Copy link
Collaborator

Thanks for your interest and for the links to the relevant research. This looks like a very useful algorithm to add to our library.

While we support an existing spectral clustering algorithm today, we have not yet identified the update path for the spectral clustering algorithm (it's currently a legacy implementation using an older data structure). I will add this to our list of algorithms we would like to explore, but I'm not sure when we will get to it on our road map.

@ChuckHastings ChuckHastings removed the ? - Needs Triage Need team to review and classify label Jan 22, 2025
@adsharma
Copy link
Author

adsharma commented Feb 4, 2025

I wrote a PCG solver using triton. It's not very fast, but seems to pass correctness tests.

This branch has the networkx code modified to use the PCG solver.

Leaving it here as a reference for the next person looking to implement this algorithm in cugraph.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants