From 533f9703504fcf839be88805a3c27a5549db41be Mon Sep 17 00:00:00 2001 From: Anuj Thakur Date: Thu, 23 Apr 2026 21:14:08 +0100 Subject: [PATCH 1/5] Map Graph Recognition --- doc/planar.xml | 36 ++++++ doc/z-chap4.xml | 1 + gap/planar.gd | 2 + gap/planar.gi | 251 ++++++++++++++++++++++++++++++++++++++++ tst/standard/planar.tst | 42 +++++++ 5 files changed, 332 insertions(+) diff --git a/doc/planar.xml b/doc/planar.xml index c9f704134..2c534c5af 100644 --- a/doc/planar.xml +++ b/doc/planar.xml @@ -469,3 +469,39 @@ true <#/GAPDoc> + +<#GAPDoc Label="IsMapGraph"> + + + true or false. + + A map graph is a graph whose vertices can be represented as disjoint + regions in the plane, where two vertices are adjacent if the + corresponding regions share at least one point on their boundaries. + This is a generalized notion of planar graphs by allowing any number + of regions to meet at a single point rather than just along + borders of non-zero length. +

+ A graph D is a map graph if and only if it is the + half-square of some planar bipartite graph H. That is, + D is the graph formed by one part of the bipartition of H, + where two vertices in D are connected if they are at distance 2 in + H. + + Note that every planar graph is a map graph, but map graphs may contain + arbitrarily large cliques making them a strictly larger class than planar graphs. + + D := CompleteDigraph(5); + +gap> IsPlanarDigraph(D); +false +gap> IsMapGraph(D); +true +gap> D := CompleteBipartiteDigraph(3, 7);; +gap> IsMapGraph(D); +false +]]> + + +<#/GAPDoc> \ No newline at end of file diff --git a/doc/z-chap4.xml b/doc/z-chap4.xml index 4c1ac9304..c1b533719 100644 --- a/doc/z-chap4.xml +++ b/doc/z-chap4.xml @@ -116,6 +116,7 @@ <#Include Label="OuterPlanarEmbedding"> <#Include Label="SubdigraphHomeomorphicToK"> <#Include Label="DualPlanarGraph"> + <#Include Label="IsMapGraph">

Hashing diff --git a/gap/planar.gd b/gap/planar.gd index 2826e7d2d..53afd9fb4 100644 --- a/gap/planar.gd +++ b/gap/planar.gd @@ -31,6 +31,7 @@ DeclareAttribute("DualPlanarGraph", IsDigraph); DeclareProperty("IsPlanarDigraph", IsDigraph); DeclareProperty("IsOuterPlanarDigraph", IsDigraph); +DeclareProperty("IsMapGraph", IsDigraph); # True methods . . . @@ -41,3 +42,4 @@ InstallTrueMethod(IsHamiltonianDigraph, InstallTrueMethod(IsPlanarDigraph, IsChainDigraph); InstallTrueMethod(IsPlanarDigraph, IsCycleDigraph); InstallTrueMethod(IsPlanarDigraph, IsOuterPlanarDigraph); +InstallTrueMethod(IsMapGraph, IsPlanarDigraph); diff --git a/gap/planar.gi b/gap/planar.gi index a7a732f1b..58ebb6841 100644 --- a/gap/planar.gi +++ b/gap/planar.gi @@ -118,6 +118,229 @@ function(D) return DigraphByEdges(dualEdges); end); +# A graph is a map graph if we can find a "witness" that is planar and bipartite that the original graph is a half-square of + +# for all vertices v find all ways to cover its edges using a set of cliques +BindGlobal("DIGRAPHS_NbrCliqueCovers", +function(D, v) + local nbrs, sub, subEdges, maxCliques, mapping, cliqueCoverage, + covers, i, j, k, e, temp, EdgesCoveredBy, Backtrack; + nbrs := ShallowCopy(OutNeighboursOfVertex(D, v)); + nbrs := Filtered(nbrs, x -> x <> v); + Sort(nbrs); + + if IsEmpty(nbrs) then + return [[]]; + fi; + sub := InducedSubdigraph(D, nbrs); + + # gets the edges in the new graph + subEdges := []; + for i in DigraphVertices(sub) do + for e in OutNeighboursOfVertex(sub, i) do + if e > i then + Add(subEdges, [i, e]); + fi; + od; + od; + + if IsEmpty(subEdges) then + return [List(nbrs, u -> [u])]; + fi; + + maxCliques := List(DigraphMaximalCliques(sub), + cl -> List(cl, idx -> nbrs[idx])); + + mapping := []; + for i in [1 .. Length(nbrs)] do + mapping[nbrs[i]] := i; + od; + + EdgesCoveredBy := function(clique) + local covered, a, b, ia, ib, edgeIdx; + covered := BlistList([1 .. Length(subEdges)], []); + + for a in [1 .. Length(clique)] do + for b in [a + 1 .. Length(clique)] do + ia := mapping[clique[a]]; + ib := mapping[clique[b]]; + + if ia > ib then + temp := ia; + ia := ib; + ib := temp; + fi; + + edgeIdx := PositionSorted(subEdges, [ia, ib]); + if edgeIdx <= Length(subEdges) and subEdges[edgeIdx] = [ia, ib] then + covered[edgeIdx] := true; + fi; + od; + od; + return covered; + end; + + cliqueCoverage := List(maxCliques, EdgesCoveredBy); + + covers := []; + + # find all edge covering clique sets + Backtrack := function(cover, uncovered, start) + local newUncovered, cov, touchedVerts, u, jj; + + if not ForAny(uncovered, x -> x) then + touchedVerts := Union(cover); + cov := ShallowCopy(cover); + + for u in nbrs do + if not u in touchedVerts then + Add(cov, [u]); + fi; + od; + + Add(covers, cov); + return; + fi; + + for i in [start .. Length(maxCliques)] do + + if ForAny([1 .. Length(subEdges)], + jj -> uncovered[jj] and cliqueCoverage[i][jj]) then + + newUncovered := ShallowCopy(uncovered); + for j in [1 .. Length(subEdges)] do + if cliqueCoverage[i][j] then + newUncovered[j] := false; + fi; + od; + + Add(cover, maxCliques[i]); + Backtrack(cover, newUncovered, i + 1); + Remove(cover); + fi; + od; + end; + + Backtrack([], BlistList([1 .. Length(subEdges)], + [1 .. Length(subEdges)]), 1); + + if IsEmpty(covers) then + return [List(nbrs, u -> [u])]; + fi; + + return covers; +end); + + +BindGlobal("DIGRAPHS_BuildWitness", +function(D, n, covers) + local witnessMap, nextWitness, outNeighb, v, clique, canon, key, w, u; + + witnessMap := rec(); + nextWitness := n + 1; + outNeighb := List([1 .. n], i -> []); + + for v in [1 .. n] do + for clique in covers[v] do + canon := ShallowCopy(clique); + if not v in canon then + Add(canon, v); + fi; + Sort(canon); + key := String(canon); + + if not IsBound(witnessMap.(key)) then + witnessMap.(key) := nextWitness; + Add(outNeighb, []); + nextWitness := nextWitness + 1; + fi; + w := witnessMap.(key); + + for u in canon do + if not w in outNeighb[u] then + Add(outNeighb[u], w); + fi; + if not u in outNeighb[w] then + Add(outNeighb[w], u); + fi; + od; + od; + od; + + for v in [1 .. Length(outNeighb)] do + Sort(outNeighb[v]); + od; + + return DigraphImmutableCopy(Digraph(outNeighb)); +end); + +# reconstruct graph from the planar bipartite graph +# for the inputted H we have U = [1...n] and V is the rest(all junctions) +BindGlobal("DIGRAPHS_HalfSquare", +function(H, n) + local adj, u, w, v, outgoing; + + adj := List([1 .. n], i -> BlistList([1 .. n], [])); + + for u in [1 .. n] do + for w in OutNeighboursOfVertex(H, u) do + if w > n then + for v in OutNeighboursOfVertex(H, w) do + if v <= n and v <> u then + adj[u][v] := true; + fi; + od; + fi; + od; + od; + + outgoing := List([1 .. n], u -> ListBlist([1 .. n], adj[u])); + return DigraphImmutableCopy(Digraph(outgoing)); +end); + + +BindGlobal("DIGRAPHS_IsMapGraphSearch", +function(G, n) + local allCovers, coverCounts, indices, assignment, H, halfsq, i, v, targetEdges; + + targetEdges := Set(DigraphEdges(G)); + + allCovers := List([1 .. n], v -> DIGRAPHS_NbrCliqueCovers(G, v)); + coverCounts := List(allCovers, Length); + + if ForAny(allCovers, c -> IsEmpty(c)) then + return false; + fi; + + indices := List([1 .. n], i -> 1); + + while true do + assignment := List([1 .. n], v -> allCovers[v][indices[v]]); + H := DIGRAPHS_BuildWitness(G, n, assignment); + + if IsPlanarDigraph(H) then + halfsq := DIGRAPHS_HalfSquare(H, n); + + if Set(DigraphEdges(halfsq)) = targetEdges then + return true; + fi; + fi; + i := n; + while i >= 1 do + if indices[i] < coverCounts[i] then + indices[i] := indices[i] + 1; + break; + else + indices[i] := 1; + i := i - 1; + fi; + od; + if i = 0 then break; fi; + od; + + return false; +end); + ######################################################################## # 2. Properties ######################################################################## @@ -155,3 +378,31 @@ function(D) fi; return IS_OUTER_PLANAR(D); end); + +InstallMethod(IsMapGraph, "for a digraph", [IsDigraph], +function(D) + local G, n, m; + + if IsMultiDigraph(D) then + ErrorNoReturn("expected a digraph with no multiple edges"); + fi; + + G := MaximalSymmetricSubdigraphWithoutLoops(D); + + n := DigraphNrVertices(G); + m := DigraphNrAdjacenciesWithoutLoops(G); + + if n < 5 or m < 9 then + return true; + fi; + + if m > 2 * (6 * n - 12) then + return false; + fi; + + if IsPlanarDigraph(G) then + return true; + fi; + + return DIGRAPHS_IsMapGraphSearch(G, n); +end); \ No newline at end of file diff --git a/tst/standard/planar.tst b/tst/standard/planar.tst index ab54f8330..2b95a0376 100644 --- a/tst/standard/planar.tst +++ b/tst/standard/planar.tst @@ -278,3 +278,45 @@ gap> DIGRAPHS_StopTest(); gap> STOP_TEST("Digraphs package: standard/planar.tst", 0); # DigraphSource and DigraphRange + +# IsMapGraph +gap> D := NullDigraph(0); + +gap> IsMapGraph(D); +true +gap> D := CompleteDigraph(4); + +gap> IsMapGraph(D); +true +gap> D := CompleteDigraph(5); + +gap> IsPlanarDigraph(D); +false +gap> IsMapGraph(D); +true +gap> D := Digraph([ +> [2, 3, 4, 5, 6, 7, 8, 9, 10, 11], [1, 3, 4, 5, 6, 7, 8, 9, 10, 11], +> [1, 2, 4, 5, 6, 7, 8, 9, 10, 11], [1, 2, 3, 5, 6, 7, 8, 9, 10, 11], +> [1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], +> [1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15], +> [1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15], +> [1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15], +> [1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 13, 14, 15], +> [1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], +> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 13, 14, 15, 16, 17, 18, 19, 20], +> [5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 20], +> [5, 6, 7, 8, 9, 10, 11, 12, 14, 15, 16, 17, 18, 19, 20], +> [5, 6, 7, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20], +> [5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 16, 17, 18, 19, 20], +> [10, 11, 12, 13, 14, 15, 17, 18, 19, 20], [10, 11, 12, 13, 14, 15, 16, 18, 19, 20], +> [10, 11, 12, 13, 14, 15, 16, 17, 19, 20], [10, 11, 12, 13, 14, 15, 16, 17, 18, 20], +> [10, 11, 12, 13, 14, 15, 16, 17, 18, 19]]); + +gap> IsPlanarDigraph(D); +false +gap> IsMapGraph(D); +true +gap> D := CompleteMultipartiteDigraph([3, 3]); + +gap> IsMapGraph(D); +false \ No newline at end of file From fbb8fef8d575b219260f2293ababc0dbe9fcc23c Mon Sep 17 00:00:00 2001 From: Anuj Thakur Date: Thu, 23 Apr 2026 22:37:44 +0100 Subject: [PATCH 2/5] Map Graph Recognition --- gap/planar.gi | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/gap/planar.gi b/gap/planar.gi index 58ebb6841..d0fbe9672 100644 --- a/gap/planar.gi +++ b/gap/planar.gi @@ -118,13 +118,14 @@ function(D) return DigraphByEdges(dualEdges); end); -# A graph is a map graph if we can find a "witness" that is planar and bipartite that the original graph is a half-square of +# A graph is a map graph if we can find a "witness" that is planar +# and bipartite that the original graph is a half-square of # for all vertices v find all ways to cover its edges using a set of cliques BindGlobal("DIGRAPHS_NbrCliqueCovers", function(D, v) local nbrs, sub, subEdges, maxCliques, mapping, cliqueCoverage, - covers, i, j, k, e, temp, EdgesCoveredBy, Backtrack; + covers, i, j, e, temp, EdgesCoveredBy, Backtrack; nbrs := ShallowCopy(OutNeighboursOfVertex(D, v)); nbrs := Filtered(nbrs, x -> x <> v); Sort(nbrs); @@ -197,7 +198,7 @@ function(D, v) Add(cov, [u]); fi; od; - + Add(covers, cov); return; fi; @@ -231,14 +232,13 @@ function(D, v) return covers; end); - BindGlobal("DIGRAPHS_BuildWitness", -function(D, n, covers) +function(n, covers) local witnessMap, nextWitness, outNeighb, v, clique, canon, key, w, u; witnessMap := rec(); nextWitness := n + 1; - outNeighb := List([1 .. n], i -> []); + outNeighb := List([1 .. n], i -> []); for v in [1 .. n] do for clique in covers[v] do @@ -298,17 +298,17 @@ function(H, n) return DigraphImmutableCopy(Digraph(outgoing)); end); - BindGlobal("DIGRAPHS_IsMapGraphSearch", function(G, n) - local allCovers, coverCounts, indices, assignment, H, halfsq, i, v, targetEdges; + local allCovers, coverCounts, indices, assignment, H, + halfsq, i, v, targetEdges; targetEdges := Set(DigraphEdges(G)); allCovers := List([1 .. n], v -> DIGRAPHS_NbrCliqueCovers(G, v)); coverCounts := List(allCovers, Length); - if ForAny(allCovers, c -> IsEmpty(c)) then + if ForAny(allCovers, IsEmpty) then return false; fi; @@ -316,7 +316,7 @@ function(G, n) while true do assignment := List([1 .. n], v -> allCovers[v][indices[v]]); - H := DIGRAPHS_BuildWitness(G, n, assignment); + H := DIGRAPHS_BuildWitness(n, assignment); if IsPlanarDigraph(H) then halfsq := DIGRAPHS_HalfSquare(H, n); @@ -335,7 +335,9 @@ function(G, n) i := i - 1; fi; od; - if i = 0 then break; fi; + if i = 0 then + break; + fi; od; return false; @@ -390,7 +392,7 @@ function(D) G := MaximalSymmetricSubdigraphWithoutLoops(D); n := DigraphNrVertices(G); - m := DigraphNrAdjacenciesWithoutLoops(G); + m := DigraphNrAdjacenciesWithoutLoops(G); if n < 5 or m < 9 then return true; From ebe39b357d0b04074aeb988ece5c628de254219b Mon Sep 17 00:00:00 2001 From: Anuj Thakur Date: Thu, 23 Apr 2026 22:50:41 +0100 Subject: [PATCH 3/5] Map Graph Recognition + Lint --- gap/planar.gi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gap/planar.gi b/gap/planar.gi index d0fbe9672..e3f0d2267 100644 --- a/gap/planar.gi +++ b/gap/planar.gi @@ -118,7 +118,7 @@ function(D) return DigraphByEdges(dualEdges); end); -# A graph is a map graph if we can find a "witness" that is planar +# A graph is a map graph if we can find a "witness" that is planar # and bipartite that the original graph is a half-square of # for all vertices v find all ways to cover its edges using a set of cliques @@ -300,7 +300,7 @@ end); BindGlobal("DIGRAPHS_IsMapGraphSearch", function(G, n) - local allCovers, coverCounts, indices, assignment, H, + local allCovers, coverCounts, indices, assignment, H, halfsq, i, v, targetEdges; targetEdges := Set(DigraphEdges(G)); From 79ff7488102f28ad17ba1f0cbedba83e2912b4b4 Mon Sep 17 00:00:00 2001 From: Anuj Thakur Date: Mon, 27 Apr 2026 12:44:12 +0100 Subject: [PATCH 4/5] Refactoring/cleaning up code + fix from record to hash --- doc/planar.xml | 9 +++-- gap/planar.gi | 106 ++++++++++++++++++++----------------------------- 2 files changed, 49 insertions(+), 66 deletions(-) diff --git a/doc/planar.xml b/doc/planar.xml index 2c534c5af..1029bc849 100644 --- a/doc/planar.xml +++ b/doc/planar.xml @@ -484,12 +484,15 @@ true

A graph D is a map graph if and only if it is the half-square of some planar bipartite graph H. That is, - D is the graph formed by one part of the bipartition of H, + D is the graph formed by one part of the bipartitions of H, where two vertices in D are connected if they are at distance 2 in - H. + H.

Note that every planar graph is a map graph, but map graphs may contain - arbitrarily large cliques making them a strictly larger class than planar graphs. + arbitrarily large cliques making them a strictly larger class than planar graphs.

+ + The runtime of this algorithm is at worst O(2^n * poly(n)) due to the exhaustive + clique-based backtracking search. D := CompleteDigraph(5); diff --git a/gap/planar.gi b/gap/planar.gi index e3f0d2267..7b5e702c5 100644 --- a/gap/planar.gi +++ b/gap/planar.gi @@ -121,11 +121,34 @@ end); # A graph is a map graph if we can find a "witness" that is planar # and bipartite that the original graph is a half-square of +BindGlobal("DIGRAPHS_EdgesCoveredBy", + function(clique, subEdges, mapping) + local covered, a, b, ia, ib, edgeIdx, temp; + covered := BlistList([1 .. Length(subEdges)], []); + + for a in [1 .. Length(clique)] do + for b in [a+1 .. Length(clique)] do + ia := mapping[clique[a]]; + ib := mapping[clique[b]]; + if ia > ib then + temp := ia; + ia := ib; + ib := temp; + fi; + edgeIdx := PositionSorted(subEdges, [ia, ib]); + if edgeIdx <= Length(subEdges) and subEdges[edgeIdx] = [ia, ib] then + covered[edgeIdx] := true; + fi; + od; + od; + return covered; + end); + # for all vertices v find all ways to cover its edges using a set of cliques BindGlobal("DIGRAPHS_NbrCliqueCovers", function(D, v) local nbrs, sub, subEdges, maxCliques, mapping, cliqueCoverage, - covers, i, j, e, temp, EdgesCoveredBy, Backtrack; + covers, i, j, e, Backtrack; nbrs := ShallowCopy(OutNeighboursOfVertex(D, v)); nbrs := Filtered(nbrs, x -> x <> v); Sort(nbrs); @@ -157,31 +180,7 @@ function(D, v) mapping[nbrs[i]] := i; od; - EdgesCoveredBy := function(clique) - local covered, a, b, ia, ib, edgeIdx; - covered := BlistList([1 .. Length(subEdges)], []); - - for a in [1 .. Length(clique)] do - for b in [a + 1 .. Length(clique)] do - ia := mapping[clique[a]]; - ib := mapping[clique[b]]; - - if ia > ib then - temp := ia; - ia := ib; - ib := temp; - fi; - - edgeIdx := PositionSorted(subEdges, [ia, ib]); - if edgeIdx <= Length(subEdges) and subEdges[edgeIdx] = [ia, ib] then - covered[edgeIdx] := true; - fi; - od; - od; - return covered; - end; - - cliqueCoverage := List(maxCliques, EdgesCoveredBy); + cliqueCoverage := List(maxCliques, cl->DIGRAPHS_EdgesCoveredBy(cl, subEdges, mapping)); covers := []; @@ -236,7 +235,7 @@ BindGlobal("DIGRAPHS_BuildWitness", function(n, covers) local witnessMap, nextWitness, outNeighb, v, clique, canon, key, w, u; - witnessMap := rec(); + witnessMap := HashMap(); nextWitness := n + 1; outNeighb := List([1 .. n], i -> []); @@ -244,25 +243,19 @@ function(n, covers) for clique in covers[v] do canon := ShallowCopy(clique); if not v in canon then - Add(canon, v); + AddSet(canon, v); fi; - Sort(canon); - key := String(canon); - if not IsBound(witnessMap.(key)) then - witnessMap.(key) := nextWitness; + if not IsBound(witnessMap[canon]) then + witnessMap[canon] := nextWitness; Add(outNeighb, []); nextWitness := nextWitness + 1; fi; - w := witnessMap.(key); + w := witnessMap[canon]; for u in canon do - if not w in outNeighb[u] then - Add(outNeighb[u], w); - fi; - if not u in outNeighb[w] then - Add(outNeighb[w], u); - fi; + AddSet(outNeighb[u], w); + AddSet(outNeighb[w], u); od; od; od; @@ -271,31 +264,20 @@ function(n, covers) Sort(outNeighb[v]); od; - return DigraphImmutableCopy(Digraph(outNeighb)); + return Digraph(outNeighb); end); # reconstruct graph from the planar bipartite graph # for the inputted H we have U = [1...n] and V is the rest(all junctions) BindGlobal("DIGRAPHS_HalfSquare", function(H, n) - local adj, u, w, v, outgoing; + local out_neighbors, u, w, v, outgoing; - adj := List([1 .. n], i -> BlistList([1 .. n], [])); + out_neighbors := List([1..n], u -> + Filtered(DigraphDistanceSet(H, u, 2), v -> v <= n) + ); - for u in [1 .. n] do - for w in OutNeighboursOfVertex(H, u) do - if w > n then - for v in OutNeighboursOfVertex(H, w) do - if v <= n and v <> u then - adj[u][v] := true; - fi; - od; - fi; - od; - od; - - outgoing := List([1 .. n], u -> ListBlist([1 .. n], adj[u])); - return DigraphImmutableCopy(Digraph(outgoing)); + return Digraph(out_neighbors); end); BindGlobal("DIGRAPHS_IsMapGraphSearch", @@ -393,16 +375,14 @@ function(D) n := DigraphNrVertices(G); m := DigraphNrAdjacenciesWithoutLoops(G); - + # Graphs with n < 5 or m < 9 are inherently planar + # Direct combination of Planar Bipartite Edge Limit and Euler's formula + # Map graphs by definition are a superset of planar graphs if n < 5 or m < 9 then return true; - fi; - - if m > 2 * (6 * n - 12) then + elif m > 2 * (6 * n - 12) then return false; - fi; - - if IsPlanarDigraph(G) then + elif IsPlanarDigraph(G) then return true; fi; From 7a73ede8645cb191559e1ed7df6566041c1667bf Mon Sep 17 00:00:00 2001 From: William-Kenyon <115789274+William-Kenyon@users.noreply.github.com> Date: Thu, 15 Oct 2026 14:44:25 +0100 Subject: [PATCH 5/5] Fix gaplint --- gap/planar.gi | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/gap/planar.gi b/gap/planar.gi index 7b5e702c5..f909641a9 100644 --- a/gap/planar.gi +++ b/gap/planar.gi @@ -127,7 +127,7 @@ BindGlobal("DIGRAPHS_EdgesCoveredBy", covered := BlistList([1 .. Length(subEdges)], []); for a in [1 .. Length(clique)] do - for b in [a+1 .. Length(clique)] do + for b in [a + 1 .. Length(clique)] do ia := mapping[clique[a]]; ib := mapping[clique[b]]; if ia > ib then @@ -180,7 +180,8 @@ function(D, v) mapping[nbrs[i]] := i; od; - cliqueCoverage := List(maxCliques, cl->DIGRAPHS_EdgesCoveredBy(cl, subEdges, mapping)); + cliqueCoverage := List(maxCliques, + cl -> DIGRAPHS_EdgesCoveredBy(cl, subEdges, mapping)); covers := []; @@ -233,7 +234,7 @@ end); BindGlobal("DIGRAPHS_BuildWitness", function(n, covers) - local witnessMap, nextWitness, outNeighb, v, clique, canon, key, w, u; + local witnessMap, nextWitness, outNeighb, v, clique, canon, w, u; witnessMap := HashMap(); nextWitness := n + 1; @@ -271,11 +272,10 @@ end); # for the inputted H we have U = [1...n] and V is the rest(all junctions) BindGlobal("DIGRAPHS_HalfSquare", function(H, n) - local out_neighbors, u, w, v, outgoing; + local out_neighbors, u, v; - out_neighbors := List([1..n], u -> - Filtered(DigraphDistanceSet(H, u, 2), v -> v <= n) - ); + out_neighbors := List([1 .. n], u -> + Filtered(DigraphDistanceSet(H, u, 2), v -> v <= n)); return Digraph(out_neighbors); end);