Skip to content

Commit 6da9d7a

Browse files
committed
Add OnTuplesDigraphs and OnSetsDigraphs
1 parent 89dbee0 commit 6da9d7a

File tree

6 files changed

+118
-0
lines changed

6 files changed

+118
-0
lines changed

doc/oper.xml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,56 @@ gap> OutNeighbours(D2);
257257
</ManSection>
258258
<#/GAPDoc>
259259

260+
<#GAPDoc Label="OnTuplesDigraphs">
261+
<ManSection>
262+
<Oper Name="OnTuplesDigraphs" Arg="list, perm"
263+
Label="for a list of digraphs and a perm"/>
264+
<Oper Name="OnSetsDigraphs" Arg="list, perm"
265+
Label="for a set of digraphs and a perm"/>
266+
<Returns>A list or set of digraphs.</Returns>
267+
<Description>
268+
If <A>list</A> is a list of digraphs, and <A>perm</A> is a
269+
<E>permutation</E> of the vertices of the digraphs in <A>list</A>, then
270+
<Ref Oper="OnTuplesDigraphs" Label="for a list of digraphs and a perm"/>
271+
returns a new list constructed by applying <A>perm</A> via
272+
<Ref Oper="OnDigraphs" Label="for a digraph and a perm"/>
273+
to a copy (with the same mutability) of each entry of <A>list</A> in turn.
274+
<P/>
275+
276+
More precisely, <C>OnTuplesDigraphs(<A>list</A>,<A>perm</A>)</C> is a list
277+
of length <C>Length(<A>list</A>)</C>, whose <C>i</C>-th entry is
278+
<C>OnDigraphs(DigraphCopy(<A>list</A>[i]), <A>perm</A>)</C>.
279+
<P/>
280+
281+
If <A>list</A> is moreover a &GAP; set (i.e. a duplicate-free sorted list),
282+
then <Ref Oper="OnSetsDigraphs" Label="for a set of digraphs and a perm"/>
283+
returns the sorted output of
284+
<Ref Oper="OnTuplesDigraphs" Label="for a list of digraphs and a perm"/>,
285+
which is therefore again a set.
286+
<Example><![CDATA[
287+
gap> list := [CycleDigraph(IsMutableDigraph, 6),
288+
> DigraphReverse(CycleDigraph(6))];
289+
[ <mutable digraph with 6 vertices, 6 edges>,
290+
<immutable digraph with 6 vertices, 6 edges> ]
291+
gap> p := (1, 6)(2, 5)(3, 4);;
292+
gap> result_tuples := OnTuplesDigraphs(list, p);
293+
[ <mutable digraph with 6 vertices, 6 edges>,
294+
<immutable digraph with 6 vertices, 6 edges> ]
295+
gap> result_tuples[2] = OnDigraphs(list[2], p);
296+
true
297+
gap> result_tuples = list;
298+
false
299+
gap> result_tuples = Reversed(list);
300+
true
301+
gap> result_sets := OnSetsDigraphs(list, p);
302+
[ <immutable digraph with 6 vertices, 6 edges>,
303+
<mutable digraph with 6 vertices, 6 edges> ]
304+
gap> result_sets = list;
305+
true]]></Example>
306+
</Description>
307+
</ManSection>
308+
<#/GAPDoc>
309+
260310
<#GAPDoc Label="DigraphAddVertex">
261311
<ManSection>
262312
<Oper Name="DigraphAddVertex" Arg="digraph[, label ]"/>

doc/z-chap6.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ from} $E_a$ \emph{to} $E_b$. In this case we say that $E_a$ and $E_b$ are
1111
<Section><Heading>Acting on digraphs</Heading>
1212
<#Include Label="OnDigraphs">
1313
<#Include Label="OnMultiDigraphs">
14+
<#Include Label="OnTuplesDigraphs">
1415
</Section>
1516

1617
<Section Label="Isomorphisms and canonical labellings">

gap/digraph.gd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ DeclareCategory("IsDigraphWithAdjacencyFunction", IsDigraph);
1414
DeclareCategory("IsCayleyDigraph", IsDigraph);
1515
DeclareCategory("IsImmutableDigraph", IsDigraph);
1616
DeclareSynonym("IsMutableDigraph", IsDigraph and IsMutable);
17+
DeclareCategoryCollections("IsDigraph");
1718

1819
DeclareAttribute("DigraphMutabilityFilter", IsDigraph);
1920

gap/oper.gd

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ DeclareOperation("DIGRAPHS_GraphProduct", [IsDigraph, IsDigraph, IsFunction]);
5959
# 4. Actions . . .
6060
DeclareOperation("OnDigraphs", [IsDigraph, IsPerm]);
6161
DeclareOperation("OnDigraphs", [IsDigraph, IsTransformation]);
62+
DeclareOperation("OnTuplesDigraphs", [IsDigraphCollection, IsPerm]);
63+
DeclareOperation("OnSetsDigraphs", [IsDigraphCollection, IsPerm]);
6264
DeclareOperation("OnMultiDigraphs", [IsDigraph, IsPermCollection]);
6365
DeclareOperation("OnMultiDigraphs", [IsDigraph, IsPerm, IsPerm]);
6466

gap/oper.gi

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -826,6 +826,21 @@ function(D, t)
826826
return MakeImmutable(OnDigraphs(DigraphMutableCopy(D), t));
827827
end);
828828

829+
InstallMethod(OnTuplesDigraphs,
830+
"for list of digraphs and a perm",
831+
[IsDigraphCollection and IsHomogeneousList, IsPerm],
832+
{L, p} -> List(L, D -> OnDigraphs(DigraphMutableCopyIfMutable(D), p)));
833+
834+
InstallMethod(OnSetsDigraphs,
835+
"for a list of digraphs and a perm",
836+
[IsDigraphCollection and IsHomogeneousList, IsPerm],
837+
function(S, p)
838+
if not IsSet(S) then
839+
ErrorNoReturn("the first argument must be a set (a strictly sorted list),");
840+
fi;
841+
return Set(S, D -> OnDigraphs(DigraphMutableCopyIfMutable(D), p));
842+
end);
843+
829844
# Not revising the following because multi-digraphs are being withdrawn in the
830845
# near future.
831846

tst/standard/oper.tst

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,55 @@ gap> gr := OnDigraphs(gr, t);
149149
gap> OutNeighbours(gr);
150150
[ [ 2 ], [ 1, 1 ], [ ] ]
151151

152+
# OnTuplesDigraphs: for a digraph and a permutation
153+
gap> D := [ChainDigraph(3), CycleDigraph(4)];;
154+
gap> List(D, OutNeighbours);
155+
[ [ [ 2 ], [ 3 ], [ ] ], [ [ 2 ], [ 3 ], [ 4 ], [ 1 ] ] ]
156+
gap> List(OnTuplesDigraphs(D, (1, 3)), OutNeighbours);
157+
[ [ [ ], [ 1 ], [ 2 ] ], [ [ 4 ], [ 1 ], [ 2 ], [ 3 ] ] ]
158+
gap> D := [ChainDigraph(3), DigraphReverse(ChainDigraph(3))];;
159+
gap> List(D, OutNeighbours);
160+
[ [ [ 2 ], [ 3 ], [ ] ], [ [ ], [ 1 ], [ 2 ] ] ]
161+
gap> List(OnTuplesDigraphs(D, (1, 3)), OutNeighbours);
162+
[ [ [ ], [ 1 ], [ 2 ] ], [ [ 2 ], [ 3 ], [ ] ] ]
163+
gap> OnTuplesDigraphs(D, (1, 3)) = Permuted(D, (1, 2));
164+
true
165+
gap> D := EmptyDigraph(IsMutableDigraph, 3);;
166+
gap> DigraphAddEdge(D, 1, 1);;
167+
gap> out := OnTuplesDigraphs([D, D], (1, 2, 3));;
168+
gap> List(out, DigraphEdges);
169+
[ [ [ 2, 2 ] ], [ [ 2, 2 ] ] ]
170+
171+
# OnSetsDigraphs: for a digraph and a permutation
172+
gap> D := [DigraphReverse(ChainDigraph(3)), ChainDigraph(3)];;
173+
gap> IsSet(D);
174+
false
175+
gap> OnSetsDigraphs(D, (1, 2));
176+
Error, the first argument must be a set (a strictly sorted list),
177+
gap> D := Reversed(D);;
178+
gap> OnSetsDigraphs(D, (1, 3)) = D;
179+
true
180+
gap> OnSetsDigraphs(D, (1, 3)) = OnTuplesDigraphs(D, (1, 3));
181+
false
182+
gap> MinimalGeneratingSet(Stabilizer(SymmetricGroup(3), D, OnSetsDigraphs));
183+
[ (1,3) ]
184+
185+
# Set of orbital graphs of G := TransitiveGroup(6, 4)
186+
# The stabiliser of this set is the normaliser of G in S_6
187+
gap> x := Set(["&ECA@_OG", "&EQHcQHc", "&EHcQHcQ"], DigraphFromDigraph6String);
188+
[ <immutable digraph with 6 vertices, 6 edges>,
189+
<immutable digraph with 6 vertices, 12 edges>,
190+
<immutable digraph with 6 vertices, 12 edges> ]
191+
gap> Stabiliser(SymmetricGroup(6), x, OnSetsDigraphs)
192+
> = Group([(1, 2, 3, 4, 5, 6), (1, 5)(2, 4)(3, 6)]);
193+
true
194+
gap> OnTuplesDigraphs(x, (2, 3)(5, 6)) = x;
195+
false
196+
gap> OnTuplesDigraphs(x, (2, 3)(5, 6)) = [x[1], x[3], x[2]];
197+
true
198+
gap> OnSetsDigraphs(x, (2, 3)(5, 6)) = x;
199+
true
200+
152201
# OnMultiDigraphs: for a pair of permutations
153202
gap> gr1 := CompleteDigraph(3);
154203
<immutable complete digraph with 3 vertices>

0 commit comments

Comments
 (0)