Skip to content

Commit f050e58

Browse files
committed
Change 4-space tabs to 2-space tabs in attr.gi
1 parent 18d1e78 commit f050e58

File tree

1 file changed

+145
-147
lines changed

1 file changed

+145
-147
lines changed

gap/attr.gi

Lines changed: 145 additions & 147 deletions
Original file line numberDiff line numberDiff line change
@@ -1761,97 +1761,97 @@ function(D, maxLength)
17611761
local BlockNeighbours, UnblockNeighbours, Triplets, CCExtension, temp, T, C,
17621762
blocked, triple;
17631763

1764-
if IsEmptyDigraph(D) then
1765-
return [];
1766-
fi;
1764+
if IsEmptyDigraph(D) then
1765+
return [];
1766+
fi;
17671767

1768-
BlockNeighbours := function(D, v, blocked)
1769-
local u;
1770-
for u in OutNeighboursOfVertex(D, v) do
1771-
blocked[u] := blocked[u] + 1;
1772-
od;
1773-
return blocked;
1774-
end;
1775-
1776-
UnblockNeighbours := function(D, v, blocked)
1777-
local u;
1778-
for u in OutNeighboursOfVertex(D, v) do
1779-
if blocked[u] > 0 then
1780-
blocked[u] := blocked[u] - 1;
1781-
fi;
1782-
od;
1783-
return blocked;
1784-
end;
1785-
1786-
# Computes all possible triplets
1787-
Triplets := function(D)
1788-
local T, C, u, pair, x, y, labels;
1789-
T := [];
1790-
C := [];
1791-
for u in DigraphVertices(D) do
1792-
for pair in Combinations(OutNeighboursOfVertex(D, u), 2) do
1793-
x := pair[1];
1794-
y := pair[2];
1795-
labels := DigraphVertexLabels(D);
1796-
if labels[u] < labels[x] and labels[x] < labels[y] then
1797-
if not IsDigraphEdge(D, x, y) then
1798-
Add(T, [x, u, y]);
1799-
else
1800-
Add(C, [x, u, y]);
1801-
fi;
1802-
elif labels[u] < labels[y] and labels[y] < labels[x] then
1803-
if not IsDigraphEdge(D, x, y) then
1804-
Add(T, [y, u, x]);
1805-
else
1806-
Add(C, [y, u, x]);
1807-
fi;
1808-
fi;
1809-
od;
1810-
od;
1811-
return [T, C];
1812-
end;
1813-
1814-
# Extends a given chordless path if possible
1815-
CCExtension := function(D, path, C, key, blocked)
1816-
local v, extendedPath, data;
1817-
blocked := BlockNeighbours(D, path[Length(path)], blocked);
1818-
for v in OutNeighboursOfVertex(D, path[Length(path)]) do
1819-
if DigraphVertexLabel(D, v) > key and blocked[v] = 1
1820-
and Length(path) < maxLength then
1821-
extendedPath := Concatenation(path, [v]);
1822-
if IsDigraphEdge(D, v, path[1]) then
1823-
Add(C, extendedPath);
1824-
else
1825-
data := CCExtension(D, extendedPath, C, key, blocked);
1826-
C := data[1];
1827-
blocked := data[2];
1828-
fi;
1829-
fi;
1830-
od;
1831-
blocked := UnblockNeighbours(D, path[Length(path)], blocked);
1832-
return [C, blocked];
1833-
end;
1768+
BlockNeighbours := function(D, v, blocked)
1769+
local u;
1770+
for u in OutNeighboursOfVertex(D, v) do
1771+
blocked[u] := blocked[u] + 1;
1772+
od;
1773+
return blocked;
1774+
end;
18341775

1835-
D := DigraphMutableCopy(D);
1836-
DigraphSymmetricClosure(DigraphRemoveLoops(
1837-
DigraphRemoveAllMultipleEdges(D)));
1838-
MakeImmutable(D);
1839-
SetDigraphVertexLabels(D, Reversed(DigraphDegeneracyOrdering(D)));
1840-
1841-
temp := Triplets(D);
1842-
T := temp[1];
1843-
C := temp[2];
1844-
blocked := List(DigraphVertices(D), i -> 0);
1845-
while T <> [] do
1846-
triple := Remove(T);
1847-
blocked := BlockNeighbours(D, triple[2], blocked);
1848-
temp := CCExtension(D, triple, C,
1849-
DigraphVertexLabel(D, triple[2]), blocked);
1850-
C := temp[1];
1851-
blocked := temp[2];
1852-
blocked := UnblockNeighbours(D, triple[2], blocked);
1776+
UnblockNeighbours := function(D, v, blocked)
1777+
local u;
1778+
for u in OutNeighboursOfVertex(D, v) do
1779+
if blocked[u] > 0 then
1780+
blocked[u] := blocked[u] - 1;
1781+
fi;
18531782
od;
1854-
return C;
1783+
return blocked;
1784+
end;
1785+
1786+
# Computes all possible triplets
1787+
Triplets := function(D)
1788+
local T, C, u, pair, x, y, labels;
1789+
T := [];
1790+
C := [];
1791+
for u in DigraphVertices(D) do
1792+
for pair in Combinations(OutNeighboursOfVertex(D, u), 2) do
1793+
x := pair[1];
1794+
y := pair[2];
1795+
labels := DigraphVertexLabels(D);
1796+
if labels[u] < labels[x] and labels[x] < labels[y] then
1797+
if not IsDigraphEdge(D, x, y) then
1798+
Add(T, [x, u, y]);
1799+
else
1800+
Add(C, [x, u, y]);
1801+
fi;
1802+
elif labels[u] < labels[y] and labels[y] < labels[x] then
1803+
if not IsDigraphEdge(D, x, y) then
1804+
Add(T, [y, u, x]);
1805+
else
1806+
Add(C, [y, u, x]);
1807+
fi;
1808+
fi;
1809+
od;
1810+
od;
1811+
return [T, C];
1812+
end;
1813+
1814+
# Extends a given chordless path if possible
1815+
CCExtension := function(D, path, C, key, blocked)
1816+
local v, extendedPath, data;
1817+
blocked := BlockNeighbours(D, path[Length(path)], blocked);
1818+
for v in OutNeighboursOfVertex(D, path[Length(path)]) do
1819+
if DigraphVertexLabel(D, v) > key and blocked[v] = 1
1820+
and Length(path) < maxLength then
1821+
extendedPath := Concatenation(path, [v]);
1822+
if IsDigraphEdge(D, v, path[1]) then
1823+
Add(C, extendedPath);
1824+
else
1825+
data := CCExtension(D, extendedPath, C, key, blocked);
1826+
C := data[1];
1827+
blocked := data[2];
1828+
fi;
1829+
fi;
1830+
od;
1831+
blocked := UnblockNeighbours(D, path[Length(path)], blocked);
1832+
return [C, blocked];
1833+
end;
1834+
1835+
D := DigraphMutableCopy(D);
1836+
DigraphSymmetricClosure(DigraphRemoveLoops(
1837+
DigraphRemoveAllMultipleEdges(D)));
1838+
MakeImmutable(D);
1839+
SetDigraphVertexLabels(D, Reversed(DigraphDegeneracyOrdering(D)));
1840+
1841+
temp := Triplets(D);
1842+
T := temp[1];
1843+
C := temp[2];
1844+
blocked := List(DigraphVertices(D), i -> 0);
1845+
while T <> [] do
1846+
triple := Remove(T);
1847+
blocked := BlockNeighbours(D, triple[2], blocked);
1848+
temp := CCExtension(D, triple, C, DigraphVertexLabel(D, triple[2]),
1849+
blocked);
1850+
C := temp[1];
1851+
blocked := temp[2];
1852+
blocked := UnblockNeighbours(D, triple[2], blocked);
1853+
od;
1854+
return C;
18551855
end);
18561856

18571857
InstallMethod(DigraphAllChordlessCycles, "for a digraph",
@@ -1862,74 +1862,72 @@ D -> DigraphAllChordlessCyclesOfMaximalLength(D, INTOBJ_MAX));
18621862
InstallMethod(FacialWalks, "for a digraph and a list",
18631863
[IsDigraph, IsDenseList],
18641864
function(D, rotationSystem)
1865+
local FacialWalk, facialWalks, remEdges, cycle;
18651866

1866-
local FacialWalk, facialWalks, remEdges, cycle;
1867-
1868-
if not IsEulerianDigraph(D) then
1869-
ErrorNoReturn("the 1st argument (digraph <D>) must be Eulerian");
1870-
fi;
1867+
if not IsEulerianDigraph(D) then
1868+
ErrorNoReturn("the 1st argument (digraph <D>) must be Eulerian");
1869+
fi;
18711870

1872-
if Length(rotationSystem) <> DigraphNrVertices(D) then
1873-
ErrorNoReturn("the 2nd argument (list <rotationSystem>) is not a ",
1874-
"rotation ",
1875-
"system for the 1st argument (digraph <D>), expected a dense",
1876-
" list of length ", DigraphNrVertices(D), "but found a dense",
1877-
" list of length ", Length(rotationSystem));
1878-
fi;
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));
1876+
fi;
18791877

1880-
if Difference(Union(rotationSystem), DigraphVertices(D)) <> [] then
1881-
ErrorNoReturn("the 2nd argument (dense list <rotationSystem>) is not a ",
1882-
"rotation system for the 1st argument (digraph <D>), ",
1883-
"expected the union to be ", DigraphVertices(D), " but ",
1884-
"found ", Union(rotationSystem));
1885-
fi;
1878+
if Difference(Union(rotationSystem), DigraphVertices(D)) <> [] then
1879+
ErrorNoReturn("the 2nd argument (dense list <rotationSystem>) is not a ",
1880+
"rotation system for the 1st argument (digraph <D>), ",
1881+
"expected the union to be ", DigraphVertices(D), " but ",
1882+
"found ", Union(rotationSystem));
1883+
fi;
18861884

1887-
# computes a facial cycles starting with the edge 'startEdge'
1888-
FacialWalk := function(rotationSystem, startEdge)
1889-
local startVertex, preVertex, actVertex, cycle, nextVertex, pos;
1885+
# computes a facial cycles starting with the edge 'startEdge'
1886+
FacialWalk := function(rotationSystem, startEdge)
1887+
local startVertex, preVertex, actVertex, cycle, nextVertex, pos;
18901888

1891-
startVertex := startEdge[1];
1892-
actVertex := startEdge[2];
1893-
preVertex := startVertex;
1889+
startVertex := startEdge[1];
1890+
actVertex := startEdge[2];
1891+
preVertex := startVertex;
18941892

1895-
cycle := [startVertex, actVertex];
1893+
cycle := [startVertex, actVertex];
18961894

1897-
nextVertex := 0; # just an initialization
1898-
while true do
1899-
pos := Position(rotationSystem[actVertex], preVertex);
1895+
nextVertex := 0; # just an initialization
1896+
while true do
1897+
pos := Position(rotationSystem[actVertex], preVertex);
19001898

1901-
if pos < Length(rotationSystem[actVertex]) then
1902-
nextVertex := rotationSystem[actVertex][pos + 1];
1903-
else
1904-
nextVertex := rotationSystem[actVertex][1];
1905-
fi;
1906-
if nextVertex <> startEdge[2] or actVertex <> startVertex then
1907-
Add(cycle, nextVertex);
1908-
Remove(remEdges, Position(remEdges, [preVertex, actVertex]));
1909-
preVertex := actVertex;
1910-
actVertex := nextVertex;
1911-
else
1912-
break;
1913-
fi;
1914-
od;
1915-
Remove(remEdges, Position(remEdges, [preVertex, startVertex]));
1916-
# Remove the last vertex, otherwise otherwise
1917-
# the start vertex is contained twice
1918-
Remove(cycle);
1919-
return cycle;
1920-
end;
1921-
1922-
D := DigraphRemoveLoops(DigraphRemoveAllMultipleEdges(
1923-
DigraphMutableCopyIfMutable(D)));
1924-
1925-
facialWalks := [];
1926-
remEdges := ShallowCopy(DigraphEdges(D));
1927-
1928-
while remEdges <> [] do
1929-
cycle := FacialWalk(rotationSystem, remEdges[1]);
1930-
Add(facialWalks, cycle);
1899+
if pos < Length(rotationSystem[actVertex]) then
1900+
nextVertex := rotationSystem[actVertex][pos + 1];
1901+
else
1902+
nextVertex := rotationSystem[actVertex][1];
1903+
fi;
1904+
if nextVertex <> startEdge[2] or actVertex <> startVertex then
1905+
Add(cycle, nextVertex);
1906+
Remove(remEdges, Position(remEdges, [preVertex, actVertex]));
1907+
preVertex := actVertex;
1908+
actVertex := nextVertex;
1909+
else
1910+
break;
1911+
fi;
19311912
od;
1932-
return facialWalks;
1913+
Remove(remEdges, Position(remEdges, [preVertex, startVertex]));
1914+
# Remove the last vertex, otherwise otherwise
1915+
# the start vertex is contained twice
1916+
Remove(cycle);
1917+
return cycle;
1918+
end;
1919+
1920+
D := DigraphRemoveLoops(DigraphRemoveAllMultipleEdges(
1921+
DigraphMutableCopyIfMutable(D)));
1922+
1923+
facialWalks := [];
1924+
remEdges := ShallowCopy(DigraphEdges(D));
1925+
1926+
while remEdges <> [] do
1927+
cycle := FacialWalk(rotationSystem, remEdges[1]);
1928+
Add(facialWalks, cycle);
1929+
od;
1930+
return facialWalks;
19331931
end);
19341932

19351933
# Computes the minimal cyclic edge cut of connected cubic graphs with at

0 commit comments

Comments
 (0)