Skip to content

Add square_clustering to algorithm benchmarks. - #7857

Merged
MridulS merged 1 commit into
networkx:mainfrom
rossbar:sq-cluster-benchmark
Feb 24, 2025
Merged

MridulS merged 1 commit into
networkx:mainfrom
rossbar:sq-cluster-benchmark

Conversation

@rossbar

@rossbar rossbar commented Feb 16, 2025

Copy link
Copy Markdown
Contributor

This one was easy - I just plugged it directly into the existing algorithm benchmarks. Note however that I chose the test cases that excluded the drug interaction network, as the existing implementation can be quite expensive!

Here's an example incantation and some results:

$ asv continuous --bench AlgorithmBenchmarksConnectedGraphsOnly.time_square_clustering 2d1ad6b1 main
$ asv compare 2d1ad6b1 main
Benchmarking results
All benchmarks:
Change Before [2d1ad6b] <faster_square_clustering> After [f87c361] Ratio Benchmark (Parameter)
+ 3.59±0.02ms 10.5±0.6ms 2.92 benchmark_algorithms.AlgorithmBenchmarksConnectedGraphsOnly.time_square_clustering('Erdos Renyi (100, 0.1)')
+ 22.7±0.7ms 583±2ms 25.68 benchmark_algorithms.AlgorithmBenchmarksConnectedGraphsOnly.time_square_clustering('Erdos Renyi (100, 0.5)')
+ 26.9±0.8ms 2.14±0s 79.38 benchmark_algorithms.AlgorithmBenchmarksConnectedGraphsOnly.time_square_clustering('Erdos Renyi (100, 0.9)')

Can be quite expensive, so don't run on drug interaction network.

@eriknw eriknw 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.

LGTM, thanks @rossbar!

@dschult

dschult commented Feb 17, 2025

Copy link
Copy Markdown
Member

Am I reading this backwards? It looks like square clustering is slower after the changes... Maybe the headings are switched?

@MridulS

MridulS commented Feb 17, 2025

Copy link
Copy Markdown
Member

Am I reading this backwards? It looks like square clustering is slower after the changes... Maybe the headings are switched?

Yeah the compare command should be asv compare main 2d1ad6b1

@rossbar

rossbar commented Feb 18, 2025

Copy link
Copy Markdown
Contributor Author

Am I reading this backwards? It looks like square clustering is slower after the changes... Maybe the headings are switched?

Apologies - I ordered the compare this way intentionally as I find it easier to think about speed ups (i.e. commit A is 80x faster than commit B vs. commit B ran in 0.0125 the time of commit A). De gustibus non est disputandum!

@MridulS
MridulS merged commit 00634e7 into networkx:main Feb 24, 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.

5 participants