diff --git a/doc/attr.xml b/doc/attr.xml index ef7a8565c..5a0589f62 100644 --- a/doc/attr.xml +++ b/doc/attr.xml @@ -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 DigraphAllSimpleCircuits ignores + a multidigraph. The attribute DigraphAllChordlessCycles ignores multiple edges, and identifies a simple circuit using only its subsequence of vertices. See Section for more details.

diff --git a/gap/attr.gi b/gap/attr.gi index 353645b8d..a42736a5f 100644 --- a/gap/attr.gi +++ b/gap/attr.gi @@ -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 @@ -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; @@ -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]; diff --git a/tst/standard/attr.tst b/tst/standard/attr.tst index adc3896b4..35e82406d 100644 --- a/tst/standard/attr.tst +++ b/tst/standard/attr.tst @@ -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([]);;