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

cliques: some perf improvements #635

Merged
merged 1 commit into from
Apr 17, 2024

Conversation

james-d-mitchell
Copy link
Member

This commit includes some performance improvements for the clique finding code. The example in the newly added extreme/cliques.tst file takes approx. 4s with the modified code, versus at least 3 minutes previously (I never ran it to completion previously because it was taking too long). If we do:

List(DigraphCliquesReps(D),
     x -> Orbit(AutomorphismGroup(D), x, OnSets));

for the same example, then this takes about 12s, doing the same with

List(DigraphCliquesReps(D),
     x -> Orb(AutomorphismGroup(D), x, OnSets));

instead runs out of memory repeatedly (and takes longer than 12s). Note that the automorphism group is of size 16, and so the orbits are relatively small in comparison to the number of cliques.

@james-d-mitchell james-d-mitchell force-pushed the cliques-perf branch 2 times, most recently from 1801b31 to 1d124f0 Compare April 1, 2024 19:57
@james-d-mitchell james-d-mitchell added the performance A label for issues or PR related to performance label Apr 1, 2024
@james-d-mitchell james-d-mitchell force-pushed the cliques-perf branch 2 times, most recently from 59f7be3 to 36be423 Compare April 2, 2024 10:08
@james-d-mitchell
Copy link
Member Author

TODO: this means we don't need Orb for Digraphs any more.

reiniscirpons
reiniscirpons previously approved these changes Apr 8, 2024
Copy link
Collaborator

@reiniscirpons reiniscirpons left a comment

Choose a reason for hiding this comment

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

PR looks good, thanks James! Can confirm that the extreme test runs out of memory (and takes way longer) without these changes, much better now.

gap/cliques.gi Outdated
Add(orbits, orb);
Append(out, orb);
if not c in orbits then
MultiOrbit(G, c, orbits);
Copy link
Collaborator

Choose a reason for hiding this comment

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

This line is a bit confusing, since MultiOrbit returns an orbit and its non-obvious that it changes the orbits hashmap in place (this is what its used here). Would it make sense to just inline the bit of the MultiOrbit code thats relevant to updating the orbits hashmap?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure it makes sense to inline the bit of code in MultiOrbit, it is used elsewhere, and then we'd have duplication of the method. Maybe I can rename the function to AddOrbitToMap or something?

This commit includes some performance improvements for the clique
finding code.  The example in the newly added extreme/cliques.tst file
takes approx. 4s with the modified code, versus at least 3 minutes
previously (I never ran it to completion previously because it was
taking too long). If we do:

List(DigraphCliquesReps(D),
     x -> Orbit(AutomorphismGroup(D), x, OnSets));

for the same example, then this takes about 12s, doing the same with

List(DigraphCliquesReps(D),
     x -> Orb(AutomorphismGroup(D), x, OnSets));

instead runs out of memory repeatedly (and takes longer than 12s). Note
that the automorphism group is of size 16, and so the orbits are
relatively small in comparison to the number of cliques.
@james-d-mitchell james-d-mitchell enabled auto-merge (rebase) April 17, 2024 10:23
@james-d-mitchell james-d-mitchell merged commit 8b530f5 into digraphs:main Apr 17, 2024
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance A label for issues or PR related to performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants