Skip to content

Add DigraphMaximalQuotients - #959

Open
boriforizs wants to merge 2 commits into
digraphs:mainfrom
boriforizs:add-digraphs-maximal-quotients
Open

boriforizs wants to merge 2 commits into
digraphs:mainfrom
boriforizs:add-digraphs-maximal-quotients

Conversation

@boriforizs

Copy link
Copy Markdown

No description provided.

@mtorpey

mtorpey commented Oct 21, 2026

Copy link
Copy Markdown
Collaborator

A bit of a failure in the tests here, as you can see, e.g. at this link.

You'll notice in the tst files that there's a list of local variables at the top, and it looks like you need to add mq to that. Give it a try and see if you can get tests passing.

(You can add more commits to this PR by simply adding them to the branch and pushing.)

@mtorpey

mtorpey commented Oct 21, 2026

Copy link
Copy Markdown
Collaborator

Other things to work on:

  • Add documentation for DigraphMaximalQuotients, in doc/attr.xml and an appropriate z-chap file. You can see what's done for other functions by looking through those.
  • Add a comment to your code to indicate the bit that is probably not optimal (comparing Bliss canonical reps).
  • Start work on a version that uses DigraphHash and see if it speeds things up.
  • Abstract out the more generic operation DigraphsUpToIsomorphism.

Hopefully this gives you some stuff to work on till next meeting. Thanks for emailing me!

@james-d-mitchell james-d-mitchell left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

A few changes required, then I'll be happy to merge this, thank you @boriforizs !

Comment thread gap/attr.gi

# This is to ensure compatibility with AutomorphismGroup and QuotientDigraph.
if IsMultiDigraph(D) then
aut := AutomorphismGroup(DigraphRemoveAllMultipleEdges(D));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If D is a mutable digraph, then I think this line will modify it in-place to remove all the multiple edges, probably this can be fixed by just adding DigraphCopyIfMutable(D) here.

Comment thread doc/attr.xml
<Ref Oper="QuotientDigraph"/>) obtained by amalgamating precisely two
vertices of <A>digraph</A>. In particular, each maximal quotient of
<A>digraph</A> has <C>n - 1</C> vertices. If <A>digraph</A> has fewer
than two vertices, an empty list is returned.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The doc should say something about the complexity of the method, it looks like at least $n^2$ where $n$ is the number of nodes?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Also should mention that these are quotients in the sense of QuotientDigraph so in particular, they can contain loops and multiple edges even if the original digraph does not. Be good to add some tests for this too, i.e. if we have a single node null digraph, and a single node digraph with a loop, then these will both show up in the returned list if I'm not mistaken.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Also the doc should mention that the returned list is the list of maximal proper quotients up to isomorphism, and not up to equality (also please add test for this too).

Comment thread gap/attr.gi
fi;

# Creating orbit representatives.
orbs := Orbits(aut, Combinations(DigraphVertices(D), 2), OnSets);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This doesn't yet exist in a release version of GAP but we could perhaps use EnumeratorOfCombinations from gap-system/gap#6756 in the future, might be worthwhile mentioning this here in a TODO

Comment thread doc/attr.xml
<Returns>A list of digraphs.</Returns>
<Description>
If <A>digraph</A> is a digraph with <C>n</C> vertices, then this
attribute returns a list containing all maximal quotients of

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
attribute returns a list containing all maximal quotients of
attribute returns a list containing all maximal proper quotients of

This branch has not been deployed

No deployments
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.

3 participants