Skip to content

Faster could_be_isomorphic and number_of_cliques - #7855

Merged
MridulS merged 1 commit into
networkx:mainfrom
eriknw:faster_number_of_cliques
Feb 15, 2025
Merged

MridulS merged 1 commit into
networkx:mainfrom
eriknw:faster_number_of_cliques

Conversation

@eriknw

@eriknw eriknw commented Feb 14, 2025 •

Copy link
Copy Markdown
Contributor

When looking at #7852, @rossbar noticed could_be_isomorphic could be made much faster by counting cliques faster. Same change applies to number_of_cliques too, and I updated the recipe in the docstring of find_cliques to avoid the slow recipe.

Additional changes that could be made (preferably in other PR(s)):

  • Recipe in find_cliques could be replaced by number_of_cliques (or at least mention it)
  • could_be_isomorphic could also use number_of_cliques, but used simple one-liner for performance
  • Docstring of number_of_cliques doesn't describe parameters or return types, and incorrectly says returns a list

@rossbar rossbar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @eriknw , this looks great !

@MridulS
MridulS merged commit 2b20652 into networkx:main Feb 15, 2025
@jarrodmillman jarrodmillman added this to the 3.5 milestone May 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

4 participants