Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 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
23 changes: 19 additions & 4 deletions gap/semigroups/semigraph.gi
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ end);
InstallMethod(AssignGeneratorVariables, "for an inverse semigroup",
[IsGraphInverseSemigroup],
function(S)
DoAssignGenVars(GeneratorsOfInverseSemigroup(S));
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",
Expand Down Expand Up @@ -66,15 +70,25 @@ function(graph)
fam!.semigroup := S;

gens := [];
SetGraphOfGraphInverseSemigroup(S, graph);
for i in [1 .. DigraphNrVertices(graph) + DigraphNrEdges(graph)] do
Add(gens, Objectify(fam!.type, [[i], graph]));
od;
SetGeneratorsOfSemigroup(S,

if DigraphNrVertices(graph) < 2 then
SetGeneratorsOfSemigroup(S,
Concatenation(gens,
List([1 .. DigraphNrEdges(graph)],
x -> gens[x] ^ -1),
[MultiplicativeZero(S)]));
Add(gens, MultiplicativeZero(S));
else
SetGeneratorsOfSemigroup(S,
Concatenation(gens,
List([1 .. DigraphNrEdges(graph)],
x -> gens[x] ^ -1)));
fi;
SetGeneratorsOfInverseSemigroup(S, gens);
SetGraphOfGraphInverseSemigroup(S, graph);
Comment on lines -72 to -77

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This'd be more compact as (a properly formatted, and working version of):

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

if the order of the generators is not important, then you could conditionally add the zero to inv_gens before populating gens. I haven't checked that this actually works.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I've added it at the end as there are test cases that use the fact that, for any i less than the number of edges,

S.i = e_i

And this way it shouldn't break anything

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think that makes sense

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Will implement your changes and add some comments

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