Skip to content

Commit bca3537

Browse files
committed
Improve code coverage of FacialWalks, and tweak error checking
1 parent f050e58 commit bca3537

File tree

2 files changed

+20
-9
lines changed

2 files changed

+20
-9
lines changed

gap/attr.gi

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1859,7 +1859,7 @@ InstallMethod(DigraphAllChordlessCycles, "for a digraph",
18591859
D -> DigraphAllChordlessCyclesOfMaximalLength(D, INTOBJ_MAX));
18601860

18611861
# Compute for a given rotation system the facial walks
1862-
InstallMethod(FacialWalks, "for a digraph and a list",
1862+
InstallMethod(FacialWalks, "for a digraph and a dense list",
18631863
[IsDigraph, IsDenseList],
18641864
function(D, rotationSystem)
18651865
local FacialWalk, facialWalks, remEdges, cycle;
@@ -1868,18 +1868,17 @@ function(D, rotationSystem)
18681868
ErrorNoReturn("the 1st argument (digraph <D>) must be Eulerian");
18691869
fi;
18701870

1871-
if Length(rotationSystem) <> DigraphNrVertices(D) then
1872-
ErrorNoReturn("the 2nd argument (list <rotationSystem>) is not a rotation ",
1873-
"system for the 1st argument (digraph <D>), expected a dense",
1874-
" list of length ", DigraphNrVertices(D), "but found a dense",
1875-
" list of length ", Length(rotationSystem));
1871+
if Length(rotationSystem) <> DigraphNrVertices(D)
1872+
or not ForAll(rotationSystem, IsList) then
1873+
ErrorNoReturn("the 2nd argument (dense list <rotationSystem>) is not a ",
1874+
"rotation system for the 1st argument (digraph <D>), ",
1875+
"expected a list of ", DigraphNrVertices(D), " lists,");
18761876
fi;
18771877

1878-
if Difference(Union(rotationSystem), DigraphVertices(D)) <> [] then
1878+
if Union(rotationSystem) <> DigraphVertices(D) then
18791879
ErrorNoReturn("the 2nd argument (dense list <rotationSystem>) is not a ",
18801880
"rotation system for the 1st argument (digraph <D>), ",
1881-
"expected the union to be ", DigraphVertices(D), " but ",
1882-
"found ", Union(rotationSystem));
1881+
"expected its union to be the vertices of <D>,");
18831882
fi;
18841883

18851884
# computes a facial cycles starting with the edge 'startEdge'

tst/standard/attr.tst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1097,6 +1097,18 @@ gap> DigraphAllUndirectedSimpleCircuits(g);
10971097
[ 9, 5, 6, 10 ], [ 9, 5, 7, 8, 6, 10 ] ]
10981098

10991099
# FacialCycles
1100+
gap> FacialWalks(ChainDigraph(3), []);
1101+
Error, the 1st argument (digraph <D>) must be Eulerian
1102+
gap> FacialWalks(CycleDigraph(3), []);
1103+
Error, the 2nd argument (dense list <rotationSystem>) is not a rotation system\
1104+
for the 1st argument (digraph <D>), expected a list of 3 lists,
1105+
gap> FacialWalks(CycleDigraph(3), [1]);
1106+
Error, the 2nd argument (dense list <rotationSystem>) is not a rotation system\
1107+
for the 1st argument (digraph <D>), expected a list of 3 lists,
1108+
gap> FacialWalks(CycleDigraph(3), [[4], [1], [3]]);
1109+
Error, the 2nd argument (dense list <rotationSystem>) is not a rotation system\
1110+
for the 1st argument (digraph <D>), expected its union to be the vertices of \
1111+
<D>,
11001112
gap> g := Digraph([]);;
11011113
gap> rotationSy := [];;
11021114
gap> FacialWalks(g, rotationSy);

0 commit comments

Comments
 (0)