From 7af7d27d4d4a5491641eac7e844d76b2220a93ec Mon Sep 17 00:00:00 2001
From: William Kenyon <115789274+William-Kenyon@users.noreply.github.com>
Date: Thu, 24 Sep 2026 20:40:52 +0100
Subject: [PATCH 1/7] Fixes issue #942, adding checks for if a tournament is
paradoxical and k-paradoxical
---
doc/oper.xml | 28 ++++++++++++++++++++++++++++
doc/prop.xml | 28 ++++++++++++++++++++++++++++
doc/z-chap4.xml | 1 +
doc/z-chap5.xml | 1 +
gap/oper.gd | 1 +
gap/oper.gi | 38 ++++++++++++++++++++++++++++++++++++++
gap/prop.gd | 1 +
gap/prop.gi | 14 ++++++++++++++
tst/standard/oper.tst | 24 ++++++++++++++++++++++++
tst/standard/prop.tst | 18 ++++++++++++++++++
10 files changed, 154 insertions(+)
diff --git a/doc/oper.xml b/doc/oper.xml
index daa733164..b0c016c19 100644
--- a/doc/oper.xml
+++ b/doc/oper.xml
@@ -2133,6 +2133,34 @@ true
<#/GAPDoc>
+<#GAPDoc Label="IsKParadoxical">
+
+
+ true or false.
+
+ A tournament D is k-paradoxical if for every set
+ S of k vertices there is a vertex outside S which
+ is an in-neighbour of every vertex in S, i.e. there is one player
+ who beats all the players of S. This is a generalisation of
+ .
+
+ If D has no vertices, then the answer is false. If D
+ has at least one vertex and k is 0 then the answer is
+ true.
+
+ If k is negative or D is not a tournament (see
+ ), then an error is raised.
+ D := Digraph([[2, 3, 5], [3, 4, 6], [4, 5, 7], [5, 6, 1], [6, 7, 2],
+> [7, 1, 3], [1, 2, 4]]);;
+gap> IsKParadoxical(D, 2);
+true
+gap> IsKParadoxical(D, 3);
+false]]>
+
+
+<#/GAPDoc>
+
<#GAPDoc Label="DigraphDijkstra">
diff --git a/doc/prop.xml b/doc/prop.xml
index 8a7b39790..f4107a4bb 100644
--- a/doc/prop.xml
+++ b/doc/prop.xml
@@ -451,6 +451,34 @@ false
<#/GAPDoc>
+<#GAPDoc Label="IsParadoxical">
+
+
+ true or false.
+
+ A tournament D is paradoxical if every vertex has at least
+ one in-neighbour, i.e. each player loses at least one game. This is the
+ same as being 1-paradoxical; see .
+
+ If D has no vertices, then the answer is false.
+
+ If D is not a tournament (see ), then an
+ error is raised.
+
+
+ &MUTABLE_RECOMPUTED_PROP;
+
+ D := Digraph([[2], [3], [1]]);;
+gap> IsParadoxical(D);
+true
+gap> D := Digraph([[2, 3], [3], []]);;
+gap> IsParadoxical(D);
+false]]>
+
+
+<#/GAPDoc>
+
<#GAPDoc Label="IsChainDigraph">
diff --git a/doc/z-chap4.xml b/doc/z-chap4.xml
index 059e10eea..0b12cb846 100644
--- a/doc/z-chap4.xml
+++ b/doc/z-chap4.xml
@@ -18,6 +18,7 @@
<#Include Label="DigraphOutEdges">
<#Include Label="IsDigraphEdge">
<#Include Label="IsMatching">
+ <#Include Label="IsKParadoxical">
<#Include Label="DigraphMaximalMatching">
<#Include Label="DigraphMaximumMatching">
diff --git a/doc/z-chap5.xml b/doc/z-chap5.xml
index 491deb4c8..820c795bf 100644
--- a/doc/z-chap5.xml
+++ b/doc/z-chap5.xml
@@ -21,6 +21,7 @@
<#Include Label="IsReflexiveDigraph">
<#Include Label="IsSymmetricDigraph">
<#Include Label="IsTournament">
+ <#Include Label="IsParadoxical">
<#Include Label="IsTransitiveDigraph">
diff --git a/gap/oper.gd b/gap/oper.gd
index 4766b3496..0a47c5bf2 100644
--- a/gap/oper.gd
+++ b/gap/oper.gd
@@ -117,6 +117,7 @@ DeclareOperation("IsPerfectMatching", [IsDigraph, IsHomogeneousList]);
DeclareOperation("IsDigraphPath",
[IsDigraph, IsHomogeneousList, IsHomogeneousList]);
DeclareOperation("IsDigraphPath", [IsDigraph, IsList]);
+DeclareOperation("IsKParadoxical", [IsDigraph, IsInt]);
# 9. Connectivity . . .
DeclareOperation("DigraphIsKing", [IsDigraph, IsPosInt, IsPosInt]);
diff --git a/gap/oper.gi b/gap/oper.gi
index bdc462bee..93b378963 100644
--- a/gap/oper.gi
+++ b/gap/oper.gi
@@ -1596,6 +1596,44 @@ function(D, edges)
return true;
end);
+InstallMethod(IsKParadoxical, "for a tournament and a non-negative int",
+[IsDigraph, IsInt],
+function(D, k)
+ local n, subset, blists;
+ n := DigraphNrVertices(D);
+
+ if not IsTournament(D) then
+ ErrorNoReturn("the 1st argument must be a tournament,");
+ fi;
+
+ if k < 0 then
+ ErrorNoReturn("the 2nd argument must be non-negative,");
+ fi;
+
+ if n = 0 then
+ return false;
+ fi;
+
+ if k = 0 then
+ return true;
+ fi;
+
+ # this minimum number of vertices needed for k-paradox is given by
+ # Szekeres, E.; Szekeres, G. (1965), "On a problem of Schütte and Erdős"
+ if n < (k+2) * (2^(k-1)) - 1 then
+ return false;
+ fi;
+
+ blists := List(InNeighbours(D), inn -> BlistList([1..n], inn));
+ for subset in Combinations(blists, k) do
+ if SizeBlist(IntersectionBlist(subset)) = 0 then
+ return false;
+ fi;
+ od;
+
+ return true;
+end);
+
#############################################################################
# 9. Connectivity
#############################################################################
diff --git a/gap/prop.gd b/gap/prop.gd
index 808d67dc7..bbf2c134e 100644
--- a/gap/prop.gd
+++ b/gap/prop.gd
@@ -26,6 +26,7 @@ DeclareProperty("IsCompleteBipartiteDigraph", IsDigraph);
DeclareProperty("IsCompleteMultipartiteDigraph", IsDigraph);
DeclareProperty("IsCompleteDigraph", IsDigraph);
DeclareProperty("IsTournament", IsDigraph);
+DeclareProperty("IsParadoxical", IsDigraph);
DeclareProperty("IsChainDigraph", IsDigraph);
DeclareProperty("IsCycleDigraph", IsDigraph);
DeclareProperty("IsDigraphCore", IsDigraph);
diff --git a/gap/prop.gi b/gap/prop.gi
index 0c564ef17..e37e31e5d 100644
--- a/gap/prop.gi
+++ b/gap/prop.gi
@@ -339,6 +339,20 @@ function(D)
return IsAntisymmetricDigraph(D);
end);
+InstallMethod(IsParadoxical, "for a tournament",
+[IsDigraph],
+function(D)
+ if not IsTournament(D) then
+ ErrorNoReturn("the argument must be a tournament,");
+ fi;
+
+ if DigraphNrVertices(D) = 0 then
+ return false;
+ else
+ return not ForAny(InNeighbours(D), IsEmpty);
+ fi;
+end);
+
InstallMethod(IsEmptyDigraph, "for a digraph with known number of edges",
[IsDigraph and HasDigraphNrEdges],
D -> DigraphNrEdges(D) = 0);
diff --git a/tst/standard/oper.tst b/tst/standard/oper.tst
index 585f10a99..ef2c82ee4 100644
--- a/tst/standard/oper.tst
+++ b/tst/standard/oper.tst
@@ -41,6 +41,30 @@ gap> gr := Digraph([[], [3, 4], [1, 4], [1]]);
gap> DigraphIsKing(gr, 2, 2);
Error, the 1st argument must be a tournament,
+# IsKParadoxical: for a tournament and a non-negative integer
+gap> gr := Digraph([[2], [1]]);;
+gap> IsKParadoxical(gr, 1);
+Error, the 1st argument must be a tournament,
+gap> gr := EmptyDigraph(0);;
+gap> IsKParadoxical(gr, 1);
+false
+gap> gr := Digraph([[]]);;
+gap> IsKParadoxical(gr, 0);
+true
+gap> IsKParadoxical(gr, -1);
+Error, the 2nd argument must be non-negative,
+gap> gr := Digraph([[2], [3], [1]]);;
+gap> IsTournament(gr);
+true
+gap> IsKParadoxical(gr, 1);
+true
+gap> IsKParadoxical(gr, 2);
+false
+gap> gr := Digraph([[2, 3, 5], [3, 4, 6], [4, 5, 7], [5, 6, 1], [6, 7, 2],
+> [7, 1, 3], [1, 2, 4]]);;
+gap> IsKParadoxical(gr, 2);
+true
+
# DigraphRemoveLoops
gap> gr := DigraphFromDigraph6String("&EhxPC?@");
diff --git a/tst/standard/prop.tst b/tst/standard/prop.tst
index 623ff6713..7055af9f4 100644
--- a/tst/standard/prop.tst
+++ b/tst/standard/prop.tst
@@ -416,6 +416,24 @@ gap> gr := Digraph([[2], [1], [1]]);
gap> IsTournament(gr);
false
+# IsParadoxical
+gap> gr := Digraph([[2], [1]]);;
+gap> IsParadoxical(gr);
+Error, the argument must be a tournament,
+gap> gr := EmptyDigraph(0);;
+gap> IsParadoxical(gr);
+false
+gap> gr := Digraph([[2, 3], [3], []]);;
+gap> IsTournament(gr);
+true
+gap> IsParadoxical(gr);
+false
+gap> gr := Digraph([[2], [3], [1]]);;
+gap> IsTournament(gr);
+true
+gap> IsParadoxical(gr);
+true
+
# IsStronglyConnectedDigraph
gap> gr := Digraph([]);
From 032187e06b4006f496fca596627c8aee4514ca18 Mon Sep 17 00:00:00 2001
From: William Kenyon <115789274+William-Kenyon@users.noreply.github.com>
Date: Mon, 28 Sep 2026 15:02:58 +0100
Subject: [PATCH 2/7] Switch to DFS for subset intersections, more tests
---
gap/oper.gi | 36 ++++++++++++++++++++++++++----------
tst/standard/oper.tst | 14 +++++++-------
2 files changed, 33 insertions(+), 17 deletions(-)
diff --git a/gap/oper.gi b/gap/oper.gi
index 93b378963..0fe2ccfc1 100644
--- a/gap/oper.gi
+++ b/gap/oper.gi
@@ -1596,11 +1596,10 @@ function(D, edges)
return true;
end);
-InstallMethod(IsKParadoxical, "for a tournament and a non-negative int",
+InstallMethod(IsKParadoxical, "for a tournament and an integer",
[IsDigraph, IsInt],
function(D, k)
- local n, subset, blists;
- n := DigraphNrVertices(D);
+ local n, inn_blist, dfs;
if not IsTournament(D) then
ErrorNoReturn("the 1st argument must be a tournament,");
@@ -1610,6 +1609,8 @@ function(D, k)
ErrorNoReturn("the 2nd argument must be non-negative,");
fi;
+ n := DigraphNrVertices(D);
+
if n = 0 then
return false;
fi;
@@ -1618,20 +1619,35 @@ function(D, k)
return true;
fi;
+ if k = 1 then
+ return IsParadoxical(D);
+ fi;
+
# this minimum number of vertices needed for k-paradox is given by
# Szekeres, E.; Szekeres, G. (1965), "On a problem of Schütte and Erdős"
if n < (k+2) * (2^(k-1)) - 1 then
return false;
fi;
- blists := List(InNeighbours(D), inn -> BlistList([1..n], inn));
- for subset in Combinations(blists, k) do
- if SizeBlist(IntersectionBlist(subset)) = 0 then
- return false;
- fi;
- od;
+ inn_blist := List(InNeighbours(D), inn -> BlistList([1..n], inn));
- return true;
+ dfs := function(prev, depth, common)
+ local vertex, ncommon;
+ for vertex in [prev+1 .. n-k+depth+1] do
+ ncommon := IntersectionBlist(common, inn_blist[vertex]);
+ if SizeBlist(ncommon) = 0 then
+ return false;
+ fi;
+ if depth+1 < k then
+ if not dfs(vertex, depth+1, ncommon) then
+ return false;
+ fi;
+ fi;
+ od;
+ return true;
+ end;
+
+ return dfs(0, 0, BlistList([1 .. n], [1 .. n]));
end);
#############################################################################
diff --git a/tst/standard/oper.tst b/tst/standard/oper.tst
index ef2c82ee4..01728b71b 100644
--- a/tst/standard/oper.tst
+++ b/tst/standard/oper.tst
@@ -46,6 +46,8 @@ gap> gr := Digraph([[2], [1]]);;
gap> IsKParadoxical(gr, 1);
Error, the 1st argument must be a tournament,
gap> gr := EmptyDigraph(0);;
+gap> IsKParadoxical(gr, 0);
+false
gap> IsKParadoxical(gr, 1);
false
gap> gr := Digraph([[]]);;
@@ -54,16 +56,14 @@ true
gap> IsKParadoxical(gr, -1);
Error, the 2nd argument must be non-negative,
gap> gr := Digraph([[2], [3], [1]]);;
-gap> IsTournament(gr);
-true
gap> IsKParadoxical(gr, 1);
true
-gap> IsKParadoxical(gr, 2);
-false
-gap> gr := Digraph([[2, 3, 5], [3, 4, 6], [4, 5, 7], [5, 6, 1], [6, 7, 2],
-> [7, 1, 3], [1, 2, 4]]);;
-gap> IsKParadoxical(gr, 2);
+gap> gr := p -> Digraph(List([0 .. p-1], x -> List(Set(List([1 .. (p-1)/2],
+> i -> i^2 mod p)), s -> (x + s) mod p + 1)));;
+gap> IsKParadoxical(gr(19), 3);
true
+gap> IsKParadoxical(gr(7), 7);
+false
# DigraphRemoveLoops
gap> gr := DigraphFromDigraph6String("&EhxPC?@");
From d7b2be381b305248b38f84b5f94ec6e0c4fbc081 Mon Sep 17 00:00:00 2001
From: William Kenyon <115789274+William-Kenyon@users.noreply.github.com>
Date: Wed, 30 Sep 2026 14:44:39 +0100
Subject: [PATCH 3/7] Fix overlong line
---
doc/oper.xml | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/doc/oper.xml b/doc/oper.xml
index b0c016c19..baed20500 100644
--- a/doc/oper.xml
+++ b/doc/oper.xml
@@ -2151,8 +2151,8 @@ true
If k is negative or D is not a tournament (see
), then an error is raised.
D := Digraph([[2, 3, 5], [3, 4, 6], [4, 5, 7], [5, 6, 1], [6, 7, 2],
-> [7, 1, 3], [1, 2, 4]]);;
+gap> D := Digraph([[2, 3, 5], [3, 4, 6], [4, 5, 7], [5, 6, 1],
+> [6, 7, 2], [7, 1, 3], [1, 2, 4]]);;
gap> IsKParadoxical(D, 2);
true
gap> IsKParadoxical(D, 3);
@@ -2163,7 +2163,8 @@ false]]>
<#GAPDoc Label="DigraphDijkstra">
-
+
Two lists.
From d0d9da0b1b831f6ca91a8e6fa870e3415fee3630 Mon Sep 17 00:00:00 2001
From: William Kenyon <115789274+William-Kenyon@users.noreply.github.com>
Date: Thu, 1 Oct 2026 21:11:57 +0100
Subject: [PATCH 4/7] Correct whitespace
---
gap/oper.gi | 10 +++++-----
tst/standard/oper.tst | 6 ++++--
2 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/gap/oper.gi b/gap/oper.gi
index 0fe2ccfc1..4d07fe6d1 100644
--- a/gap/oper.gi
+++ b/gap/oper.gi
@@ -1625,21 +1625,21 @@ function(D, k)
# this minimum number of vertices needed for k-paradox is given by
# Szekeres, E.; Szekeres, G. (1965), "On a problem of Schütte and Erdős"
- if n < (k+2) * (2^(k-1)) - 1 then
+ if n < (k + 2) * (2 ^ (k - 1)) - 1 then
return false;
fi;
- inn_blist := List(InNeighbours(D), inn -> BlistList([1..n], inn));
+ inn_blist := List(InNeighbours(D), inn -> BlistList([1 .. n], inn));
dfs := function(prev, depth, common)
local vertex, ncommon;
- for vertex in [prev+1 .. n-k+depth+1] do
+ for vertex in [prev + 1 .. n - k + depth + 1] do
ncommon := IntersectionBlist(common, inn_blist[vertex]);
if SizeBlist(ncommon) = 0 then
return false;
fi;
- if depth+1 < k then
- if not dfs(vertex, depth+1, ncommon) then
+ if depth + 1 < k then
+ if not dfs(vertex, depth + 1, ncommon) then
return false;
fi;
fi;
diff --git a/tst/standard/oper.tst b/tst/standard/oper.tst
index 01728b71b..4f99d994f 100644
--- a/tst/standard/oper.tst
+++ b/tst/standard/oper.tst
@@ -58,8 +58,10 @@ Error, the 2nd argument must be non-negative,
gap> gr := Digraph([[2], [3], [1]]);;
gap> IsKParadoxical(gr, 1);
true
-gap> gr := p -> Digraph(List([0 .. p-1], x -> List(Set(List([1 .. (p-1)/2],
-> i -> i^2 mod p)), s -> (x + s) mod p + 1)));;
+gap> gr := p -> Digraph(
+> List([0 .. p - 1],
+> x -> List(Set(List([1 .. (p - 1) / 2], i -> i ^ 2 mod p)),
+> s -> (x + s) mod p + 1)));;
gap> IsKParadoxical(gr(19), 3);
true
gap> IsKParadoxical(gr(7), 7);
From 0ff2cde64e37b20c6659b0df7e8afdec5e14f129 Mon Sep 17 00:00:00 2001
From: William Kenyon <115789274+William-Kenyon@users.noreply.github.com>
Date: Thu, 1 Oct 2026 21:40:25 +0100
Subject: [PATCH 5/7] Improve test coverage: dfs finds nonparadoxical digraph
---
tst/standard/oper.tst | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/tst/standard/oper.tst b/tst/standard/oper.tst
index 4f99d994f..60cf81581 100644
--- a/tst/standard/oper.tst
+++ b/tst/standard/oper.tst
@@ -58,13 +58,17 @@ Error, the 2nd argument must be non-negative,
gap> gr := Digraph([[2], [3], [1]]);;
gap> IsKParadoxical(gr, 1);
true
+gap> gr := Digraph([[ 2, 4, 7 ], [ 4, 5, 7 ], [ 1, 2, 4, 6, 7 ],
+> [ ], [ 1, 3, 4, 6, 7 ], [ 1, 2, 4, 7 ], [ 4 ] ]);;
+gap> IsKParadoxical(gr, 2);
+false
gap> gr := p -> Digraph(
> List([0 .. p - 1],
> x -> List(Set(List([1 .. (p - 1) / 2], i -> i ^ 2 mod p)),
> s -> (x + s) mod p + 1)));;
gap> IsKParadoxical(gr(19), 3);
true
-gap> IsKParadoxical(gr(7), 7);
+gap> IsKParadoxical(gr(19), 4);
false
# DigraphRemoveLoops
From 7a99180215f6c7b06c71da5aca9971f06c25d82d Mon Sep 17 00:00:00 2001
From: William Kenyon <115789274+William-Kenyon@users.noreply.github.com>
Date: Thu, 1 Oct 2026 21:42:25 +0100
Subject: [PATCH 6/7] Fix whitespace
---
tst/standard/oper.tst | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tst/standard/oper.tst b/tst/standard/oper.tst
index 60cf81581..736fe0a1c 100644
--- a/tst/standard/oper.tst
+++ b/tst/standard/oper.tst
@@ -58,8 +58,8 @@ Error, the 2nd argument must be non-negative,
gap> gr := Digraph([[2], [3], [1]]);;
gap> IsKParadoxical(gr, 1);
true
-gap> gr := Digraph([[ 2, 4, 7 ], [ 4, 5, 7 ], [ 1, 2, 4, 6, 7 ],
-> [ ], [ 1, 3, 4, 6, 7 ], [ 1, 2, 4, 7 ], [ 4 ] ]);;
+gap> gr := Digraph([[2, 4, 7], [4, 5, 7], [1, 2, 4, 6, 7],
+> [], [1, 3, 4, 6, 7], [1, 2, 4, 7], [4]]);;
gap> IsKParadoxical(gr, 2);
false
gap> gr := p -> Digraph(
From e9074e84b0c01b381fe4355efa019d91a3f5d1f7 Mon Sep 17 00:00:00 2001
From: William-Kenyon <115789274+William-Kenyon@users.noreply.github.com>
Date: Wed, 7 Oct 2026 13:37:43 +0100
Subject: [PATCH 7/7] Rename for clarity and keeping to scheme
---
doc/oper.xml | 10 +++++-----
doc/prop.xml | 11 ++++++-----
doc/z-chap4.xml | 2 +-
doc/z-chap5.xml | 2 +-
gap/oper.gd | 2 +-
gap/oper.gi | 12 ++++++------
gap/prop.gd | 2 +-
gap/prop.gi | 2 +-
tst/standard/oper.tst | 20 ++++++++++----------
tst/standard/prop.tst | 8 ++++----
10 files changed, 36 insertions(+), 35 deletions(-)
diff --git a/doc/oper.xml b/doc/oper.xml
index baed20500..cf9221328 100644
--- a/doc/oper.xml
+++ b/doc/oper.xml
@@ -2133,16 +2133,16 @@ true
<#/GAPDoc>
-<#GAPDoc Label="IsKParadoxical">
+<#GAPDoc Label="IsKParadoxicalTournament">
-
+
true or false.
A tournament D is k-paradoxical if for every set
S of k vertices there is a vertex outside S which
is an in-neighbour of every vertex in S, i.e. there is one player
who beats all the players of S. This is a generalisation of
- .
+ .
If D has no vertices, then the answer is false. If D
has at least one vertex and k is 0 then the answer is
@@ -2153,9 +2153,9 @@ true
D := Digraph([[2, 3, 5], [3, 4, 6], [4, 5, 7], [5, 6, 1],
> [6, 7, 2], [7, 1, 3], [1, 2, 4]]);;
-gap> IsKParadoxical(D, 2);
+gap> IsKParadoxicalTournament(D, 2);
true
-gap> IsKParadoxical(D, 3);
+gap> IsKParadoxicalTournament(D, 3);
false]]>
diff --git a/doc/prop.xml b/doc/prop.xml
index f4107a4bb..5c293f4a3 100644
--- a/doc/prop.xml
+++ b/doc/prop.xml
@@ -451,14 +451,15 @@ false
<#/GAPDoc>
-<#GAPDoc Label="IsParadoxical">
+<#GAPDoc Label="IsParadoxicalTournament">
-
+
true or false.
A tournament D is paradoxical if every vertex has at least
one in-neighbour, i.e. each player loses at least one game. This is the
- same as being 1-paradoxical; see .
+ same as being 1-paradoxical; see
+ .
If D has no vertices, then the answer is false.
@@ -470,10 +471,10 @@ false
D := Digraph([[2], [3], [1]]);;
-gap> IsParadoxical(D);
+gap> IsParadoxicalTournament(D);
true
gap> D := Digraph([[2, 3], [3], []]);;
-gap> IsParadoxical(D);
+gap> IsParadoxicalTournament(D);
false]]>
diff --git a/doc/z-chap4.xml b/doc/z-chap4.xml
index 0b12cb846..dcfdebb06 100644
--- a/doc/z-chap4.xml
+++ b/doc/z-chap4.xml
@@ -18,7 +18,7 @@
<#Include Label="DigraphOutEdges">
<#Include Label="IsDigraphEdge">
<#Include Label="IsMatching">
- <#Include Label="IsKParadoxical">
+ <#Include Label="IsKParadoxicalTournament">
<#Include Label="DigraphMaximalMatching">
<#Include Label="DigraphMaximumMatching">
diff --git a/doc/z-chap5.xml b/doc/z-chap5.xml
index 820c795bf..f1da97657 100644
--- a/doc/z-chap5.xml
+++ b/doc/z-chap5.xml
@@ -21,7 +21,7 @@
<#Include Label="IsReflexiveDigraph">
<#Include Label="IsSymmetricDigraph">
<#Include Label="IsTournament">
- <#Include Label="IsParadoxical">
+ <#Include Label="IsParadoxicalTournament">
<#Include Label="IsTransitiveDigraph">
diff --git a/gap/oper.gd b/gap/oper.gd
index 0a47c5bf2..da757c6cc 100644
--- a/gap/oper.gd
+++ b/gap/oper.gd
@@ -117,7 +117,7 @@ DeclareOperation("IsPerfectMatching", [IsDigraph, IsHomogeneousList]);
DeclareOperation("IsDigraphPath",
[IsDigraph, IsHomogeneousList, IsHomogeneousList]);
DeclareOperation("IsDigraphPath", [IsDigraph, IsList]);
-DeclareOperation("IsKParadoxical", [IsDigraph, IsInt]);
+DeclareOperation("IsKParadoxicalTournament", [IsDigraph, IsInt]);
# 9. Connectivity . . .
DeclareOperation("DigraphIsKing", [IsDigraph, IsPosInt, IsPosInt]);
diff --git a/gap/oper.gi b/gap/oper.gi
index 4d07fe6d1..4a072885a 100644
--- a/gap/oper.gi
+++ b/gap/oper.gi
@@ -1596,10 +1596,10 @@ function(D, edges)
return true;
end);
-InstallMethod(IsKParadoxical, "for a tournament and an integer",
+InstallMethod(IsKParadoxicalTournament, "for a tournament and an integer",
[IsDigraph, IsInt],
function(D, k)
- local n, inn_blist, dfs;
+ local n, inn_blist, backtrack;
if not IsTournament(D) then
ErrorNoReturn("the 1st argument must be a tournament,");
@@ -1620,7 +1620,7 @@ function(D, k)
fi;
if k = 1 then
- return IsParadoxical(D);
+ return IsParadoxicalTournament(D);
fi;
# this minimum number of vertices needed for k-paradox is given by
@@ -1631,7 +1631,7 @@ function(D, k)
inn_blist := List(InNeighbours(D), inn -> BlistList([1 .. n], inn));
- dfs := function(prev, depth, common)
+ backtrack := function(prev, depth, common)
local vertex, ncommon;
for vertex in [prev + 1 .. n - k + depth + 1] do
ncommon := IntersectionBlist(common, inn_blist[vertex]);
@@ -1639,7 +1639,7 @@ function(D, k)
return false;
fi;
if depth + 1 < k then
- if not dfs(vertex, depth + 1, ncommon) then
+ if not backtrack(vertex, depth + 1, ncommon) then
return false;
fi;
fi;
@@ -1647,7 +1647,7 @@ function(D, k)
return true;
end;
- return dfs(0, 0, BlistList([1 .. n], [1 .. n]));
+ return backtrack(0, 0, BlistList([1 .. n], [1 .. n]));
end);
#############################################################################
diff --git a/gap/prop.gd b/gap/prop.gd
index bbf2c134e..c015a03e9 100644
--- a/gap/prop.gd
+++ b/gap/prop.gd
@@ -26,7 +26,7 @@ DeclareProperty("IsCompleteBipartiteDigraph", IsDigraph);
DeclareProperty("IsCompleteMultipartiteDigraph", IsDigraph);
DeclareProperty("IsCompleteDigraph", IsDigraph);
DeclareProperty("IsTournament", IsDigraph);
-DeclareProperty("IsParadoxical", IsDigraph);
+DeclareProperty("IsParadoxicalTournament", IsDigraph);
DeclareProperty("IsChainDigraph", IsDigraph);
DeclareProperty("IsCycleDigraph", IsDigraph);
DeclareProperty("IsDigraphCore", IsDigraph);
diff --git a/gap/prop.gi b/gap/prop.gi
index e37e31e5d..84bdde087 100644
--- a/gap/prop.gi
+++ b/gap/prop.gi
@@ -339,7 +339,7 @@ function(D)
return IsAntisymmetricDigraph(D);
end);
-InstallMethod(IsParadoxical, "for a tournament",
+InstallMethod(IsParadoxicalTournament, "for a tournament",
[IsDigraph],
function(D)
if not IsTournament(D) then
diff --git a/tst/standard/oper.tst b/tst/standard/oper.tst
index 736fe0a1c..afb3b31b0 100644
--- a/tst/standard/oper.tst
+++ b/tst/standard/oper.tst
@@ -41,34 +41,34 @@ gap> gr := Digraph([[], [3, 4], [1, 4], [1]]);
gap> DigraphIsKing(gr, 2, 2);
Error, the 1st argument must be a tournament,
-# IsKParadoxical: for a tournament and a non-negative integer
+# IsKParadoxicalTournament: for a tournament and a non-negative integer
gap> gr := Digraph([[2], [1]]);;
-gap> IsKParadoxical(gr, 1);
+gap> IsKParadoxicalTournament(gr, 1);
Error, the 1st argument must be a tournament,
gap> gr := EmptyDigraph(0);;
-gap> IsKParadoxical(gr, 0);
+gap> IsKParadoxicalTournament(gr, 0);
false
-gap> IsKParadoxical(gr, 1);
+gap> IsKParadoxicalTournament(gr, 1);
false
gap> gr := Digraph([[]]);;
-gap> IsKParadoxical(gr, 0);
+gap> IsKParadoxicalTournament(gr, 0);
true
-gap> IsKParadoxical(gr, -1);
+gap> IsKParadoxicalTournament(gr, -1);
Error, the 2nd argument must be non-negative,
gap> gr := Digraph([[2], [3], [1]]);;
-gap> IsKParadoxical(gr, 1);
+gap> IsKParadoxicalTournament(gr, 1);
true
gap> gr := Digraph([[2, 4, 7], [4, 5, 7], [1, 2, 4, 6, 7],
> [], [1, 3, 4, 6, 7], [1, 2, 4, 7], [4]]);;
-gap> IsKParadoxical(gr, 2);
+gap> IsKParadoxicalTournament(gr, 2);
false
gap> gr := p -> Digraph(
> List([0 .. p - 1],
> x -> List(Set(List([1 .. (p - 1) / 2], i -> i ^ 2 mod p)),
> s -> (x + s) mod p + 1)));;
-gap> IsKParadoxical(gr(19), 3);
+gap> IsKParadoxicalTournament(gr(19), 3);
true
-gap> IsKParadoxical(gr(19), 4);
+gap> IsKParadoxicalTournament(gr(19), 4);
false
# DigraphRemoveLoops
diff --git a/tst/standard/prop.tst b/tst/standard/prop.tst
index 7055af9f4..5384a77cb 100644
--- a/tst/standard/prop.tst
+++ b/tst/standard/prop.tst
@@ -418,20 +418,20 @@ false
# IsParadoxical
gap> gr := Digraph([[2], [1]]);;
-gap> IsParadoxical(gr);
+gap> IsParadoxicalTournament(gr);
Error, the argument must be a tournament,
gap> gr := EmptyDigraph(0);;
-gap> IsParadoxical(gr);
+gap> IsParadoxicalTournament(gr);
false
gap> gr := Digraph([[2, 3], [3], []]);;
gap> IsTournament(gr);
true
-gap> IsParadoxical(gr);
+gap> IsParadoxicalTournament(gr);
false
gap> gr := Digraph([[2], [3], [1]]);;
gap> IsTournament(gr);
true
-gap> IsParadoxical(gr);
+gap> IsParadoxicalTournament(gr);
true
# IsStronglyConnectedDigraph