Skip to content

Commit

Permalink
Improve ViewStrings/TrueMethods for tournaments/cycle digraphs
Browse files Browse the repository at this point in the history
  • Loading branch information
wilfwilson committed Mar 22, 2021
1 parent 24af130 commit a86f46f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 12 deletions.
3 changes: 2 additions & 1 deletion gap/digraph.gi
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,8 @@ function(D)
Append(str, "multi");
fi;

if HasIsTournament(D) and IsTournament(D) and n > 1 then
if not (HasIsCycleDigraph(D) and IsCycleDigraph(D))
and HasIsTournament(D) and IsTournament(D) and n > 1 then
Append(str, "tournament ");
display_nredges := false;
else
Expand Down
16 changes: 7 additions & 9 deletions gap/examples.gi
Original file line number Diff line number Diff line change
Expand Up @@ -243,21 +243,19 @@ InstallMethod(CycleDigraphCons,
function(filt, n)
local D;
D := MakeImmutable(CycleDigraphCons(IsMutableDigraph, n));
if n = 1 then
SetIsTransitiveDigraph(D, true);
SetDigraphHasLoops(D, true);
else
SetIsTransitiveDigraph(D, false);
SetDigraphHasLoops(D, false);
fi;
SetIsAcyclicDigraph(D, false);
SetIsCycleDigraph(D, true);
SetIsEmptyDigraph(D, false);
SetIsMultiDigraph(D, false);
SetDigraphNrEdges(D, n);
SetIsFunctionalDigraph(D, true);
SetIsStronglyConnectedDigraph(D, true);
SetIsTournament(D, n = 3);
SetIsTransitiveDigraph(D, n = 1);
SetAutomorphismGroup(D, CyclicGroup(IsPermGroup, n));
SetDigraphHasLoops(D, n = 1);
SetIsBipartiteDigraph(D, n mod 2 = 0);
if n > 1 then
SetChromaticNumber(D, 2 + (n mod 2));
fi;
return D;
end);

Expand Down
4 changes: 4 additions & 0 deletions gap/prop.gd
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,17 @@ InstallTrueMethod(IsBipartiteDigraph, IsUndirectedForest);
InstallTrueMethod(IsCompleteMultipartiteDigraph, IsCompleteBipartiteDigraph);
InstallTrueMethod(IsConnectedDigraph, IsBiconnectedDigraph);
InstallTrueMethod(IsConnectedDigraph, IsStronglyConnectedDigraph);
InstallTrueMethod(IsFunctionalDigraph, IsCycleDigraph);
InstallTrueMethod(IsHamiltonianDigraph,
IsTournament and IsStronglyConnectedDigraph);
InstallTrueMethod(IsInRegularDigraph, IsRegularDigraph);
InstallTrueMethod(IsOutRegularDigraph, IsRegularDigraph);
InstallTrueMethod(IsPreorderDigraph, IsPartialOrderDigraph);
InstallTrueMethod(IsRegularDigraph, IsInRegularDigraph and IsOutRegularDigraph);
InstallTrueMethod(IsRegularDigraph, IsVertexTransitive);
InstallTrueMethod(IsStronglyConnectedDigraph,
IsConnectedDigraph and IsSymmetricDigraph);
InstallTrueMethod(IsStronglyConnectedDigraph, IsCycleDigraph);
InstallTrueMethod(IsStronglyConnectedDigraph, IsEulerianDigraph);
InstallTrueMethod(IsStronglyConnectedDigraph, IsHamiltonianDigraph);
InstallTrueMethod(IsStronglyConnectedDigraph, IsUndirectedTree);
Expand Down
4 changes: 2 additions & 2 deletions gap/prop.gi
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ D -> IsDirectedTree(D) and IsSubset([0, 1], OutDegreeSet(D)));
InstallMethod(IsCycleDigraph, "for a digraph", [IsDigraph],
function(D)
return DigraphNrVertices(D) > 0
and IsStronglyConnectedDigraph(D)
and DigraphNrEdges(D) = DigraphNrVertices(D);
and DigraphNrEdges(D) = DigraphNrVertices(D)
and IsStronglyConnectedDigraph(D);
end);

InstallMethod(IsBiconnectedDigraph, "for a digraph", [IsDigraph],
Expand Down

0 comments on commit a86f46f

Please sign in to comment.