Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
35 changes: 25 additions & 10 deletions gap/semigroups/semigraph.gi
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,18 @@ end);
InstallMethod(AssignGeneratorVariables, "for an inverse semigroup",
[IsGraphInverseSemigroup],
function(S)
DoAssignGenVars(GeneratorsOfInverseSemigroup(S));
# the zero element uses the char 0, which cannot be assigned as a variable
if DigraphNrVertices(GraphOfGraphInverseSemigroup(S)) < 2 then
Info(InfoWarning, 1, "zero element is a generator but was not assigned!");
fi;
DoAssignGenVars(Difference(GeneratorsOfInverseSemigroup(S),
[MultiplicativeZero(S)]));
end);

InstallMethod(GraphInverseSemigroup, "for a digraph",
[IsDigraph],
function(graph)
local fam, S, gens, i;
local fam, S, gens, inv_gens, i;

fam := NewFamily("GraphInverseSemigroupElementsFamily",
IsGraphInverseSemigroupElement,
Expand All @@ -66,15 +71,24 @@ function(graph)
fam!.semigroup := S;

gens := [];
inv_gens := [];
SetGraphOfGraphInverseSemigroup(S, graph);

for i in [1 .. DigraphNrVertices(graph) + DigraphNrEdges(graph)] do
Add(gens, Objectify(fam!.type, [[i], graph]));
Add(inv_gens, Objectify(fam!.type, [[i], graph]));
od;
SetGeneratorsOfSemigroup(S,
Concatenation(gens,
List([1 .. DigraphNrEdges(graph)],
x -> gens[x] ^ -1)));
SetGeneratorsOfInverseSemigroup(S, gens);
SetGraphOfGraphInverseSemigroup(S, graph);

gens := Concatenation(inv_gens, List([1 .. DigraphNrEdges(graph)],
x -> inv_gens[x] ^ -1));

# if the graph has 0 or 1 vertex, then the zero element is not generated by
# products of vertices and edges, so must be added to both generating sets
if DigraphNrVertices(graph) < 2 then
Add(gens, MultiplicativeZero(S));
Add(inv_gens, MultiplicativeZero(S));
fi;
SetGeneratorsOfSemigroup(S, gens);
SetGeneratorsOfInverseSemigroup(S, inv_gens);
return S;
end);

Expand Down Expand Up @@ -286,7 +300,8 @@ InstallMethod(EdgesOfGraphInverseSemigroup,
"for a graph inverse semigroup",
[IsGraphInverseSemigroup],
S -> Difference(GeneratorsOfInverseSemigroup(S),
VerticesOfGraphInverseSemigroup(S)));
Concatenation([MultiplicativeZero(S)],
VerticesOfGraphInverseSemigroup(S))));

InstallMethod(IndexOfVertexOfGraphInverseSemigroup,
"for a graph inverse semigroup element",
Expand Down
4 changes: 2 additions & 2 deletions tst/standard/semigroups/grpperm.tst
Original file line number Diff line number Diff line change
Expand Up @@ -374,8 +374,8 @@ gap> iso := IsomorphismPermGroup(S);
Error, the argument (a semigroup) does not satisfy IsGroupAsSemigroup

# IsomorphismPermGroup: for a Integer Matrix Semigroup
gap> S := GraphInverseSemigroup(Digraph([[]]));
<finite graph inverse semigroup with 1 vertex, 0 edges>
gap> S := GraphInverseSemigroup(Digraph([]));
<finite graph inverse semigroup with 0 vertices, 0 edges>
gap> iso := IsomorphismPermGroup(S);;
gap> BruteForceIsoCheck(iso); BruteForceInverseCheck(iso);
true
Expand Down
4 changes: 2 additions & 2 deletions tst/standard/semigroups/semirms.tst
Original file line number Diff line number Diff line change
Expand Up @@ -1912,8 +1912,8 @@ true

# AsSemigroup:
# convert from IsGraphInverseSemigroup to IsReesMatrixSemigroup
gap> S := GraphInverseSemigroup(Digraph([[]]));
<finite graph inverse semigroup with 1 vertex, 0 edges>
gap> S := GraphInverseSemigroup(Digraph([]));
<finite graph inverse semigroup with 0 vertices, 0 edges>
gap> T := AsSemigroup(IsReesMatrixSemigroup, S);
<Rees matrix semigroup 1x1 over Group(())>
gap> Size(S) = Size(T);
Expand Down
Loading