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

Add OnTuplesDigraphs and OnSetsDigraphs #449

Merged

Conversation

wilfwilson
Copy link
Collaborator

@wilfwilson wilfwilson commented Mar 26, 2021

I keep writing temporary functions to implement these actions for my research, so I thought it was about time I just add them to the package.

Tasks:

  • Decide how to handle mutable digraphs
  • Decide whether we need something like IsDigraphByOutNeighboursRepCollection
  • Document OnTuplesDigraphs
  • Document OnSetsDigraphs

@wilfwilson wilfwilson added do not merge A label for PRs that should not be merged for whatever reason. new-feature A label for new features. WIP Label of PRs that are a Work In Progress (WIP) labels Mar 26, 2021
@wilfwilson wilfwilson force-pushed the OnTuplesDigraphs-OnSetsDigraphs branch from f1fc793 to 3ce296f Compare March 26, 2021 12:38
@james-d-mitchell
Copy link
Member

@wilfwilson looks good, I'll be happy to discuss your first two points this afternoon if you want?

@wilfwilson
Copy link
Collaborator Author

For the second point, I think it's not necessary; these new operations use OnDigraphs to do the actual work, so in my opinion it's fine for OnDigraphs to do those checks, which it does. So if we did OnTuplesDigraphs for a non-IsDigraphByOutNeighboursRepCollection we'd get a no method found error for OnDigraphs.

@wilfwilson
Copy link
Collaborator Author

For the first point, I'm not sure. The current (and simplest to implement) behaviour, as demonstrated with digraph D that consists of 3 vertices and a single loop at vertex 1:

gap> D := EmptyDigraph(IsMutableDigraph, 3);; DigraphAddEdge(D, 1, 1);;
gap> l := [D, D];;
gap> out := OnTuplesDigraphs(l, (1,2,3));;
gap> l = out and out = [D, D];
true
gap> List(out, DigraphLoops);
[ [ 3 ], [ 3 ] ]

This just seems really weird to me, that you ask to apply the perm p to a list [D,D], but you end up with the list [D^(p^2),D^(p^2)]. But also it seems the most Digraphsy, and easiest to document: i.e. "OnTuplesDigraphs applies OnDigraphs in turn to each digraph in the tuple".

Of course, for immutable digraphs, you get the list [D^p, D^p] (each being a new immutable object).

@wilfwilson wilfwilson force-pushed the OnTuplesDigraphs-OnSetsDigraphs branch from 3ce296f to c870756 Compare April 14, 2021 13:38
@wilfwilson wilfwilson force-pushed the OnTuplesDigraphs-OnSetsDigraphs branch from c870756 to 35d0f59 Compare May 7, 2021 07:33
@wilfwilson wilfwilson mentioned this pull request May 7, 2021
@wilfwilson wilfwilson force-pushed the OnTuplesDigraphs-OnSetsDigraphs branch 3 times, most recently from 9797c6e to 2a9fd31 Compare May 18, 2021 19:47
@wilfwilson wilfwilson force-pushed the OnTuplesDigraphs-OnSetsDigraphs branch from 2a9fd31 to 14130a9 Compare May 21, 2021 17:23
@wilfwilson wilfwilson force-pushed the OnTuplesDigraphs-OnSetsDigraphs branch from 14130a9 to e1ec750 Compare June 17, 2021 10:55
@wilfwilson wilfwilson force-pushed the OnTuplesDigraphs-OnSetsDigraphs branch from e1ec750 to 12aff56 Compare October 27, 2021 17:28
@wilfwilson wilfwilson force-pushed the OnTuplesDigraphs-OnSetsDigraphs branch from 12aff56 to f483d93 Compare November 17, 2021 21:38
@wilfwilson wilfwilson removed do not merge A label for PRs that should not be merged for whatever reason. WIP Label of PRs that are a Work In Progress (WIP) labels Nov 19, 2021
@wilfwilson wilfwilson force-pushed the OnTuplesDigraphs-OnSetsDigraphs branch 3 times, most recently from 55258de to 7072e5f Compare November 19, 2021 12:58
@wilfwilson
Copy link
Collaborator Author

wilfwilson commented Nov 19, 2021

This now has documentation and tests, and it is now ready for review.

Hopefully it is clear from the documentation and implementation how I dealt with mutable digraphs: I copy them before acting on them by OnDigraphs.

I just didn't see a sensible use-case for OnTuplesDigraphs where mutable digraphs get changed in place, see e.g. my example in #449 (comment) (here the digraphs in the list essentially each get acted on twice, which I find deeply weird).

For OnSetsDigraphs, a set can't contain duplicate digraphs, so this particular weirdness can't occur. So perhaps there is a use-case for changing mutable digraphs in place for OnSetsDigraphs. Nevertheless, I think OnTuplesDigraphs and OnSetsDigraphs should be consistent.

It's also the list/set itself that we're acting on by OnTuplesDigraphs/OnSetsDigraphs, so although I think it would be alright for the list itself to mutate, it feels less appropriate for the GAP objects that it contains to get changed too. (What if a different list contains some of the same digraphs?).

In addition, I think OnTuplesDigraphs and OnSetsDigraphs will play more nicely with things like GAP's RepresentativeAction and Stabiliser if they don't mutate stuff.

@wilfwilson wilfwilson force-pushed the OnTuplesDigraphs-OnSetsDigraphs branch 2 times, most recently from 54f92f7 to 0e6a836 Compare November 22, 2021 17:42
@wilfwilson wilfwilson force-pushed the OnTuplesDigraphs-OnSetsDigraphs branch from 0e6a836 to f2ff8b2 Compare November 25, 2021 09:53
@wilfwilson wilfwilson merged commit 6da9d7a into digraphs:master Nov 25, 2021
@wilfwilson wilfwilson deleted the OnTuplesDigraphs-OnSetsDigraphs branch November 25, 2021 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new-feature A label for new features.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants