Skip to content

Commit

Permalink
Add OrbitalGraph for a group, base-pair, and posint
Browse files Browse the repository at this point in the history
  • Loading branch information
wilfwilson committed Feb 1, 2022
1 parent f365226 commit 80fa6be
Show file tree
Hide file tree
Showing 4 changed files with 107 additions and 20 deletions.
37 changes: 29 additions & 8 deletions gap/OrbitalGraphs.gd
Original file line number Diff line number Diff line change
Expand Up @@ -77,21 +77,42 @@ DeclareOperation("OrbitalGraphs", [IsPermGroup, IsInt]);
#DeclareAttribute("OrbitalGraphsRepresentative", IsPermGroup);


# TODO: Implement constructing the orbital graph with a given base pair
# TODO Once orbital graphs can be defined on arbitrary vertices:
# * Allow specifying a set of points rather than a pos int k.
# * Implement a 2-arg version with MovedPoints(G) taken as the third arg.
#! @BeginGroup orbital
#! @Returns An orbital graph
#! @Arguments G, u, v
#! @Arguments G, basepair, k
#! @Description
#! TODO.
DeclareOperation("OrbitalGraph", [IsPermGroup, IsPosInt, IsPosInt]);
#! If <A>G</A> is a permutation group, <A>basepair</A> is a pair of
#! positive integers, and `k` is a positive integer such that `[1..<A>k</A>]`
#! is preserved by <A>G</A> and contains the entries of <A>basepair</A>,
#! then this function returns the orbital graph of <A>G</A> with the given
#! <A>basepair</A>, on the vertices `[1..<A>k</A>]`.
#!
#! The resulting orbital graph will have <A>basepair</A> set as its
#! <Ref Attr="BasePair" Label="for IsOrbitalGraph"/> attribute.
#! @EndGroup
#! @Group orbital
#! @Arguments G, basepair
#! @BeginExampleSession
#! gap> true;
#! true
#! gap> D8 := DihedralGroup(IsPermGroup, 8);
#! Group([ (1,2,3,4), (2,4) ])
#! gap> OrbitalGraph(D8, [1, 3], 4);
#! <self-paired orbital graph of Group([ (1,2,3,4), (2,4) ]) on 4 vertices
#! with base-pair (1,3), 4 arcs>
#! gap> OrbitalGraph(D8, [1, 3], 5);
#! <self-paired orbital graph of Group([ (1,2,3,4), (2,4) ]) on 5 vertices
#! with base-pair (1,3), 4 arcs>
#! gap> G := Group([ (1,2)(3,4) ]);;
#! gap> OrbitalGraph(G, [1, 2], 2);
#! <self-paired orbital graph of Group([ (1,2)(3,4) ]) on 2 vertices
#! with base-pair (1,2), 2 arcs>
#! @EndExampleSession
DeclareOperation("OrbitalGraph", [IsPermGroup, IsHomogeneousList]);
DeclareOperation("OrbitalGraph", [IsPermGroup, IsHomogeneousList, IsPosInt]);
#@Arguments G, basepair, points
#DeclareOperation("OrbitalGraph", [IsPermGroup, IsHomogeneousList, IsHomogeneousList]);
#@Arguments G, basepair
#DeclareOperation("OrbitalGraph", [IsPermGroup, IsHomogeneousList]);


#! @Section Information stored about orbital graphs at creation
Expand Down
25 changes: 25 additions & 0 deletions gap/OrbitalGraphs.gi
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,31 @@ function(G, points)
end);


# Individual orbital graphs

InstallMethod(OrbitalGraph,
"for a permutation group, homogeneous list, and pos int",
[IsPermGroup, IsHomogeneousList, IsPosInt],
function(G, basepair, k)
local D;
if not (Length(basepair) = 2 and ForAll(basepair, IsPosInt)) then
ErrorNoReturn("the second argument <basepair> must be a pair of ",
"positive integers");
elif basepair[1] > k or basepair[2] > k or
ForAny(GeneratorsOfGroup(G), g -> ForAny([1 .. k], i -> i ^ g > k)) then
ErrorNoReturn("the third argument <k> must be such that [1..k] ",
"contains the entries of <basepair> and is preserved ",
"by G");
fi;

D := EdgeOrbitsDigraph(G, basepair, k);
SetFilterObj(D, IsOrbitalGraphOfGroup);
SetUnderlyingGroup(D, G);
SetBasePair(D, basepair);
return D;
end);


# Transformation semigroups

InstallMethod(OrbitalGraphs, "for a transformation semigroup",
Expand Down
32 changes: 21 additions & 11 deletions tst/orbitalgraphs01.tst
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,33 @@ gap> OrbitalGraphs(D8);
, <self-paired orbital graph of D8 on 4 vertices
with base-pair (1,2), 8 arcs> ]

# doc/_Chapter_Orbital_graphs.xml:95-98
gap> true;
true
# doc/_Chapter_Orbital_graphs.xml:101-114
gap> D8 := DihedralGroup(IsPermGroup, 8);
Group([ (1,2,3,4), (2,4) ])
gap> OrbitalGraph(D8, [1, 3], 4);
<self-paired orbital graph of Group([ (1,2,3,4), (2,4) ]) on 4 vertices
with base-pair (1,3), 4 arcs>
gap> OrbitalGraph(D8, [1, 3], 5);
<self-paired orbital graph of Group([ (1,2,3,4), (2,4) ]) on 5 vertices
with base-pair (1,3), 4 arcs>
gap> G := Group([ (1,2)(3,4) ]);;
gap> OrbitalGraph(G, [1, 2], 2);
<self-paired orbital graph of Group([ (1,2)(3,4) ]) on 2 vertices
with base-pair (1,2), 2 arcs>

# doc/_Chapter_Orbital_graphs.xml:129-132
# doc/_Chapter_Orbital_graphs.xml:145-148
gap> true;
true

# doc/_Chapter_Orbital_graphs.xml:148-151
# doc/_Chapter_Orbital_graphs.xml:164-167
gap> true;
true

# doc/_Chapter_Orbital_graphs.xml:167-170
# doc/_Chapter_Orbital_graphs.xml:183-186
gap> true;
true

# doc/_Chapter_Orbital_graphs.xml:199-211
# doc/_Chapter_Orbital_graphs.xml:215-227
gap> OrbitalClosure(PSL(2,5)) = SymmetricGroup(6);
true
gap> C6 := CyclicGroup(IsPermGroup, 6);;
Expand All @@ -47,7 +57,7 @@ gap> IsConjugate(SymmetricGroup(6),
> closure, WreathProduct(Group([(1,2)]), Group([(1,2,3)])));
true

# doc/_Chapter_Orbital_graphs.xml:227-236
# doc/_Chapter_Orbital_graphs.xml:243-252
gap> OrbitalIndex(PSL(2,5));
12
gap> OrbitalIndex(PGL(2,5));
Expand All @@ -57,23 +67,23 @@ gap> OrbitalIndex(AlternatingGroup(6));
gap> OrbitalIndex(DihedralGroup(IsPermGroup, 6));
1

# doc/_Chapter_Orbital_graphs.xml:263-270
# doc/_Chapter_Orbital_graphs.xml:279-286
gap> IsOrbitalGraphRecognisable(QuaternionGroup(IsPermGroup, 8));
true
gap> IsOGR(AlternatingGroup(8));
false
gap> IsOGR(TrivialGroup(IsPermGroup));
true

# doc/_Chapter_Orbital_graphs.xml:294-301
# doc/_Chapter_Orbital_graphs.xml:310-317
gap> IsStronglyOrbitalGraphRecognisable(CyclicGroup(IsPermGroup, 8));
true
gap> IsStronglyOGR(QuaternionGroup(IsPermGroup, 8));
false
gap> IsStronglyOGR(TrivialGroup(IsPermGroup));
true

# doc/_Chapter_Orbital_graphs.xml:325-332
# doc/_Chapter_Orbital_graphs.xml:341-348
gap> IsAbsolutelyOrbitalGraphRecognisable(DihedralGroup(IsPermGroup, 8));
true
gap> IsAbsolutelyOGR(CyclicGroup(IsPermGroup, 8));
Expand Down
33 changes: 32 additions & 1 deletion tst/orbitals.tst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#@local S50product, orbitals, G, trivial
#@local S50product, orbitals, G, trivial, x
gap> START_TEST("OrbitalGraphs package: orbitalgraphs.tst");
gap> LoadPackage("orbitalgraphs", false);;

Expand Down Expand Up @@ -74,5 +74,36 @@ gap> OrbitalGraphs(SymmetricGroup(3), [2, 1]);
Error, the second argument <points> must be fixed setwise by the first argumen\
t <G>

# OrbitalGraph: Error checking
gap> G := DihedralGroup(IsPermGroup, 8);;
gap> OrbitalGraph(G, [0, 1], 4);
Error, the second argument <basepair> must be a pair of positive integers
gap> OrbitalGraph(G, [1, 1], 3);
Error, the third argument <k> must be such that [1..k] contains the entries of\
<basepair> and is preserved by G
gap> x := OrbitalGraph(G, [1, 5], 4);
Error, the third argument <k> must be such that [1..k] contains the entries of\
<basepair> and is preserved by G
gap> x := OrbitalGraph(G, [1, 1], 4);
<self-paired orbital graph of Group([ (1,2,3,4), (2,4) ]) on 4 vertices
with base-pair (1,1), 4 arcs>
gap> DigraphEdges(x);
[ [ 1, 1 ], [ 2, 2 ], [ 3, 3 ], [ 4, 4 ] ]
gap> x := OrbitalGraph(G, [2, 1], 4);
<self-paired orbital graph of Group([ (1,2,3,4), (2,4) ]) on 4 vertices
with base-pair (2,1), 8 arcs>
gap> DigraphEdges(x);
[ [ 1, 2 ], [ 1, 4 ], [ 2, 1 ], [ 2, 3 ], [ 3, 2 ], [ 3, 4 ], [ 4, 1 ],
[ 4, 3 ] ]
gap> x := OrbitalGraph(G, [3, 1], 5);
<self-paired orbital graph of Group([ (1,2,3,4), (2,4) ]) on 5 vertices
with base-pair (3,1), 4 arcs>
gap> DigraphEdges(x);
[ [ 1, 3 ], [ 2, 4 ], [ 3, 1 ], [ 4, 2 ] ]
gap> OrbitalGraphs(G) =
> List(OrbitalGraphs(G),
> x -> OrbitalGraph(G, BasePair(x), LargestMovedPoint(G)));
true

#
gap> STOP_TEST("OrbitalGraphs package: orbitalgraphs.tst", 0);

0 comments on commit 80fa6be

Please sign in to comment.