diff --git a/doc/attr.xml b/doc/attr.xml index c2cba764d..ce70a7bb1 100644 --- a/doc/attr.xml +++ b/doc/attr.xml @@ -2702,6 +2702,47 @@ gap> Length(M); <#/GAPDoc> +<#GAPDoc Label="AttrDigraphGreedyOutDominatingSet"> + + + + A list of positive integers + + DigraphGreedyOutDominatingSet returns the unique greedy + out-dominating set of digraph with respect to the ordering + 1 < 2 < ... < n where n is the number of vertices in + digraph. An out-dominating set is a subset S of + vertices of digraph such that every vertex of digraph is + either in S or an out-neighbour of a vertex in S. Such a + set is greedy, if it is obtained by starting with an empty set + S and repeatedly adding to S the least vertex that is not + in S and not and out-neighbour of S. + + See also for a further + information on dominating sets, and for a version of this function + that finds a greedy out-dominating set with respect to an arbitrary + ordering on vertices. + + Similarly, DigraphGreedyInDominatingSet returns the unique greedy + in-dominating set of digraph with respect to the ordering + 1 < 2 < ... < n where n is the number of vertices in + digraph. This is equivalently the greedy out-dominating set of + the of digraph. + + See also and . + D := Digraph([[2, 4], [3], [1, 5], [3], [4]]);; +gap> A := DigraphGreedyOutDominatingSet(D); +[ 1, 3 ] +gap> A := DigraphGreedyInDominatingSet(D); +[ 1, 2, 4 ] +]]> + + +<#/GAPDoc> + <#GAPDoc Label="DigraphVertexConnectivity"> @@ -2777,6 +2818,40 @@ gap> DigraphVertexConnectivity(CompleteDigraph(5)); <#/GAPDoc> +<#GAPDoc Label="DigraphEdgeConnectivity"> + + + An integer + + This function returns the edge connectivity of a symmetric digraph + digraph.

+ + The edge connectivity of a symmetric digraph is the size k of the + smallest set of edges whose removal would make the digraph disconnected + (in the sense of ).

+ + The implementation makes use of the + DigraphMaximumFlow(digraph) function, assuming each edge has + weight 1, then using the max-flow min-cut theorem to determine the size of + the minimum cut. See also .

+ + The edge connectivity of any symmetric bridgeless digraph is at least 2. + See also . + d := Digraph([[4], [4], [4], [1, 2, 3]]);; +gap> DigraphEdgeConnectivity(d); +1 +gap> D := RandomDigraph(1);; +gap> DigraphEdgeConnectivity(D); +0 +gap> d := Digraph([[2, 3], [1, 4], [1, 4], [2, 3]]);; +gap> DigraphEdgeConnectivity(d); +2 +]]> + + +<#/GAPDoc> + <#GAPDoc Label="NonUpperSemimodularPair"> diff --git a/doc/oper.xml b/doc/oper.xml index daa733164..a3777e953 100644 --- a/doc/oper.xml +++ b/doc/oper.xml @@ -1954,6 +1954,92 @@ rec( idom := [ 2, fail, 2, 2, 2 ], preorder := [ 2, 1, 3, 4, 5 ] ) <#/GAPDoc> +<#GAPDoc Label="IsDigraphOutDominatingSet"> + + + + true or false. + + If digraph is a digraph and list is a strictly sorted list of + vertices of digraph, then IsDigraphOutDominatingSet + returns true if list is an out-dominating set of digraph. + Similarly, the operation IsDigraphInDominatingSet returns true + if list is an in-dominating set of digraph. + Otherwise, each of these operations return false. +

+ + An out-dominating set of digraph is a subset S of + vertices of digraph such that every vertex of digraph is + either in S or an out-neighbour of a vertex in S. + An in-dominating set of digraph is a subset S of + vertices of digraph such that every vertex of digraph is + either in S or an in-neighbour of a vertex in S. + + D := Digraph([[2, 4], [3], [1, 5], [3], [4]]);; +gap> IsDigraphOutDominatingSet(D, [1, 3]); +true +gap> IsDigraphOutDominatingSet(D, [1, 3, 5]); +true +gap> IsDigraphOutDominatingSet(D, [3, 5]); +false +gap> IsDigraphOutDominatingSet(D, [3, 1, 5, 2, 4]); +false +gap> IsDigraphInDominatingSet(D, [3, 4]); +true +gap> IsDigraphInDominatingSet(D, [1, 3, 5]); +true +gap> IsDigraphInDominatingSet(D, [3, 5]); +false +gap> IsDigraphInDominatingSet(D, [3, 1, 5, 2, 4]); +false +]]> + + +<#/GAPDoc> + +<#GAPDoc Label="OperDigraphGreedyOutDominatingSet"> + + + + A list of positive integers + + DigraphGreedyOutDominatingSet returns the unique greedy + out-dominating set of digraph with respect to the ordering + that the list order induced on the vertices in + digraph. An out-dominating set is a subset S of + vertices of digraph such that every vertex of digraph is + either in S or an out-neighbour of a vertex in S. Such a + set is greedy, if it is obtained by starting with an empty set + S and repeatedly adding to S the least (with respect to the + ordering order) vertex that is not in S and not and + out-neighbour of S. + + See also for a further + information on dominating sets, and for the attribute version of this + function that finds a greedy out-dominating set with respect to the + ordering 1 < 2 < ... < n on the vertices of digraph. + + Similarly, DigraphGreedyInDominatingSet returns the unique greedy + in-dominating set of digraph with respect to the ordering + that the list order induces on the vertices in + digraph. This is equivalently the greedy out-dominating set of + the of digraph. + + See also and . + D := Digraph([[2, 4], [3], [1, 5], [3], [4]]);; +gap> DigraphGreedyOutDominatingSet(D, [2, 1, 3, 4, 5]); +[ 1, 2, 5 ] +gap> DigraphGreedyInDominatingSet(D, [5, 1, 3, 4, 2]); +[ 1, 2, 4, 5 ] +]]> + + +<#/GAPDoc> + <#GAPDoc Label="PartialOrderDigraphMeetOfVertices"> DigraphMinimumCutSet(g, 1, 3); <#/GAPDoc> + <#GAPDoc Label="RandomUniqueEdgeWeightedDigraph"> diff --git a/doc/z-chap4.xml b/doc/z-chap4.xml index 059e10eea..a70947ace 100644 --- a/doc/z-chap4.xml +++ b/doc/z-chap4.xml @@ -76,6 +76,9 @@ <#Include Label="DigraphAbsorptionExpectedSteps"> <#Include Label="Dominators"> <#Include Label="DominatorTree"> + <#Include Label="IsDigraphOutDominatingSet"> + <#Include Label="AttrDigraphGreedyOutDominatingSet"> + <#Include Label="OperDigraphGreedyOutDominatingSet"> <#Include Label="IteratorOfPaths"> <#Include Label="DigraphAllSimpleCircuits"> <#Include Label="DigraphLongestSimpleCircuit"> @@ -89,6 +92,7 @@ <#Include Label="NrSpanningTrees"> <#Include Label="DigraphDijkstra"> <#Include Label="DigraphVertexConnectivity"> + <#Include Label="DigraphEdgeConnectivity"> <#Include Label="DigraphCycleBasis"> <#Include Label="DigraphIsKing"> <#Include Label="DigraphKings"> diff --git a/gap/attr.gd b/gap/attr.gd index 09d171f6a..30e284684 100644 --- a/gap/attr.gd +++ b/gap/attr.gd @@ -78,6 +78,7 @@ DeclareAttribute("DigraphCore", IsDigraph); DeclareAttribute("CharacteristicPolynomial", IsDigraph); DeclareAttribute("NrSpanningTrees", IsDigraph); DeclareAttribute("DigraphVertexConnectivity", IsDigraph); +DeclareAttribute("DigraphEdgeConnectivity", IsDigraph); # AsGraph must be mutable for grape to function properly DeclareAttribute("AsGraph", IsDigraph, "mutable"); @@ -135,6 +136,9 @@ DeclareAttribute("DigraphMaximumMatching", IsDigraph); DeclareAttribute("Bridges", IsDigraph); DeclareAttributeThatReturnsDigraph("StrongOrientation", IsDigraph); +DeclareAttribute("DigraphGreedyOutDominatingSet", IsDigraph); +DeclareAttribute("DigraphGreedyInDominatingSet", IsDigraph); + DeclareAttribute("NonUpperSemimodularPair", IsDigraph); DeclareAttribute("NonLowerSemimodularPair", IsDigraph); diff --git a/gap/attr.gi b/gap/attr.gi index ebaf86487..2dc0ea4d9 100644 --- a/gap/attr.gi +++ b/gap/attr.gi @@ -3504,6 +3504,149 @@ function(D) return kappa_min; end); +############################################################################# +# Digraph Edge Connectivity +############################################################################# + +# Algorithms constructed off the algorithms detailed in: +# https://www.cse.msu.edu/~cse835/Papers/Graph_connectivity_revised.pdf +# Each Algorithm uses a different method to decrease the time complexity, +# of calculating Edge Connectivity, though all make use of DigraphMaximumFlow() +# due to the Max-Flow, Min-Cut Theorem + +# Algorithm 1: Calculating the Maximum Flow of every possible source and sink +# Algorithm 2: Calculating the Maximum Flow to all sinks of an arbitrary source +# Algorithm 3: Finding Maximum Flow within the non-leaves of a Spanning Tree +# Algorithm 4: Constructing a spanning tree with a high number of leaves +# Algorithm 5: Using the spanning tree^ to find Maximum Flow within non-leaves +# Algorithm 6: Finding Maximum Flow within a dominating set of the digraph +# Algorithm 7: Constructing a dominating set for use in Algorithm 6 + +# This function computes the greedy dominating set for the subdigraph +# of a digraph induced by a set of vertices. The neighbour_fun function +# determines if in or out-edges are used. Pass OutNeighboursOfVertex +# for out-edges and InNeighboursOfVertex for in-edges. +# +# In other words, we find a subset S of the vertices in the parameter +# vertices such that every vertex in vertices is in S or adjacent +# to a vertex in S. +# +# This is done in a greedy manner by including every vertex in +# vertices in order, if it is not already adjacent to some +# vertex in the current dominating set. The vertices are +# processed in the same order as they occur in the +# parameter vertices. +# +# Implements Algorithm 7 in : +# https://www.cse.msu.edu/~cse835/Papers/Graph_connectivity_revised.pdf +BindGlobal("DIGRAPHS_GreedyDominatingSet", +function(digraph, vertices, neighbour_fun) + local S, seen, neighbour, vertex; + + Assert(1, + neighbour_fun = OutNeighboursOfVertex or + neighbour_fun = InNeighboursOfVertex); + + seen := BlistList(DigraphVertices(digraph), []); + S := []; + for vertex in vertices do + if not seen[vertex] then + seen[vertex] := true; + Add(S, vertex); + for neighbour in neighbour_fun(digraph, vertex) do + seen[neighbour] := true; + od; + fi; + od; + + return S; +end); + +InstallMethod(DigraphGreedyOutDominatingSet, "for a digraph", [IsDigraph], + digraph -> + DIGRAPHS_GreedyDominatingSet( + digraph, + DigraphVertices(digraph), + OutNeighboursOfVertex)); + +InstallMethod(DigraphGreedyInDominatingSet, "for a digraph", [IsDigraph], + digraph -> + DIGRAPHS_GreedyDominatingSet( + digraph, + DigraphVertices(digraph), + InNeighboursOfVertex)); +# Algorithms 4-7 are used below: + +# Digraph EdgeConnectivity calculated with Dominating Sets (Algorithm 6-7) +InstallMethod(DigraphEdgeConnectivity, "for a symmetric digraph", +[IsDigraph], +function(digraph) + # Form an identical but edge weighted digraph with all edge weights as 1: + local weights, i, u, v, w, neighbourhood, EdgeD, + maxFlow, min, sum, a, b, V, added, st, non_leaf, max, + notAddedNeighbours, notadded, NextVertex, NeighboursV, + neighbour, Edges, D, VerticesLeft, VerticesED; + + # check for symmetric digraph + if not IsSymmetricDigraph(digraph) then + ErrorNoReturn("the argument must be a symmetric digraph,"); + fi; + + if DigraphNrVertices(digraph) = 1 or + DigraphNrConnectedComponents(digraph) > 1 then + return 0; + fi; + + EdgeD := UnitEdgeWeightedDigraph(DigraphImmutableCopyIfMutable(digraph)); + + min := -1; + + # Algorithm 7: Creating a dominating set of the digraph + D := DIGRAPHS_GreedyDominatingSet( + digraph, + Shuffle([1 .. DigraphNrVertices(digraph)]), + OutNeighboursOfVertex); + + # Algorithm 6: Using the dominating set created to determine the Maximum Flow + + if Length(D) > 1 then + + v := D[1]; + for i in [2 .. Length(D)] do + w := D[i]; + a := DigraphMaximumFlow(EdgeD, v, w)[v]; + b := DigraphMaximumFlow(EdgeD, w, v)[w]; + + sum := Minimum(Sum(a), Sum(b)); + if (sum < min or min = -1) then + min := sum; + fi; + od; + + else + # If the dominating set of EdgeD is of Length 1, + # the above algorithm will not work + # Revert to iterating through all vertices of the original digraph + + u := 1; + + for v in [2 .. DigraphNrVertices(EdgeD)] do + a := DigraphMaximumFlow(EdgeD, u, v)[u]; + b := DigraphMaximumFlow(EdgeD, v, u)[v]; + + sum := Minimum(Sum(a), Sum(b)); + if (sum < min or min = -1) then + min := sum; + fi; + + od; + fi; + + return Minimum(min, + Minimum(Minimum(OutDegrees(EdgeD)), + Minimum(InDegrees(EdgeD)))); +end); + # The following function is a transliteration from python to GAP of # the function find_nonsemimodular_pair # in sage/src/sage/combinat/posets/hasse_diagram.py diff --git a/gap/oper.gd b/gap/oper.gd index 4766b3496..d12b63f0b 100644 --- a/gap/oper.gd +++ b/gap/oper.gd @@ -118,6 +118,10 @@ DeclareOperation("IsDigraphPath", [IsDigraph, IsHomogeneousList, IsHomogeneousList]); DeclareOperation("IsDigraphPath", [IsDigraph, IsList]); +DeclareOperation("IsDigraphOutDominatingSet", [IsDigraph, IsList]); +DeclareSynonym("IsDigraphDominatingSet", IsDigraphOutDominatingSet); +DeclareOperation("IsDigraphInDominatingSet", [IsDigraph, IsList]); + # 9. Connectivity . . . DeclareOperation("DigraphIsKing", [IsDigraph, IsPosInt, IsPosInt]); DeclareOperation("DigraphKings", [IsDigraph, IsPosInt]); @@ -154,6 +158,8 @@ DeclareOperation("IsOrderIdeal", [IsDigraph, IsList]); DeclareOperation("IsOrderFilter", [IsDigraph, IsList]); DeclareOperation("Dominators", [IsDigraph, IsPosInt]); DeclareOperation("DominatorTree", [IsDigraph, IsPosInt]); +DeclareOperation("DigraphGreedyOutDominatingSet", [IsDigraph, IsList]); +DeclareOperation("DigraphGreedyInDominatingSet", [IsDigraph, IsList]); DeclareOperation("DigraphCycleBasis", [IsDigraph]); DeclareOperation("DigraphColourRefinement", [IsDigraph]); diff --git a/gap/oper.gi b/gap/oper.gi index bdc462bee..645a9b99e 100644 --- a/gap/oper.gi +++ b/gap/oper.gi @@ -2522,6 +2522,66 @@ function(D, root) return result; end); +BindGlobal("DIGRAPHS_IsDominatingSet", +function(digraph, vertices, neighbour_fun) + local seen, neighbour, vertex; + + if not IsSet(vertices) then + return false; + fi; + + seen := BlistList(DigraphVertices(digraph), []); + for vertex in vertices do + if not IsPosInt(vertex) or vertex > DigraphNrVertices(digraph) then + return false; + fi; + seen[vertex] := true; + for neighbour in neighbour_fun(digraph, vertex) do + seen[neighbour] := true; + od; + od; + + return ForAll(seen, x -> x); +end); + +InstallMethod(IsDigraphOutDominatingSet, + "for a digraph and a list of vertices", + [IsDigraph, IsList], + {digraph, vertices} -> + DIGRAPHS_IsDominatingSet(digraph, vertices, OutNeighboursOfVertex)); + +InstallMethod(IsDigraphInDominatingSet, + "for a digraph and a list of vertices", + [IsDigraph, IsList], + {digraph, vertices} -> + DIGRAPHS_IsDominatingSet(digraph, vertices, InNeighboursOfVertex)); + +InstallMethod(DigraphGreedyOutDominatingSet, + "for a digraph and a list of vertices", + [IsDigraph, IsList], + function(digraph, vertex_order) + if not Length(vertex_order) = DigraphNrVertices(digraph) or + not Set(vertex_order) = DigraphVertices(digraph) then + ErrorNoReturn("the 2nd argument must be a permuted list of vertices of ", + "the 1st argument (a digraph)"); + fi; + return Set(DIGRAPHS_GreedyDominatingSet( + digraph, vertex_order, OutNeighboursOfVertex)); + end); + +InstallMethod(DigraphGreedyInDominatingSet, + "for a digraph and a list of vertices", + [IsDigraph, IsList], + function(digraph, vertex_order) + if not Length(vertex_order) = DigraphNrVertices(digraph) or + not Set(vertex_order) = DigraphVertices(digraph) then + ErrorNoReturn("the 2nd argument must be a permuted list of vertices of ", + "the 1st argument (a digraph)"); + fi; + return Set(DIGRAPHS_GreedyDominatingSet( + digraph, vertex_order, InNeighboursOfVertex)); + end); + # Computes the fundamental cycle basis of a symmetric digraph # First, notice that the cycle space is composed of orthogonal subspaces # corresponding to the cycle spaces of the connected components. @@ -2877,4 +2937,4 @@ function(D) return C - (cMin - 1); -end); \ No newline at end of file +end); diff --git a/tst/standard/attr.tst b/tst/standard/attr.tst index 6105bfae1..5f1eb9db9 100644 --- a/tst/standard/attr.tst +++ b/tst/standard/attr.tst @@ -17,6 +17,7 @@ #@local reflextrans, reflextrans1, reflextrans2, representatives, rev, rgr #@local rotationSy, rotationSystem, scc, schreierVector, sink, soccer, str #@local table, temp, topo, trans, trans1, trans2, tree, wcc, x, y, z +#@local TestDigraphGreedyDominatingSet gap> START_TEST("Digraphs package: standard/attr.tst"); gap> LoadPackage("digraphs", false);; @@ -3287,6 +3288,313 @@ gap> D := DigraphFromGraph6String( gap> DigraphVertexConnectivity(D); 7 +# DigraphGreedyOutDominatingSet +gap> TestDigraphGreedyDominatingSet := +> {D, A} -> ForAll( +> DigraphVertices(D), +> x -> IsDigraphOutDominatingSet( +> InducedSubdigraph(DigraphImmutableCopy(D), [1 .. x]), +> Filtered(A, y -> y <= x)));; +gap> D := Digraph([[2, 3], [2, 3], [1, 2, 3]]);; +gap> A := DigraphGreedyOutDominatingSet(D); +[ 1 ] +gap> IsDigraphOutDominatingSet(D, A); +true +gap> TestDigraphGreedyDominatingSet(D, A); +true +gap> D := Digraph([[2, 4], [3], [1, 5], [3], [4]]);; +gap> A := DigraphGreedyOutDominatingSet(D); +[ 1, 3 ] +gap> IsDigraphOutDominatingSet(D, A); +true +gap> TestDigraphGreedyDominatingSet(D, A); +true +gap> D := Digraph(IsMutableDigraph, [[2, 4], [3], [1, 5], [3], [4]]);; +gap> A := DigraphGreedyOutDominatingSet(D); +[ 1, 3 ] +gap> IsDigraphOutDominatingSet(D, A); +true +gap> TestDigraphGreedyDominatingSet(D, A); +true +gap> D = Digraph(IsMutableDigraph, [[2, 4], [3], [1, 5], [3], [4]]); +true +gap> D := Digraph([ +> [1, 2, 3, 4, 5], +> [1, 2, 3, 4, 5], +> [1, 2, 3, 4, 5], +> [1, 2, 3, 4, 5], +> [1, 2, 3, 4, 5]]);; +gap> A := DigraphGreedyOutDominatingSet(D); +[ 1 ] +gap> IsDigraphOutDominatingSet(D, A); +true +gap> TestDigraphGreedyDominatingSet(D, A); +true +gap> D := DigraphFromSparse6String(":~?@O_GA?`OQCa?]FaoiIb_\ +> uLcpIQd`UTePaZCXwXeXiYeyIjIimcIyegJi_dJi[lJICgHxwdHHs`Hxs\ +> [Hh[ad`s[e@[UcqKid@{hdPORhaq_HhGPbryMNRqOBoyKE@yJEgsKAwc^\ +> IW_PNwgHAGW_OwSZLg[E@WKOJwKOFGGbIgCdHGG@@N"); + +gap> A := DigraphGreedyOutDominatingSet(D); +[ 1, 5, 8, 11, 14, 17, 18, 19, 22, 25, 27, 29, 30, 31, 32, 35, 37, 38, 39, + 40, 41, 42, 43, 45, 64, 65, 73, 74 ] +gap> IsDigraphOutDominatingSet(D, A); +true +gap> TestDigraphGreedyDominatingSet(D, A); +true +gap> D := DigraphFromSparse6String(":~?AA_C?_CD?cD_sE`OH`KL\ +> @cO@kOawUA[TAcVASQBCRAsTAc^Bk]a[SasTcwNCCMB{]Cc\\C[eCcdC[\ +> [CSZCKYCSXCK]bk_EK^ESdcseckvEswEk|Fcz`_JACI@kK@WIaG}aG|`{\ +> MdOqdGpdoodwld_wdWvd?scwrfSxepNehMfczf`CfXDfpRfhQ`LPJDOJD\ +> SITTI\\FHlEHdJH|IHtDHLCHDBI|AIt_Jl^Jt[KdZK\\YKTXKLgKtdK|n\ +> LThm@mlhnlpolhnmHklXqltl`@sNCFMXv`@wMsFMxt__A_gBNkBAP?_GN\ +> @sC?O@"); + +gap> A := DigraphGreedyOutDominatingSet(D); +[ 1, 5, 7, 10, 13, 15, 16, 17, 19, 20, 21, 22, 23, 30, 31, 38, 39, 46, 47, + 48, 49, 52, 53, 58, 59, 60, 61, 65, 67, 68, 71, 72, 75, 76, 81, 82, 87, 88, + 92, 93, 98, 99, 102, 103, 110, 111, 112, 113, 118, 119, 122, 123, 127 ] +gap> IsDigraphOutDominatingSet(D, A); +true +gap> TestDigraphGreedyDominatingSet(D, A); +true +gap> D := DigraphFromSparse6String(":u_OGCSHCc@xCa]MfsILOfM\ +> fSATIjLJEX`_nLKrAhqYKDQpOeNJJQpMAKbagcKXFDOHgyQeWgbydLVSs\ +> ZDUtVhUodrEEoVp?WEAAV^"); + +gap> A := DigraphGreedyOutDominatingSet(D); +[ 1, 5, 8, 10, 11, 12, 13, 14, 15, 17, 19, 20, 26, 36, 38, 40, 43, 44, 46, + 47, 52 ] +gap> IsDigraphOutDominatingSet(D, A); +true +gap> TestDigraphGreedyDominatingSet(D, A); +true + +# DigraphGreedyInDominatingSet +gap> TestDigraphGreedyDominatingSet := +> {D, A} -> ForAll( +> DigraphVertices(D), +> x -> IsDigraphInDominatingSet( +> InducedSubdigraph(DigraphImmutableCopy(D), [1 .. x]), +> Filtered(A, y -> y <= x)));; +gap> D := Digraph([[2, 3], [2, 3], [1, 2, 3]]);; +gap> A := DigraphGreedyInDominatingSet(D); +[ 1, 2 ] +gap> IsDigraphInDominatingSet(D, A); +true +gap> TestDigraphGreedyDominatingSet(D, A); +true +gap> D := Digraph([[2, 4], [3], [1, 5], [3], [4]]);; +gap> A := DigraphGreedyInDominatingSet(D); +[ 1, 2, 4 ] +gap> IsDigraphInDominatingSet(D, A); +true +gap> TestDigraphGreedyDominatingSet(D, A); +true +gap> D := Digraph(IsMutableDigraph, [[2, 4], [3], [1, 5], [3], [4]]);; +gap> A := DigraphGreedyInDominatingSet(D); +[ 1, 2, 4 ] +gap> IsDigraphInDominatingSet(D, A); +true +gap> TestDigraphGreedyDominatingSet(D, A); +true +gap> D = Digraph(IsMutableDigraph, [[2, 4], [3], [1, 5], [3], [4]]); +true +gap> D := Digraph([ +> [1, 2, 3, 4, 5], +> [1, 2, 3, 4, 5], +> [1, 2, 3, 4, 5], +> [1, 2, 3, 4, 5], +> [1, 2, 3, 4, 5]]);; +gap> A := DigraphGreedyInDominatingSet(D); +[ 1 ] +gap> IsDigraphInDominatingSet(D, A); +true +gap> TestDigraphGreedyDominatingSet(D, A); +true +gap> D := DigraphFromSparse6String(":~?@O_GA?`OQCa?]FaoiIb_\ +> uLcpIQd`UTePaZCXwXeXiYeyIjIimcIyegJi_dJi[lJICgHxwdHHs`Hxs\ +> [Hh[ad`s[e@[UcqKid@{hdPORhaq_HhGPbryMNRqOBoyKE@yJEgsKAwc^\ +> IW_PNwgHAGW_OwSZLg[E@WKOJwKOFGGbIgCdHGG@@N"); + +gap> A := DigraphGreedyInDominatingSet(D); +[ 1, 5, 8, 11, 14, 17, 18, 19, 22, 25, 27, 29, 30, 31, 32, 35, 37, 38, 39, + 40, 41, 42, 43, 45, 64, 65, 73, 74 ] +gap> IsDigraphInDominatingSet(D, A); +true +gap> TestDigraphGreedyDominatingSet(D, A); +true +gap> D := DigraphFromSparse6String(":~?AA_C?_CD?cD_sE`OH`KL\ +> @cO@kOawUA[TAcVASQBCRAsTAc^Bk]a[SasTcwNCCMB{]Cc\\C[eCcdC[\ +> [CSZCKYCSXCK]bk_EK^ESdcseckvEswEk|Fcz`_JACI@kK@WIaG}aG|`{\ +> MdOqdGpdoodwld_wdWvd?scwrfSxepNehMfczf`CfXDfpRfhQ`LPJDOJD\ +> SITTI\\FHlEHdJH|IHtDHLCHDBI|AIt_Jl^Jt[KdZK\\YKTXKLgKtdK|n\ +> LThm@mlhnlpolhnmHklXqltl`@sNCFMXv`@wMsFMxt__A_gBNkBAP?_GN\ +> @sC?O@"); + +gap> A := DigraphGreedyInDominatingSet(D); +[ 1, 5, 7, 10, 13, 15, 16, 17, 19, 20, 21, 22, 23, 30, 31, 38, 39, 46, 47, + 48, 49, 52, 53, 58, 59, 60, 61, 65, 67, 68, 71, 72, 75, 76, 81, 82, 87, 88, + 92, 93, 98, 99, 102, 103, 110, 111, 112, 113, 118, 119, 122, 123, 127 ] +gap> IsDigraphInDominatingSet(D, A); +true +gap> TestDigraphGreedyDominatingSet(D, A); +true +gap> D := DigraphFromSparse6String(":u_OGCSHCc@xCa]MfsILOfM\ +> fSATIjLJEX`_nLKrAhqYKDQpOeNJJQpMAKbagcKXFDOHgyQeWgbydLVSs\ +> ZDUtVhUodrEEoVp?WEAAV^"); + +gap> A := DigraphGreedyInDominatingSet(D); +[ 1, 5, 8, 10, 11, 12, 13, 14, 15, 17, 19, 20, 26, 36, 38, 40, 43, 44, 46, + 47, 52 ] +gap> IsDigraphInDominatingSet(D, A); +true +gap> TestDigraphGreedyDominatingSet(D, A); +true + +# EdgeConnectivity +gap> D := Digraph([[4], [4], [4], [1, 2, 3]]); + +gap> DigraphEdgeConnectivity(D); +1 +gap> D := Digraph(IsMutableDigraph, [[4], [4], [4], [1, 2, 3]]); + +gap> DigraphEdgeConnectivity(D); +1 +gap> D; + +gap> D := RandomDigraph(1);; +gap> DigraphEdgeConnectivity(D); +0 +gap> D := Digraph([[2, 3], [1, 4], [1, 4], [2, 3]]);; +gap> DigraphEdgeConnectivity(D); +2 +gap> D := Digraph([[2], [1], [4, 5], [3, 5], [3, 4]]);; +gap> DigraphEdgeConnectivity(D); +0 +gap> D := Digraph([[1, 2], [3, 4], [], []]);; +gap> DigraphEdgeConnectivity(D); +Error, the argument must be a symmetric digraph, +gap> D := Digraph([ +> [1, 2, 3, 4, 5], +> [1, 2, 3, 4, 5], +> [1, 2, 3, 4, 5], +> [1, 2, 3, 4, 5], +> [1, 2, 3, 4, 5]]);; +gap> DigraphEdgeConnectivity(D); +4 +gap> D := DigraphFromGraph6String("I~~~~~~~w");; +gap> DigraphEdgeConnectivity(D); +9 +gap> D := CompleteDigraph(10);; +gap> DigraphEdgeConnectivity(D); +9 +gap> D := CirculantGraph(10, [1, 2, 3, 4]);; +gap> DigraphEdgeConnectivity(D); +8 +gap> D := DigraphFromGraph6String("L~~~?CB?wb`N@^"); + +gap> DigraphEdgeConnectivity(D); +6 +gap> # House of Graphs 56962 +gap> D := DigraphFromGraph6String("~?Al~~emZB}NFxEqSvjWcNg?oqBqGEz@fMcVKe_t\ +> ALNC?|x@PnotaNoD[n|JqbNvM`D|\\`WfeLkb]bVebVBY]XnWuU[jt_mxfe\\JovHwyTncfrO\ +> }bc[oNxliT~SLhb^uQ[vUlS|S]S^rbA{lpm@~sDlilMngww^QuiNhOceMBkDwJPUFDs`ES@q{\ +> qDJfTSoUkRMd@LRY`TrxHxGKousyIWmATYW{aoHqN`K|OxgsY]TMNI[_[MkRrYiAzCV|TdvmO\ +> QH]aQk[f\\aIlf_euUdoxnq\\e{aeoSfF}rokQeLplSljymFwO?}Jgf_T_zc\\iUhpQakmOvu\ +> nRlAjnURDDlNWdZL^FU?FUiqRbl`XJBCF^sqtPJppR{[DKUXGtcxw|lyEgVc]Nw_xTnymPuUA\ +> UWsOvrtyF[MHE[rxk?vjHVOWeriaMFjlFQJkTJBotQdhuthm?X|OPjqvW\\n@bEkc`xlV\\L@\ +> JKZuA\\OuiYXv]ckNKOfWu^zqiCAtTY\\JW\\{rvX`i?lKzkELngbealXxbDoseptMBF^J]gH\ +> Udojhi]Ci\\onSJL[TXt|DYio[abXH|SvvP`[qmDCqYsxlJpTAmu|elAFgDiwfi\\BYo}Gdvi\ +> KQjG^}Q\\lXiVW@KRYWEhWUd|DbK`v{SmoaSLTV{xzDk?xBbKVOqXy]D{dX]IJHbZWBL[[Xv|\ +> GUjx`wQadJ@\\pT\\dtTZEdIkMD}sQ{L{AxXLuKCN`dV_h}uXMRu`wg[C[m]l\\DHihlbnCQX\ +> C\\]Yqh{HSVUcjwapAxmX]{CBx\\TpDiYtqEV{\\tSPFmK`TTJ}A^zyaYFQ@yzenO^CBXmgQJ\ +> U]kmcXidDdyLAxPxl@zN{HkNVzCHG_uouzEL|aJxLRiBDolfVEMH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uTq~}FbVoHm?[zo~?F_Z{~f`xgwXw@~pB{?IVyyvDB~ooqBcANzFuDj|\\ZIB~pO\ +> qBcCV|FuDJ|\\ZgM^z?eEKSo{N{gl^jj[Df~OH`bIKND~KN{FflN?~p_qBcEX}FuK~o]]vBB~o\ +> Copf_Fb^f@HjL~u^g@~o?[_rtw^XguTq~vfo@~o?[_rywnhgB{~ww~k?~w?pfe@b|^GN?vx}~F\ +> ?N}?KXx`_}}q@~~?}F~w?No@bNKNFL}OF~z{?^~_FF?@qBN~bFe_N~wFoNB{poroB~}?w?L|N~\ +> vw?o{~M@LoB~}F??q}F~~~~_?^w??w@~~B{??^`~~~~pwW?M??[_r~w}pgAN~~~}o{?M??KXx`\ +> w~xq?_"); + +gap> DigraphEdgeConnectivity(D); +64 + # Semimodular lattices gap> D := DigraphFromDigraph6String("&C[o?"); diff --git a/tst/standard/oper.tst b/tst/standard/oper.tst index 585f10a99..69943824f 100644 --- a/tst/standard/oper.tst +++ b/tst/standard/oper.tst @@ -10,13 +10,13 @@ ## #@local C, D, D1, D2, D3, D3_edges, DD -#@local G, G1, L, TestPartialOrderDigraph +#@local G, G1, L, TestPartialOrderDigraph #@local TestPartialOrderDigraph2, TestUnion, a, adj, b, comps, copy, d, e #@local edges, edges2, func, g, gr, gr1, gr2, gr3, gr4, gri, grrt, grt, h, i #@local i1, i2, id, idom, in1, in2, in3, iter, j1, j2, m, m1, m2, mat, n, nbs -#@local out, out1, out2, out3, p1, p2, path, preorder, qr, r, res, rtclosure, t +#@local out, out1, out2, out3, p1, p2, path, preorder, qr, r, res, rtclosure, t, neighbours #@local tclosure, u1, u2, x -#@local p, q, idp, idt, M +#@local p, q, idp, idt, M, v gap> START_TEST("Digraphs package: standard/oper.tst"); gap> LoadPackage("digraphs", false);; @@ -134,6 +134,18 @@ gap> M := DigraphMutableCopy(D);; gap> M ^ p = OnDigraphs(M, p); true +# DigraphRemoveAllEdges: for a digraph +gap> gr2 := Digraph(IsMutableDigraph, [[2, 3], [3], [4], []]); + +gap> DigraphRemoveAllEdges(gr2); + +gap> gr3 := Digraph(IsMutableDigraph, [[], [], [], []]); + +gap> DigraphRemoveAllEdges(gr3); + +gap> OutNeighbours(gr3); +[ [ ], [ ], [ ], [ ] ] + # OnDigraphs: for a digraph and a perm gap> gr := Digraph([[2], [1], [3]]); @@ -3356,6 +3368,592 @@ gap> D := Digraph([[2, 3, 4, 5], [], [], [], []]);; gap> DigraphColourRefinement(D); [ 2, 1, 1, 1, 1 ] +# IsDigraphOutDominatingSet +gap> d := Digraph([[2, 3], [2, 3], [1, 2, 3]]);; +gap> IsDigraphOutDominatingSet(d, [1]); +true +gap> IsDigraphOutDominatingSet(d, [3]); +true +gap> IsDigraphOutDominatingSet(d, [1, 2]); +true +gap> IsDigraphOutDominatingSet(d, [2]); +false +gap> IsDigraphOutDominatingSet(d, []); +false +gap> IsDigraphOutDominatingSet(d, [2, 1]); +false +gap> IsDigraphOutDominatingSet(d, [1, 4]); +false +gap> IsDigraphOutDominatingSet(d, [1, 2, "abc"]); +false +gap> d := Digraph([[2, 4], [3], [1, 5], [3], [4]]);; +gap> IsDigraphOutDominatingSet(d, [1, 3]); +true +gap> IsDigraphOutDominatingSet(d, [1, 3, 5]); +true +gap> IsDigraphOutDominatingSet(d, [1, 2, 5]); +true +gap> IsDigraphOutDominatingSet(d, [2, 3, 5]); +true +gap> IsDigraphOutDominatingSet(d, [2, 3, 4]); +true +gap> IsDigraphOutDominatingSet(d, [3, 1]); +false +gap> IsDigraphOutDominatingSet(d, [3, 1, 5, 2, 4]); +false +gap> IsDigraphOutDominatingSet(d, [3, 5]); +false +gap> IsDigraphOutDominatingSet(d, [5, 3]); +false +gap> d := Digraph([ +> [1, 2, 3, 4, 5], +> [1, 2, 3, 4, 5], +> [1, 2, 3, 4, 5], +> [1, 2, 3, 4, 5], +> [1, 2, 3, 4, 5]]);; +gap> IsDigraphOutDominatingSet(d, [1]); +true +gap> IsDigraphOutDominatingSet(d, [1, 3]); +true +gap> IsDigraphOutDominatingSet(d, [1, 3, 5]); +true +gap> IsDigraphOutDominatingSet(d, []); +false +gap> IsDigraphOutDominatingSet(d, [3, 1]); +false +gap> IsDigraphOutDominatingSet(d, [5, 1, 3]); +false +gap> d := DigraphFromSparse6String(":~?@O_GA?`OQCa?]FaoiIb_\ +> uLcpIQd`UTePaZCXwXeXiYeyIjIimcIyegJi_dJi[lJICgHxwdHHs`Hxs\ +> [Hh[ad`s[e@[UcqKid@{hdPORhaq_HhGPbryMNRqOBoyKE@yJEgsKAwc^\ +> IW_PNwgHAGW_OwSZLg[E@WKOJwKOFGGbIgCdHGG@@N"); + +gap> p := [1, 5, 8, 11, 14, 17, 18, 19, 22, 25, 27, 29, \ +> 30, 31, 32, 35, 37, 38, 39, 40, 41, 42, 43, 45, 64, 65, \ +> 73, 74];; +gap> IsDigraphOutDominatingSet(d, p); +true +gap> p := [1, 5, 8, 11, 14, 17, 18, 19, 22, 25, 27, 29, \ +> 30, 31, 32, 35, 37, 38, 39, 40, 41, 42, 43, 45, 64, 65, \ +> 73];; +gap> IsDigraphOutDominatingSet(d, p); +false +gap> p := [1, 5, 8, 11, 14, 17, 18, 19, 22, 25, 27, \ +> 30, 31, 32, 35, 37, 38, 39, 40, 41, 42, 43, 45, 64, 65, \ +> 73, 74];; +gap> IsDigraphOutDominatingSet(d, p); +false +gap> p := [2, 3, 4, 5, 9, 10, 11, 12, 13, 14, 15, 17, \ +> 18, 19, 21, 23, 24, 25, 27, 29, 30, 31, 32, 35, 37, \ +> 38, 42, 44, 48, 49, 50, 51, 53, 54, 58, 60, 61, 62, \ +> 64, 66, 73, 74, 75, 78];; +gap> IsDigraphOutDominatingSet(d, p); +true +gap> p := [2, 3, 4, 5, 9, 10, 11, 12, 13, 14, \ +> 18, 19, 21, 23, 24, 25, 27, 29, 30, 31, 32, 35, 37, \ +> 38, 50, 51, 53, 54, 58, 60, 61, 62, \ +> 64, 66, 73, 74, 75];; +gap> IsDigraphOutDominatingSet(d, p); +false +gap> d := DigraphFromSparse6String(":~?AA_C?_CD?cD_sE`OH`KL\ +> @cO@kOawUA[TAcVASQBCRAsTAc^Bk]a[SasTcwNCCMB{]Cc\\C[eCcdC[\ +> [CSZCKYCSXCK]bk_EK^ESdcseckvEswEk|Fcz`_JACI@kK@WIaG}aG|`{\ +> MdOqdGpdoodwld_wdWvd?scwrfSxepNehMfczf`CfXDfpRfhQ`LPJDOJD\ +> SITTI\\FHlEHdJH|IHtDHLCHDBI|AIt_Jl^Jt[KdZK\\YKTXKLgKtdK|n\ +> LThm@mlhnlpolhnmHklXqltl`@sNCFMXv`@wMsFMxt__A_gBNkBAP?_GN\ +> @sC?O@"); + +gap> p := [1, 5, 7, 10, 13, 15, 16, 17, 19, 20, 21, 22, 23, \ +> 30, 31, 38, 39, 46, 47, 48, 49, 52, 53, 58, 59, 60, 61, \ +> 65, 67, 68, 71, 72, 75, 76, 81, 82, 87, 88, 92, 93, 98, \ +> 99, 102, 103, 110, 111, 112, 113, 118, 119, 122, 123, 127];; +gap> IsDigraphOutDominatingSet(d, p); +true +gap> p := [1, 5, 7, 10, 13, 15, 16, 17, 19, 20, 21, 22, 23, \ +> 30, 31, 38, 39, 46, 47, 48, 49, 52, 53, 58, 59, 60, 61, \ +> 65, 67, 68, 71, 72, 75, 76, 81, 82, 87, 88, 92, 93, 98, \ +> 99, 102, 103, 110, 111, 112, 113, 118, 119, 122, 123];; +gap> IsDigraphOutDominatingSet(d, p); +false +gap> p := [1, 5, 7, 10, 13, 15, 16, 17, 19, 20, 21, 22, 24, \ +> 30, 31, 38, 39, 46, 47, 48, 49, 52, 53, 58, 59, 60, 61, \ +> 65, 67, 68, 71, 72, 75, 76, 81, 82, 87, 88, 92, 93, 98, \ +> 99, 102, 103, 110, 111, 112, 113, 118, 119, 122, 123, 127];; +gap> IsDigraphOutDominatingSet(d, p); +false +gap> p := [2, 3, 4, 5, 7, 10, 14, 15, 16, 18, 19, 20, 21, 22, \ +> 23, 26, 27, 32, 33, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, \ +> 54, 55, 56, 57, 62, 63, 64, 65, 66, 77, 78, 79, 80, 83, 84, \ +> 85, 86, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 108, \ +> 109, 110, 111, 112, 113, 114, 115, 122, 123, 124, 125, 127];; +gap> IsDigraphOutDominatingSet(d, p); +true +gap> p := [2, 3, 4, 5, 7, 10, 14, 15, 16, 18, 19, 20, 21, 22, \ +> 23, 26, 27, 32, 33, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, \ +> 54, 55, 56, 57, 62, 63, 64, 77, 78, 79, 80, 83, 84, \ +> 85, 86, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 108, \ +> 109, 110, 111, 112, 113, 114, 115, 122, 123, 124, 125];; +gap> IsDigraphOutDominatingSet(d, p); +false +gap> p := [2, 3, 4, 5, 7, 10, 14, 15, 16, 18, 19, 20, 21, 22, \ +> 24, 26, 27, 32, 33, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, \ +> 54, 55, 56, 57, 65, 66, 77, 78, 79, 80, 83, 84, \ +> 85, 86, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 108, \ +> 109, 110, 111, 112, 113, 114, 115, 122, 123, 124, 125, 127];; +gap> IsDigraphOutDominatingSet(d, p); +false +gap> d := DigraphFromSparse6String(":u_OGCSHCc@xCa]MfsILOfM\ +> fSATIjLJEX`_nLKrAhqYKDQpOeNJJQpMAKbagcKXFDOHgyQeWgbydLVSs\ +> ZDUtVhUodrEEoVp?WEAAV^"); + +gap> p := [1, 5, 8, 10, 11, 12, 13, 14, 15, 17, 19, 20, 26, \ +> 36, 38, 40, 43, 44, 46, 47, 52];; +gap> IsDigraphOutDominatingSet(d, p); +true +gap> p := [1, 5, 8, 10, 11, 12, 13, 14, 15, 17, 19, 20, 26, \ +> 36, 38, 40, 43, 44, 46, 47];; +gap> IsDigraphOutDominatingSet(d, p); +false +gap> p := [1, 5, 8, 10, 11, 12, 13, 14, 15, 17, 19, 20, \ +> 36, 38, 40, 43, 44, 46, 47, 52];; +gap> IsDigraphOutDominatingSet(d, p); +false +gap> p := [2, 3, 4, 5, 6, 8, 10, 11, 12, 13, 14, 16, 18, \ +> 20, 22, 23, 24, 25, 26, 30, 33, 37, 38, 39, 44, 46, \ +> 47, 48, 50, 52];; +gap> IsDigraphOutDominatingSet(d, p); +true +gap> p := [2, 3, 4, 5, 6, 8, 10, 11, 12, 13, 14, 16, \ +> 20, 22, 23, 24, 25, 26, 30, 33, 37, 38, 39, 44, 46, \ +> 47, 48, 50, 52];; +gap> IsDigraphOutDominatingSet(d, p); +false +gap> p := [2, 3, 4, 5, 6, 11, 12, 13, 14, 16, 18, \ +> 20, 22, 23, 24, 25, 26, 30, 33, 37, 38, 39, 44, 46, \ +> 47, 48, 50];; +gap> IsDigraphOutDominatingSet(d, p); +false +gap> p := [4, 7, 8, 13, 16, 19, 26, 27, 32, 38, 39, 44, \ +> 45, 50, 54];; +gap> IsDigraphOutDominatingSet(d, p); +true +gap> p := [4, 7, 8, 13, 16, 19, 26, 27, 32, 38, 39, 44, \ +> 45, 50, 52];; +gap> IsDigraphOutDominatingSet(d, p); +false +gap> p := [4, 7, 8, 13, 16, 19, 26, 27, 32, 38, 39, 44, \ +> 45, 50];; +gap> IsDigraphOutDominatingSet(d, p); +false +gap> p := [1 .. 10];; +gap> IsDigraphOutDominatingSet(d, p); +false + +# IsDigraphInDominatingSet +gap> d := Digraph([[2, 3], [2, 3], [1, 2, 3]]);; +gap> IsDigraphInDominatingSet(d, [2]); +true +gap> IsDigraphInDominatingSet(d, [3]); +true +gap> IsDigraphInDominatingSet(d, [1, 2]); +true +gap> IsDigraphInDominatingSet(d, []); +false +gap> IsDigraphInDominatingSet(d, [1]); +false +gap> IsDigraphInDominatingSet(d, [2, 1]); +false +gap> IsDigraphInDominatingSet(d, [1, 4]); +false +gap> IsDigraphInDominatingSet(d, [1, 2, "abc"]); +false +gap> d := Digraph([[2, 4], [3], [1, 5], [3], [4]]);; +gap> IsDigraphInDominatingSet(d, [3, 4]); +true +gap> IsDigraphInDominatingSet(d, [1, 3, 5]); +true +gap> IsDigraphInDominatingSet(d, [1, 2, 4]); +true +gap> IsDigraphInDominatingSet(d, [3, 1]); +false +gap> IsDigraphInDominatingSet(d, [3, 1, 5, 2, 4]); +false +gap> IsDigraphInDominatingSet(d, [3, 5]); +false +gap> IsDigraphInDominatingSet(d, [5, 3]); +false +gap> d := Digraph([ +> [1, 2, 3, 4, 5], +> [1, 2, 3, 4, 5], +> [1, 2, 3, 4, 5], +> [1, 2, 3, 4, 5], +> [1, 2, 3, 4, 5]]);; +gap> IsDigraphInDominatingSet(d, [1]); +true +gap> IsDigraphInDominatingSet(d, [1, 3]); +true +gap> IsDigraphInDominatingSet(d, [1, 3, 5]); +true +gap> IsDigraphInDominatingSet(d, []); +false +gap> IsDigraphInDominatingSet(d, [3, 1]); +false +gap> IsDigraphInDominatingSet(d, [5, 1, 3]); +false +gap> d := DigraphFromSparse6String(":~?@O_GA?`OQCa?]FaoiIb_\ +> uLcpIQd`UTePaZCXwXeXiYeyIjIimcIyegJi_dJi[lJICgHxwdHHs`Hxs\ +> [Hh[ad`s[e@[UcqKid@{hdPORhaq_HhGPbryMNRqOBoyKE@yJEgsKAwc^\ +> IW_PNwgHAGW_OwSZLg[E@WKOJwKOFGGbIgCdHGG@@N"); + +gap> p := [1, 5, 8, 11, 14, 17, 18, 19, 22, 25, 27, 29, \ +> 30, 31, 32, 35, 37, 38, 39, 40, 41, 42, 43, 45, 64, 65, \ +> 73, 74];; +gap> IsDigraphInDominatingSet(d, p); +true +gap> p := [1, 5, 8, 11, 14, 17, 18, 19, 22, 25, 27, 29, \ +> 30, 31, 32, 35, 37, 38, 39, 40, 41, 42, 43, 45, 64, 65, \ +> 73];; +gap> IsDigraphInDominatingSet(d, p); +false +gap> p := [1, 5, 8, 11, 14, 17, 18, 19, 22, 25, 27, \ +> 30, 31, 32, 35, 37, 38, 39, 40, 41, 42, 43, 45, 64, 65, \ +> 73, 74];; +gap> IsDigraphInDominatingSet(d, p); +false +gap> p := [2, 3, 4, 5, 9, 10, 11, 12, 13, 14, 15, 17, \ +> 18, 19, 21, 23, 24, 25, 27, 29, 30, 31, 32, 35, 37, \ +> 38, 42, 44, 48, 49, 50, 51, 53, 54, 58, 60, 61, 62, \ +> 64, 66, 73, 74, 75, 78];; +gap> IsDigraphInDominatingSet(d, p); +true +gap> p := [2, 3, 4, 5, 9, 10, 11, 12, 13, 14, \ +> 18, 19, 21, 23, 24, 25, 27, 29, 30, 31, 32, 35, 37, \ +> 38, 50, 51, 53, 54, 58, 60, 61, 62, \ +> 64, 66, 73, 74, 75];; +gap> IsDigraphInDominatingSet(d, p); +false +gap> d := DigraphFromSparse6String(":~?AA_C?_CD?cD_sE`OH`KL\ +> @cO@kOawUA[TAcVASQBCRAsTAc^Bk]a[SasTcwNCCMB{]Cc\\C[eCcdC[\ +> [CSZCKYCSXCK]bk_EK^ESdcseckvEswEk|Fcz`_JACI@kK@WIaG}aG|`{\ +> MdOqdGpdoodwld_wdWvd?scwrfSxepNehMfczf`CfXDfpRfhQ`LPJDOJD\ +> SITTI\\FHlEHdJH|IHtDHLCHDBI|AIt_Jl^Jt[KdZK\\YKTXKLgKtdK|n\ +> LThm@mlhnlpolhnmHklXqltl`@sNCFMXv`@wMsFMxt__A_gBNkBAP?_GN\ +> @sC?O@"); + +gap> p := [1, 5, 7, 10, 13, 15, 16, 17, 19, 20, 21, 22, 23, \ +> 30, 31, 38, 39, 46, 47, 48, 49, 52, 53, 58, 59, 60, 61, \ +> 65, 67, 68, 71, 72, 75, 76, 81, 82, 87, 88, 92, 93, 98, \ +> 99, 102, 103, 110, 111, 112, 113, 118, 119, 122, 123, 127];; +gap> IsDigraphInDominatingSet(d, p); +true +gap> p := [1, 5, 7, 10, 13, 15, 16, 17, 19, 20, 21, 22, 23, \ +> 30, 31, 38, 39, 46, 47, 48, 49, 52, 53, 58, 59, 60, 61, \ +> 65, 67, 68, 71, 72, 75, 76, 81, 82, 87, 88, 92, 93, 98, \ +> 99, 102, 103, 110, 111, 112, 113, 118, 119, 122, 123];; +gap> IsDigraphInDominatingSet(d, p); +false +gap> p := [1, 5, 7, 10, 13, 15, 16, 17, 19, 20, 21, 22, 24, \ +> 30, 31, 38, 39, 46, 47, 48, 49, 52, 53, 58, 59, 60, 61, \ +> 65, 67, 68, 71, 72, 75, 76, 81, 82, 87, 88, 92, 93, 98, \ +> 99, 102, 103, 110, 111, 112, 113, 118, 119, 122, 123, 127];; +gap> IsDigraphInDominatingSet(d, p); +false +gap> p := [2, 3, 4, 5, 7, 10, 14, 15, 16, 18, 19, 20, 21, 22, \ +> 23, 26, 27, 32, 33, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, \ +> 54, 55, 56, 57, 62, 63, 64, 65, 66, 77, 78, 79, 80, 83, 84, \ +> 85, 86, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 108, \ +> 109, 110, 111, 112, 113, 114, 115, 122, 123, 124, 125, 127];; +gap> IsDigraphInDominatingSet(d, p); +true +gap> p := [2, 3, 4, 5, 7, 10, 14, 15, 16, 18, 19, 20, 21, 22, \ +> 23, 26, 27, 32, 33, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, \ +> 54, 55, 56, 57, 62, 63, 64, 77, 78, 79, 80, 83, 84, \ +> 85, 86, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 108, \ +> 109, 110, 111, 112, 113, 114, 115, 122, 123, 124, 125];; +gap> IsDigraphInDominatingSet(d, p); +false +gap> p := [2, 3, 4, 5, 7, 10, 14, 15, 16, 18, 19, 20, 21, 22, \ +> 24, 26, 27, 32, 33, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, \ +> 54, 55, 56, 57, 65, 66, 77, 78, 79, 80, 83, 84, \ +> 85, 86, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 108, \ +> 109, 110, 111, 112, 113, 114, 115, 122, 123, 124, 125, 127];; +gap> IsDigraphInDominatingSet(d, p); +false +gap> d := DigraphFromSparse6String(":u_OGCSHCc@xCa]MfsILOfM\ +> fSATIjLJEX`_nLKrAhqYKDQpOeNJJQpMAKbagcKXFDOHgyQeWgbydLVSs\ +> ZDUtVhUodrEEoVp?WEAAV^"); + +gap> p := [1, 5, 8, 10, 11, 12, 13, 14, 15, 17, 19, 20, 26, \ +> 36, 38, 40, 43, 44, 46, 47, 52];; +gap> IsDigraphInDominatingSet(d, p); +true +gap> p := [1, 5, 8, 10, 11, 12, 13, 14, 15, 17, 19, 20, 26, \ +> 36, 38, 40, 43, 44, 46, 47];; +gap> IsDigraphInDominatingSet(d, p); +false +gap> p := [1, 5, 8, 10, 11, 12, 13, 14, 15, 17, 19, 20, \ +> 36, 38, 40, 43, 44, 46, 47, 52];; +gap> IsDigraphInDominatingSet(d, p); +false +gap> p := [2, 3, 4, 5, 6, 8, 10, 11, 12, 13, 14, 16, 18, \ +> 20, 22, 23, 24, 25, 26, 30, 33, 37, 38, 39, 44, 46, \ +> 47, 48, 50, 52];; +gap> IsDigraphInDominatingSet(d, p); +true +gap> p := [2, 3, 4, 5, 6, 8, 10, 11, 12, 13, 14, 16, \ +> 20, 22, 23, 24, 25, 26, 30, 33, 37, 38, 39, 44, 46, \ +> 47, 48, 50, 52];; +gap> IsDigraphInDominatingSet(d, p); +false +gap> p := [2, 3, 4, 5, 6, 11, 12, 13, 14, 16, 18, \ +> 20, 22, 23, 24, 25, 26, 30, 33, 37, 38, 39, 44, 46, \ +> 47, 48, 50];; +gap> IsDigraphInDominatingSet(d, p); +false +gap> p := [4, 7, 8, 13, 16, 19, 26, 27, 32, 38, 39, 44, \ +> 45, 50, 54];; +gap> IsDigraphInDominatingSet(d, p); +true +gap> p := [4, 7, 8, 13, 16, 19, 26, 27, 32, 38, 39, 44, \ +> 45, 50, 52];; +gap> IsDigraphInDominatingSet(d, p); +false +gap> p := [4, 7, 8, 13, 16, 19, 26, 27, 32, 38, 39, 44, \ +> 45, 50];; +gap> IsDigraphInDominatingSet(d, p); +false +gap> p := [1 .. 10];; +gap> IsDigraphInDominatingSet(d, p); +false + +# DigraphGreedyOutDominatingSet +gap> d := Digraph([[2, 3], [2, 3], [1, 2, 3]]);; +gap> DigraphGreedyOutDominatingSet(d, [1, 2, 3]); +[ 1 ] +gap> DigraphGreedyOutDominatingSet(d, [1, 3, 2]); +[ 1 ] +gap> DigraphGreedyOutDominatingSet(d, [2, 1, 3]); +[ 1, 2 ] +gap> DigraphGreedyOutDominatingSet(d, [2, 3, 1]); +[ 1, 2 ] +gap> DigraphGreedyOutDominatingSet(d, [3, 1, 2]); +[ 3 ] +gap> DigraphGreedyOutDominatingSet(d, [3, 2, 1]); +[ 3 ] +gap> DigraphGreedyOutDominatingSet(d, [1, 2]); +Error, the 2nd argument must be a permuted list of vertices of the 1st argumen\ +t (a digraph) +gap> DigraphGreedyOutDominatingSet(d, [1, 2, 3, 3]); +Error, the 2nd argument must be a permuted list of vertices of the 1st argumen\ +t (a digraph) +gap> DigraphGreedyOutDominatingSet(d, ["a", "b", "c"]); +Error, the 2nd argument must be a permuted list of vertices of the 1st argumen\ +t (a digraph) +gap> DigraphGreedyOutDominatingSet(d, [2, 3, 4]); +Error, the 2nd argument must be a permuted list of vertices of the 1st argumen\ +t (a digraph) +gap> DigraphGreedyOutDominatingSet(d, []); +Error, the 2nd argument must be a permuted list of vertices of the 1st argumen\ +t (a digraph) +gap> d := Digraph([[2, 4], [3], [1, 5], [3], [4]]);; +gap> DigraphGreedyOutDominatingSet(d, [1, 2, 3, 4, 5]); +[ 1, 3 ] +gap> DigraphGreedyOutDominatingSet(d, [2, 1, 3, 4, 5]); +[ 1, 2, 5 ] +gap> DigraphGreedyOutDominatingSet(d, [2, 5, 1, 3, 4]); +[ 1, 2, 5 ] +gap> DigraphGreedyOutDominatingSet(d, [5, 1, 3, 4, 2]); +[ 1, 3, 5 ] +gap> d := DigraphFromSparse6String(":~?@O_GA?`OQCa?]FaoiIb_\ +> uLcpIQd`UTePaZCXwXeXiYeyIjIimcIyegJi_dJi[lJICgHxwdHHs`Hxs\ +> [Hh[ad`s[e@[UcqKid@{hdPORhaq_HhGPbryMNRqOBoyKE@yJEgsKAwc^\ +> IW_PNwgHAGW_OwSZLg[E@WKOJwKOFGGbIgCdHGG@@N"); + +gap> g := (1, 9, 27, 79, 50, 72, 11, 17, 77, 25, 18, 42, \ +> 63, 57, 62, 64, 48, 40, 39, 34, 8, 65, 38, 75, 70, 52, \ +> 41, 49, 22, 3, 45, 7, 37, 30)(2, 31, 80, 24, 51, 21, 73, \ +> 6, 28, 55, 13, 66, 26, 59, 44, 46, 29, 67, 78, 61, 68, \ +> 53, 43, 19, 10, 16, 54)(5, 15, 69, 23, 14)(12, 58, 20, \ +> 36, 35, 71, 33, 60, 56, 32, 47, 74, 76);; +gap> DigraphGreedyOutDominatingSet(d, OnTuples([1 .. 80], g)); +[ 2, 3, 4, 5, 9, 10, 11, 15, 16, 17, 27, 28, 31, 32, 37, 42, 45, 48, 49, 51, + 53, 54, 55, 56, 57, 58, 60, 62, 63, 69, 73, 75 ] +gap> g := (1, 44, 71, 66, 73, 29, 68, 50, 63, 49, 59, 75, \ +> 47, 36, 79, 33, 48, 74, 24, 20, 25, 77, 10, 19, 72, 9, \ +> 23, 8, 54, 37)(2, 5, 18, 16, 21, 61, 53, 56, 55, 4, 42, \ +> 39, 76, 12, 32, 14, 46, 52, 38, 27, 78, 65, 67, 57, 45, \ +> 11, 3, 13, 17, 7, 40, 70, 34, 15, 51, 22, 31, 60, 80, 26, \ +> 35, 58, 41, 30, 64, 43, 6, 62);; +gap> DigraphGreedyOutDominatingSet(d, OnTuples([1 .. 80], g)); +[ 3, 4, 5, 8, 13, 15, 16, 17, 18, 19, 23, 24, 25, 31, 32, 34, 35, 40, 42, 44, + 48, 49, 54, 58, 60, 61, 62, 68, 72, 74, 79 ] +gap> d := DigraphFromSparse6String(":~?AA_C?_CD?cD_sE`OH`KL\ +> @cO@kOawUA[TAcVASQBCRAsTAc^Bk]a[SasTcwNCCMB{]Cc\\C[eCcdC[\ +> [CSZCKYCSXCK]bk_EK^ESdcseckvEswEk|Fcz`_JACI@kK@WIaG}aG|`{\ +> MdOqdGpdoodwld_wdWvd?scwrfSxepNehMfczf`CfXDfpRfhQ`LPJDOJD\ +> SITTI\\FHlEHdJH|IHtDHLCHDBI|AIt_Jl^Jt[KdZK\\YKTXKLgKtdK|n\ +> LThm@mlhnlpolhnmHklXqltl`@sNCFMXv`@wMsFMxt__A_gBNkBAP?_GN\ +> @sC?O@"); + +gap> g := (1, 121, 127, 123, 51, 64, 113, 38, 2, 87, 70, 58, \ +> 129, 52, 6, 101, 33, 73, 37, 98, 63, 65, 69, 20, 61, 18, \ +> 62, 94, 11, 130, 97, 55, 48, 74, 89, 90, 122, 41, 9, 83, \ +> 102, 15, 84, 45, 8, 119, 46, 4, 50, 72, 95, 29, 24, 80, 31, \ +> 85, 118, 103, 106, 16, 116, 96, 42, 59, 91, 126, 92, 53, 67, \ +> 100, 60, 105, 39, 82, 124, 109, 40, 111, 104, 49, 47, 88, \ +> 44, 68, 19, 66)(3, 57, 114, 125, 93, 25, 26, 120, 7, 12, 112, \ +> 115, 36, 43, 22, 75, 23, 56, 107, 34, 13, 110, 117, 81, 108, \ +> 86, 5, 32)(10, 128, 35, 14, 77, 99, 21)(17, 71, 28, 78)(27, \ +> 76)(30, 54, 79);; +gap> DigraphGreedyOutDominatingSet(d, OnTuples([1 .. 130], g)); +[ 1, 6, 8, 9, 11, 12, 13, 17, 20, 21, 22, 23, 26, 32, 33, 42, 44, 45, 46, 48, + 50, 54, 55, 56, 57, 60, 62, 67, 71, 73, 77, 78, 79, 80, 83, 85, 87, 90, 91, + 98, 102, 103, 104, 105, 112, 114, 116, 119, 120, 121, 126, 128, 129, 130 ] +gap> g := (1, 70, 120, 119, 50, 116, 45, 96, 130, 51, 52, 7, 80, \ +> 77, 4, 37, 95, 28, 62, 124, 18, 33, 53, 8, 42, 22, 101, 81, 14, \ +> 31, 128, 125, 27, 129, 5, 85, 41, 87, 25, 55, 38, 24, 71, 19, \ +> 84, 113, 92, 58, 17, 65, 64, 29)(2, 112, 6, 90, 32, 93, 3, 15, \ +> 107, 67, 30, 127, 115, 47, 103, 94, 44, 108, 56, 88, 21, 114, \ +> 75, 60, 122, 123, 66, 99, 74, 86, 16, 72, 63, 46, 89, 102, 97, 78, \ +> 34, 69, 83, 43, 98, 111, 12, 10, 59, 82, 40, 13, 121, 100, 117, \ +> 109, 104)(9, 20, 48, 26, 49, 126, 118, 79)(11, 36, 91, 68, 57, 35, \ +> 23)(39, 106, 110, 61, 73);; +gap> DigraphGreedyOutDominatingSet(d, OnTuples([1 .. 130], g)); +[ 1, 7, 10, 13, 17, 19, 20, 25, 30, 31, 36, 37, 38, 40, 41, 46, 47, 48, 49, + 52, 53, 55, 59, 62, 63, 65, 70, 71, 72, 75, 76, 80, 83, 84, 85, 90, 91, 99, + 100, 101, 102, 108, 112, 114, 116, 120, 121, 127, 129, 130 ] +gap> d := DigraphFromSparse6String(":u_OGCSHCc@xCa]MfsILOfM\ +> fSATIjLJEX`_nLKrAhqYKDQpOeNJJQpMAKbagcKXFDOHgyQeWgbydLVSs\ +> ZDUtVhUodrEEoVp?WEAAV^"); + +gap> g := (1, 5, 14, 49, 17, 51, 8, 27, 46, 48, 23, 25, 41, 10, 39, \ +> 28, 40, 6, 33, 36, 7, 42, 37, 26, 12, 31, 20, 45, 15, 29, 38, 30, \ +> 22, 50, 18, 19, 47, 16, 9, 54, 43)(2, 21, 44, 53, 13)(3, 52)(11, \ +> 35)(24, 34, 32);; +gap> DigraphGreedyOutDominatingSet(d, OnTuples([1 .. 54], g)); +[ 1, 5, 9, 14, 16, 19, 21, 22, 28, 32, 33, 34, 35, 39, 41, 42, 45, 51, 52, 54 + ] +gap> g := (1, 15, 12, 46, 21, 17, 4, 11, 16, 9, 10, 14)(2, 50, 3, 23, \ +> 43, 29)(5, 42, 54)(6, 24, 34, 35, 7, 39, 20, 26, 49, 36, 33, 30, 41, \ +> 22, 52, 25, 8, 51, 32, 31, 37, 27, 47, 40, 13, 53, 28, 38, 18)(44, 48);; +gap> DigraphGreedyOutDominatingSet(d, OnTuples([1 .. 54], g)); +[ 1, 6, 8, 10, 11, 12, 14, 15, 20, 24, 25, 26, 30, 37, 39, 43, 44, 47, 50, + 52, 53 ] + +# DigraphGreedyInDominatingSet +gap> d := Digraph([[2, 3], [2, 3], [1, 2, 3]]);; +gap> DigraphGreedyInDominatingSet(d, [1, 2, 3]); +[ 1, 2 ] +gap> DigraphGreedyInDominatingSet(d, [1, 3, 2]); +[ 1, 2 ] +gap> DigraphGreedyInDominatingSet(d, [2, 1, 3]); +[ 2 ] +gap> DigraphGreedyInDominatingSet(d, [2, 3, 1]); +[ 2 ] +gap> DigraphGreedyInDominatingSet(d, [3, 1, 2]); +[ 3 ] +gap> DigraphGreedyInDominatingSet(d, [3, 2, 1]); +[ 3 ] +gap> DigraphGreedyInDominatingSet(d, [1, 2]); +Error, the 2nd argument must be a permuted list of vertices of the 1st argumen\ +t (a digraph) +gap> DigraphGreedyInDominatingSet(d, [1, 2, 3, 3]); +Error, the 2nd argument must be a permuted list of vertices of the 1st argumen\ +t (a digraph) +gap> DigraphGreedyInDominatingSet(d, ["a", "b", "c"]); +Error, the 2nd argument must be a permuted list of vertices of the 1st argumen\ +t (a digraph) +gap> DigraphGreedyInDominatingSet(d, [2, 3, 4]); +Error, the 2nd argument must be a permuted list of vertices of the 1st argumen\ +t (a digraph) +gap> DigraphGreedyInDominatingSet(d, []); +Error, the 2nd argument must be a permuted list of vertices of the 1st argumen\ +t (a digraph) +gap> d := Digraph([[2, 4], [3], [1, 5], [3], [4]]);; +gap> DigraphGreedyInDominatingSet(d, [1, 2, 3, 4, 5]); +[ 1, 2, 4 ] +gap> DigraphGreedyInDominatingSet(d, [2, 1, 3, 4, 5]); +[ 2, 3, 5 ] +gap> DigraphGreedyInDominatingSet(d, [2, 5, 1, 3, 4]); +[ 2, 4, 5 ] +gap> DigraphGreedyInDominatingSet(d, [5, 1, 3, 4, 2]); +[ 1, 2, 4, 5 ] +gap> d := DigraphFromSparse6String(":~?@O_GA?`OQCa?]FaoiIb_\ +> uLcpIQd`UTePaZCXwXeXiYeyIjIimcIyegJi_dJi[lJICgHxwdHHs`Hxs\ +> [Hh[ad`s[e@[UcqKid@{hdPORhaq_HhGPbryMNRqOBoyKE@yJEgsKAwc^\ +> IW_PNwgHAGW_OwSZLg[E@WKOJwKOFGGbIgCdHGG@@N"); + +gap> g := (1, 9, 27, 79, 50, 72, 11, 17, 77, 25, 18, 42, \ +> 63, 57, 62, 64, 48, 40, 39, 34, 8, 65, 38, 75, 70, 52, \ +> 41, 49, 22, 3, 45, 7, 37, 30)(2, 31, 80, 24, 51, 21, 73, \ +> 6, 28, 55, 13, 66, 26, 59, 44, 46, 29, 67, 78, 61, 68, \ +> 53, 43, 19, 10, 16, 54)(5, 15, 69, 23, 14)(12, 58, 20, \ +> 36, 35, 71, 33, 60, 56, 32, 47, 74, 76);; +gap> DigraphGreedyInDominatingSet(d, OnTuples([1 .. 80], g)); +[ 2, 3, 4, 5, 9, 10, 11, 15, 16, 17, 27, 28, 31, 32, 37, 42, 45, 48, 49, 51, + 53, 54, 55, 56, 57, 58, 60, 62, 63, 69, 73, 75 ] +gap> g := (1, 44, 71, 66, 73, 29, 68, 50, 63, 49, 59, 75, \ +> 47, 36, 79, 33, 48, 74, 24, 20, 25, 77, 10, 19, 72, 9, \ +> 23, 8, 54, 37)(2, 5, 18, 16, 21, 61, 53, 56, 55, 4, 42, \ +> 39, 76, 12, 32, 14, 46, 52, 38, 27, 78, 65, 67, 57, 45, \ +> 11, 3, 13, 17, 7, 40, 70, 34, 15, 51, 22, 31, 60, 80, 26, \ +> 35, 58, 41, 30, 64, 43, 6, 62);; +gap> DigraphGreedyInDominatingSet(d, OnTuples([1 .. 80], g)); +[ 3, 4, 5, 8, 13, 15, 16, 17, 18, 19, 23, 24, 25, 31, 32, 34, 35, 40, 42, 44, + 48, 49, 54, 58, 60, 61, 62, 68, 72, 74, 79 ] +gap> d := DigraphFromSparse6String(":~?AA_C?_CD?cD_sE`OH`KL\ +> @cO@kOawUA[TAcVASQBCRAsTAc^Bk]a[SasTcwNCCMB{]Cc\\C[eCcdC[\ +> [CSZCKYCSXCK]bk_EK^ESdcseckvEswEk|Fcz`_JACI@kK@WIaG}aG|`{\ +> MdOqdGpdoodwld_wdWvd?scwrfSxepNehMfczf`CfXDfpRfhQ`LPJDOJD\ +> SITTI\\FHlEHdJH|IHtDHLCHDBI|AIt_Jl^Jt[KdZK\\YKTXKLgKtdK|n\ +> LThm@mlhnlpolhnmHklXqltl`@sNCFMXv`@wMsFMxt__A_gBNkBAP?_GN\ +> @sC?O@"); + +gap> g := (1, 121, 127, 123, 51, 64, 113, 38, 2, 87, 70, 58, \ +> 129, 52, 6, 101, 33, 73, 37, 98, 63, 65, 69, 20, 61, 18, \ +> 62, 94, 11, 130, 97, 55, 48, 74, 89, 90, 122, 41, 9, 83, \ +> 102, 15, 84, 45, 8, 119, 46, 4, 50, 72, 95, 29, 24, 80, 31, \ +> 85, 118, 103, 106, 16, 116, 96, 42, 59, 91, 126, 92, 53, 67, \ +> 100, 60, 105, 39, 82, 124, 109, 40, 111, 104, 49, 47, 88, \ +> 44, 68, 19, 66)(3, 57, 114, 125, 93, 25, 26, 120, 7, 12, 112, \ +> 115, 36, 43, 22, 75, 23, 56, 107, 34, 13, 110, 117, 81, 108, \ +> 86, 5, 32)(10, 128, 35, 14, 77, 99, 21)(17, 71, 28, 78)(27, \ +> 76)(30, 54, 79);; +gap> DigraphGreedyInDominatingSet(d, OnTuples([1 .. 130], g)); +[ 1, 6, 8, 9, 11, 12, 13, 17, 20, 21, 22, 23, 26, 32, 33, 42, 44, 45, 46, 48, + 50, 54, 55, 56, 57, 60, 62, 67, 71, 73, 77, 78, 79, 80, 83, 85, 87, 90, 91, + 98, 102, 103, 104, 105, 112, 114, 116, 119, 120, 121, 126, 128, 129, 130 ] +gap> g := (1, 70, 120, 119, 50, 116, 45, 96, 130, 51, 52, 7, 80, \ +> 77, 4, 37, 95, 28, 62, 124, 18, 33, 53, 8, 42, 22, 101, 81, 14, \ +> 31, 128, 125, 27, 129, 5, 85, 41, 87, 25, 55, 38, 24, 71, 19, \ +> 84, 113, 92, 58, 17, 65, 64, 29)(2, 112, 6, 90, 32, 93, 3, 15, \ +> 107, 67, 30, 127, 115, 47, 103, 94, 44, 108, 56, 88, 21, 114, \ +> 75, 60, 122, 123, 66, 99, 74, 86, 16, 72, 63, 46, 89, 102, 97, 78, \ +> 34, 69, 83, 43, 98, 111, 12, 10, 59, 82, 40, 13, 121, 100, 117, \ +> 109, 104)(9, 20, 48, 26, 49, 126, 118, 79)(11, 36, 91, 68, 57, 35, \ +> 23)(39, 106, 110, 61, 73);; +gap> DigraphGreedyInDominatingSet(d, OnTuples([1 .. 130], g)); +[ 1, 7, 10, 13, 17, 19, 20, 25, 30, 31, 36, 37, 38, 40, 41, 46, 47, 48, 49, + 52, 53, 55, 59, 62, 63, 65, 70, 71, 72, 75, 76, 80, 83, 84, 85, 90, 91, 99, + 100, 101, 102, 108, 112, 114, 116, 120, 121, 127, 129, 130 ] +gap> d := DigraphFromSparse6String(":u_OGCSHCc@xCa]MfsILOfM\ +> fSATIjLJEX`_nLKrAhqYKDQpOeNJJQpMAKbagcKXFDOHgyQeWgbydLVSs\ +> ZDUtVhUodrEEoVp?WEAAV^"); + +gap> g := (1, 5, 14, 49, 17, 51, 8, 27, 46, 48, 23, 25, 41, 10, 39, \ +> 28, 40, 6, 33, 36, 7, 42, 37, 26, 12, 31, 20, 45, 15, 29, 38, 30, \ +> 22, 50, 18, 19, 47, 16, 9, 54, 43)(2, 21, 44, 53, 13)(3, 52)(11, \ +> 35)(24, 34, 32);; +gap> DigraphGreedyInDominatingSet(d, OnTuples([1 .. 54], g)); +[ 1, 5, 9, 14, 16, 19, 21, 22, 28, 32, 33, 34, 35, 39, 41, 42, 45, 51, 52, 54 + ] +gap> g := (1, 15, 12, 46, 21, 17, 4, 11, 16, 9, 10, 14)(2, 50, 3, 23, \ +> 43, 29)(5, 42, 54)(6, 24, 34, 35, 7, 39, 20, 26, 49, 36, 33, 30, 41, \ +> 22, 52, 25, 8, 51, 32, 31, 37, 27, 47, 40, 13, 53, 28, 38, 18)(44, 48);; +gap> DigraphGreedyInDominatingSet(d, OnTuples([1 .. 54], g)); +[ 1, 6, 8, 10, 11, 12, 14, 15, 20, 24, 25, 26, 30, 37, 39, 43, 44, 47, 50, + 52, 53 ] + # gap> DIGRAPHS_StopTest(); gap> STOP_TEST("Digraphs package: standard/oper.tst", 0); diff --git a/tst/testinstall.tst b/tst/testinstall.tst index 35d8d3863..7ee79de9f 100644 --- a/tst/testinstall.tst +++ b/tst/testinstall.tst @@ -582,6 +582,20 @@ true gap> D = out; false +# DigraphEdgeConnectivity +gap> D := Digraph([[4, 5], [4, 5], [4, 5], [1, 2, 3], [1, 2, 3]]);; +gap> DigraphEdgeConnectivity(D); +2 +gap> D := Digraph([[], [3], [2]]);; +gap> DigraphEdgeConnectivity(D); +0 +gap> C := Digraph([[3, 4], [1, 3, 4], [2], [3]]);; +gap> DigraphEdgeConnectivity(C); +Error, the argument must be a symmetric digraph, +gap> D := Digraph([[1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [1, 2, 3, 4, 5]]);; +gap> DigraphEdgeConnectivity(D); +4 + # gap> DIGRAPHS_StopTest(); gap> STOP_TEST("Digraphs package: testinstall.tst", 0);