Skip to content

Coalesce function and state for coo graphs #613

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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

dferre97
Copy link
Contributor

@dferre97 dferre97 commented Aug 6, 2025

Added a coalesce method and an is_coalesced flag to keep track of whether a COO graph is coalesced, which means:

  • there are no duplicated coordinates in the indices (i.e, no multi-edges)
  • the source and target indices are ordered lexicographically (by source, then by target)

Some operations (e.g., sparse matrix multiplication in forward pass) could be implemented more efficiently if a COO graph is coalesced.

@CarloLucibello
Copy link
Member

can you test that operations like add_edges returning a new graph set coalesce to false?
Also we should add an expose an is_coalesced(g) method just returning g.is_coalesced.

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