Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions gap/oper.gd
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ DeclareOperation("DIGRAPHS_GraphProduct", [IsDigraph, IsDigraph, IsFunction]);
DeclareOperation("SwapDigraphs", [IsMutableDigraph, IsMutableDigraph]);

# 4. Actions . . .
DeclareOperation("^", [IsDigraph, IsPerm]);
DeclareOperation("^", [IsDigraph, IsTransformation]);
DeclareOperation("OnDigraphs", [IsDigraph, IsPerm]);
DeclareOperation("OnDigraphs", [IsDigraph, IsTransformation]);
DeclareOperation("OnDigraphsNC", [IsDigraph, IsPerm]);
Expand Down
10 changes: 10 additions & 0 deletions gap/oper.gi
Original file line number Diff line number Diff line change
Expand Up @@ -1138,6 +1138,16 @@ InstallMethod(DomainForAction, "for a digraph, list or collection and function",
[IsDigraph, IsListOrCollection, IsFunction],
ReturnTrue);

# Operator action: D^p and D^t
# Allow D ^ p (digraph and permutation) to call OnDigraphs(D, p)
# and D ^ t (digraph and transformation) to call OnDigraphs(D, t)

InstallMethod(\^, "digraph acted on by a permutation",
[IsDigraph, IsPerm], OnDigraphs);

InstallMethod(\^, "digraph acted on by a transformation",
[IsDigraph, IsTransformation], OnDigraphs);

#############################################################################
# 5. Substructures and quotients
#############################################################################
Expand Down
25 changes: 25 additions & 0 deletions tst/standard/oper.tst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#@local i1, i2, id, idom, in1, in2, in3, iter, j1, j2, m, m1, m2, mat, n, nbs
#@local out, out1, out2, out3, p1, p2, path, preorder, qr, r, res, rtclosure, t
#@local tclosure, u1, u2, x
#@local D, p, q, t, idp, idt, M
Comment thread
devansh2605 marked this conversation as resolved.
Outdated
gap> START_TEST("Digraphs package: standard/oper.tst");
gap> LoadPackage("digraphs", false);;

Expand Down Expand Up @@ -109,6 +110,30 @@ gap> gr := DigraphRemoveEdge(gr, [2, 1]);
gap> DigraphEdges(gr);
[ [ 1, 2 ] ]

# Tests for digraph operator "^" (implements D ^ p and D ^ t using OnDigraphs)
gap> D := CycleDigraph(5);
<immutable cycle digraph with 5 vertices>
gap> p := (1, 5)(2, 4);;
gap> D ^ p = DigraphReverse(D);
true
gap> OnDigraphs(D, p) = D ^ p;
true
gap> idp := ();;
gap> D ^ idp = D;
true
gap> q := (1, 2, 3, 4, 5);;
gap> (D ^ q) ^ (q ^ -1) = D;
true
gap> t := Transformation([2, 3, 4, 5, 1]);;
gap> D ^ t = OnDigraphs(D, t);
true
gap> idt := Transformation([1, 2, 3, 4, 5]);;
gap> D ^ idt = D;
true
gap> M := DigraphMutableCopy(D);;
gap> M ^ p = OnDigraphs(M, p);
true

# OnDigraphs: for a digraph and a perm
gap> gr := Digraph([[2], [1], [3]]);
<immutable digraph with 3 vertices, 3 edges>
Expand Down
Loading