Skip to content

Commit

Permalink
inserting review
Browse files Browse the repository at this point in the history
  • Loading branch information
MeikeWeiss committed Aug 29, 2024
1 parent 5f77862 commit a9d02b2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 35 deletions.
2 changes: 1 addition & 1 deletion doc/attr.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1388,7 +1388,7 @@ gap> DigraphLongestSimpleCircuit(D);

For a digraph without multiple edges, a simple circuit is uniquely
determined by its subsequence of vertices. However this is not the case for
a multidigraph. The attribute <C>DigraphAllSimpleCircuits</C> ignores
a multidigraph. The attribute <C>DigraphAllChordlessCycles</C> ignores
multiple edges, and identifies a simple circuit using only its subsequence
of vertices. See Section <Ref Subsect="DigraphAllSimpleCircuits" Style="Number" /> for more details.<P/>

Expand Down
34 changes: 3 additions & 31 deletions gap/attr.gi
Original file line number Diff line number Diff line change
Expand Up @@ -1505,7 +1505,7 @@ end);
InstallMethod(DigraphAllChordlessCycles, "for a digraph",
[IsDigraph],
function(D)
local BlockNeighbours, UnblockNeighbours, DegreeLabeling,
local BlockNeighbours, UnblockNeighbours,
Triplets, CCExtension, digraph, temp, T, C, blocked, triple;

if IsEmptyDigraph(D) then
Expand All @@ -1530,35 +1530,6 @@ function(D)
return blocked;
end;

# Computes the degree labeling
DegreeLabeling := function(digraph)
local degree, color, labeling, v, u, i, minDegree, x;

degree := List(DigraphVertices(digraph), i -> 0);
color := List(DigraphVertices(digraph), ReturnFalse);
labeling := List(DigraphVertices(digraph), i -> 0);
degree := List(DigraphVertices(digraph), i ->
OutDegreeOfVertex(digraph, i));

for i in [1 .. DigraphNrVertices(digraph)] do
minDegree := DigraphNrVertices(digraph);
for x in DigraphVertices(digraph) do
if color[x] = false and degree[x] < minDegree then
v := x;
minDegree := degree[x];
fi;
od;
labeling[v] := i;
color[v] := true;
for u in OutNeighboursOfVertex(digraph, v) do
if color[u] = false then
degree[u] := degree[u] - 1;
fi;
od;
od;
return labeling;
end;

# Computes all possible triplets
Triplets := function(digraph)
local T, C, u, pair, x, y, labels;
Expand Down Expand Up @@ -1610,7 +1581,8 @@ function(D)
digraph := DigraphSymmetricClosure(DigraphRemoveLoops(
DigraphRemoveAllMultipleEdges(D)));

SetDigraphVertexLabels(digraph, DegreeLabeling(digraph));
SetDigraphVertexLabels(digraph,
Reversed(DigraphDegeneracyOrdering(digraph)));
temp := Triplets(digraph);
T := temp[1];
C := temp[2];
Expand Down
6 changes: 3 additions & 3 deletions tst/standard/attr.tst
Original file line number Diff line number Diff line change
Expand Up @@ -963,9 +963,9 @@ gap> DigraphAllChordlessCycles(D);
[ [ 2, 1, 3 ], [ 2, 1, 4 ], [ 3, 1, 4 ], [ 3, 2, 4 ] ]
gap> D := Digraph([[2, 4, 5], [3, 6], [4, 7], [8], [6, 8], [7], [8], []]);;
gap> DigraphAllChordlessCycles(D);
[ [ 6, 5, 8, 7 ], [ 4, 3, 7, 8 ], [ 3, 2, 6, 5, 8, 4 ], [ 3, 2, 6, 7 ],
[ 4, 1, 5, 6, 7, 3 ], [ 4, 1, 5, 8 ], [ 2, 1, 5, 6 ], [ 2, 1, 5, 8, 7, 3 ],
[ 2, 1, 4, 3 ], [ 2, 1, 4, 8, 7, 6 ] ]
[ [ 6, 5, 8, 7 ], [ 3, 4, 8, 5, 6, 2 ], [ 3, 4, 8, 7 ], [ 1, 4, 8, 5 ],
[ 1, 4, 8, 7, 6, 2 ], [ 1, 4, 3, 2 ], [ 1, 4, 3, 7, 6, 5 ], [ 3, 2, 6, 7 ],
[ 2, 1, 5, 6 ], [ 2, 1, 5, 8, 7, 3 ] ]

# DigraphLongestSimpleCircuit
gap> gr := Digraph([]);;
Expand Down

0 comments on commit a9d02b2

Please sign in to comment.