diff --git a/doc/weights.xml b/doc/weights.xml
index f5e1844d4..e71fa6833 100644
--- a/doc/weights.xml
+++ b/doc/weights.xml
@@ -86,7 +86,7 @@ gap> EdgeWeights(g);
See .
g := EdgeWeightedDigraph([[2],[1],[1,2]], [[12],[5],[6,9]]);
+gap> g := EdgeWeightedDigraph([[2], [1], [1, 2]], [[12], [5], [6, 9]]);
gap> DigraphEdgeWeightedMinimumSpanningTree(g);
rec( mst := , total := 11
@@ -115,14 +115,14 @@ rec( mst := , total := 11
See .
g := EdgeWeightedDigraph([[2,3],[4],[4],[]],[[5,1],[6],[11],[]]);
+gap> g := EdgeWeightedDigraph([[2, 3], [4], [4], []], [[5, 1], [6], [11], []]);
-gap> DigraphEdgeWeightedShortestPath(g,1);
+gap> DigraphEdgeWeightedShortestPath(g, 1);
rec( distances := [ 0, 5, 1, 11 ], edges := [ fail, 1, 2, 1 ],
parents := [ fail, 1, 1, 2 ] )
-gap> ncg := EdgeWeightedDigraph([[2],[3],[1]],[[-1],[-2],[-3]]);
+gap> ncg := EdgeWeightedDigraph([[2], [3], [1]], [[-1], [-2], [-3]]);
-gap> DigraphEdgeWeightedShortestPath(ncg,1);
+gap> DigraphEdgeWeightedShortestPath(ncg, 1);
Error, negative cycle exists,
]]>
@@ -141,7 +141,7 @@ Error, negative cycle exists,
See .
g := EdgeWeightedDigraph([[2],[3],[1]],[[1],[2],[3]]);
+gap> g := EdgeWeightedDigraph([[2], [3], [1]], [[1], [2], [3]]);
gap> DigraphEdgeWeightedShortestPaths(g);
rec( distances := [ [ 0, 1, 3 ], [ 5, 0, 2 ], [ 3, 4, 0 ] ],
@@ -159,7 +159,7 @@ rec( distances := [ [ 0, 1, 3 ], [ 5, 0, 2 ], [ 3, 4, 0 ] ],
Given an edge weighted digraph, this returns a record with 3 components.
The first component is the flow inbound into vertex v which is a list of lists.
If there are multiple edges, the algorithm will fill up the edges sequentially so
- if there are 3 edges outbound from u to v with capacities, 5,10,15 and there is a flow of 15, it will fill the first two edges 5 and 10.
+ if there are 3 edges outbound from u to v with capacities, 5, 10, 15 and there is a flow of 15, it will fill the first two edges 5 and 10.
If there is a flow of 9, then the flow will contain a list with flows 5 and 4.
This can be coupled with the second component which is a list of list of the vertices that each flow comes from. Using this,
@@ -169,7 +169,7 @@ rec( distances := [ [ 0, 1, 3 ], [ 5, 0, 2 ], [ 3, 4, 0 ] ],
See .
g := EdgeWeightedDigraph([[2,2],[3],[]],[[3,2],[1],[]]);
+gap> g := EdgeWeightedDigraph([[2, 2], [3], []], [[3, 2], [1], []]);
gap> DigraphMaximumFlow(g, 1, 3);
rec( flows := [ [ ], [ 1, 0 ], [ 1 ] ], maxFlow := 1,
@@ -180,7 +180,7 @@ rec( flows := [ [ ], [ 1, 0 ], [ 1 ] ], maxFlow := 1,
<#GAPDoc Label="RandomUniqueEdgeWeightedDigraph">
-
+
An edge weighted digraph.
&STANDARD_FILT_TEXT;
@@ -223,7 +223,7 @@ gap> g := RandomUniqueEdgeWeightedDigraph(5, 1);
to all other vertices.
g := EdgeWeightedDigraph([[2],[3],[]],[[2],[1],[]]);
+gap> g := EdgeWeightedDigraph([[2], [3], []], [[2], [1], []]);
gap> sp := DigraphEdgeWeightedShortestPath(g, 1);
rec( distances := [ 0, 2, 3 ], edges := [ fail, 1, 1 ],
@@ -245,7 +245,7 @@ gap> sd := DigraphFromPaths(g, sp);
to dest vertex.
g := EdgeWeightedDigraph([[2],[3],[]],[[2],[1],[]]);
+gap> g := EdgeWeightedDigraph([[2], [3], []], [[2], [1], []]);
gap> sp := DigraphEdgeWeightedShortestPath(g, 1);
rec( distances := [ 0, 2, 3 ], edges := [ fail, 1, 1 ],
@@ -276,7 +276,7 @@ gap> sd := DigraphFromPath(g, sp, 2);
An empty record may be passed as a parameters, in which case the default values will be used.
g := EdgeWeightedDigraph([[2],[3],[]],[[2],[1],[]]);
+gap> g := EdgeWeightedDigraph([[2], [3], []], [[2], [1], []]);
gap> sp := DigraphEdgeWeightedShortestPath(g, 1);
rec( distances := [ 0, 2, 3 ], edges := [ fail, 1, 1 ],
diff --git a/gap/digraph.gi b/gap/digraph.gi
index d9ed0c616..9de7b8ecf 100644
--- a/gap/digraph.gi
+++ b/gap/digraph.gi
@@ -1372,9 +1372,8 @@ InstallMethod(RandomDigraphCons, "for IsConnectedDigraph and an integer",
InstallMethod(RandomDigraphCons,
"for IsStronglyConnectedDigraph, an integer, and a rational",
[IsStronglyConnectedDigraph, IsInt],
-function(filt, n)
- return RandomDigraphCons(IsStronglyConnectedDigraph, n, Float(Random([0 .. n])) / n);
-end);
+{_, n} ->
+RandomDigraphCons(IsStronglyConnectedDigraph, n, Float(Random([0 .. n])) / n));
InstallMethod(RandomDigraphCons, "for IsAcyclicDigraph and an integer",
[IsAcyclicDigraph, IsInt],
diff --git a/gap/display.gd b/gap/display.gd
index 2874616f6..f1926c9ef 100644
--- a/gap/display.gd
+++ b/gap/display.gd
@@ -10,7 +10,8 @@
DeclareAttribute("DotDigraph", IsDigraph);
DeclareOperation("DotColoredDigraph", [IsDigraph, IsList, IsList]);
-DeclareOperation("DotColoredEdgeWeightedDigraph", [IsDigraph, IsList, IsList, IsList]);
+DeclareOperation("DotColoredEdgeWeightedDigraph",
+ [IsDigraph, IsList, IsList, IsList]);
DeclareOperation("DotVertexColoredDigraph", [IsDigraph, IsList]);
DeclareOperation("DotEdgeColoredDigraph", [IsDigraph, IsList]);
DeclareOperation("DotVertexLabelledDigraph", [IsDigraph]);
diff --git a/gap/display.gi b/gap/display.gi
index feca28eff..85f9ed8ed 100644
--- a/gap/display.gi
+++ b/gap/display.gi
@@ -159,14 +159,17 @@ function(D, vert, edge)
fi;
end);
-# https://graphs.grevian.org/example
-InstallMethod(DotColoredEdgeWeightedDigraph, "for a digraph by out-neighbours and three lists",
+InstallMethod(DotColoredEdgeWeightedDigraph,
+"for a digraph by out-neighbours and three lists",
[IsDigraphByOutNeighboursRep, IsList, IsList, IsList],
function(D, vert, edge, weight)
+ # https://graphs.grevian.org/example
local vert_func, edge_func;
if DIGRAPHS_ValidVertColors(D, vert) and DIGRAPHS_ValidEdgeColors(D, edge) then
vert_func := i -> StringFormatted("[color={}, style=filled]", vert[i]);
- edge_func := {i, j} -> StringFormatted("[color={}, label={}]", edge[i][j], weight[i][j]);
+ edge_func := {i, j} -> StringFormatted("[color={}, label={}]",
+ edge[i][j],
+ weight[i][j]);
return DIGRAPHS_DotDigraph(D, [vert_func], [edge_func]);
fi;
end);
diff --git a/gap/weights.gd b/gap/weights.gd
index 5599adfa4..e08e95537 100644
--- a/gap/weights.gd
+++ b/gap/weights.gd
@@ -17,22 +17,28 @@ DeclareProperty("IsNegativeEdgeWeightedDigraph", IsDigraph and HasEdgeWeights);
DeclareOperation("EdgeWeightsMutableCopy", [IsDigraph and HasEdgeWeights]);
# 3. Minimum Spanning Trees
-DeclareAttribute("DigraphEdgeWeightedMinimumSpanningTree", IsDigraph and HasEdgeWeights);
+DeclareAttribute("DigraphEdgeWeightedMinimumSpanningTree",
+ IsDigraph and HasEdgeWeights);
# 4. Shortest Path
-DeclareOperation("DigraphEdgeWeightedShortestPath", [IsDigraph and HasEdgeWeights, IsPosInt]);
-DeclareAttribute("DigraphEdgeWeightedShortestPaths", IsDigraph and HasEdgeWeights);
+DeclareOperation("DigraphEdgeWeightedShortestPath",
+ [IsDigraph and HasEdgeWeights, IsPosInt]);
+DeclareAttribute("DigraphEdgeWeightedShortestPaths",
+ IsDigraph and HasEdgeWeights);
# 5. Maximum Flow
-DeclareOperation("DigraphMaximumFlow", [IsDigraph and HasEdgeWeights, IsPosInt, IsPosInt]);
+DeclareOperation("DigraphMaximumFlow",
+ [IsDigraph and HasEdgeWeights, IsPosInt, IsPosInt]);
DeclareAttribute("DigraphMinimumCuts", IsDigraph);
# 6. Random Edge Weighted Digraph
-DeclareOperation("RandomUniqueEdgeWeightedDigraph",[IsPosInt]);
+DeclareOperation("RandomUniqueEdgeWeightedDigraph", [IsPosInt]);
DeclareOperation("RandomUniqueEdgeWeightedDigraph", [IsPosInt, IsFloat]);
DeclareOperation("RandomUniqueEdgeWeightedDigraph", [IsPosInt, IsRat]);
-DeclareOperation("RandomUniqueEdgeWeightedDigraph", [IsFunction, IsPosInt, IsFloat]);
-DeclareOperation("RandomUniqueEdgeWeightedDigraph", [IsFunction, IsPosInt, IsRat]);
+DeclareOperation("RandomUniqueEdgeWeightedDigraph",
+ [IsFunction, IsPosInt, IsFloat]);
+DeclareOperation("RandomUniqueEdgeWeightedDigraph",
+ [IsFunction, IsPosInt, IsRat]);
# 7. Painting Edge Weighted Digraph
DeclareOperation("DigraphFromPaths", [IsDigraph, IsRecord]);
diff --git a/gap/weights.gi b/gap/weights.gi
index 4a0623ff0..7f4bcefe2 100644
--- a/gap/weights.gi
+++ b/gap/weights.gi
@@ -136,7 +136,7 @@ function(digraph)
weights := EdgeWeights(digraph);
- # create a list of edges containining u-v
+ # create a list of edges containing u-v
# w: the weight of the edge
# u: the start vertex
# v: the finishing vertex of that edge
@@ -214,7 +214,7 @@ DIGRAPHS_Edge_Weighted_Dijkstra := function(digraph, source)
digraphVertices := DigraphVertices(digraph);
nrVertices := Size(digraphVertices);
- # Create an adjacancy map for the edges with their associated weight
+ # Create an adjacency map for the edges with their associated weight
adj := HashMap();
for u in digraphVertices do
adj[u] := HashMap();
@@ -415,7 +415,7 @@ DIGRAPHS_Edge_Weighted_FloydWarshall := function(digraph)
nrVertices := Size(digraphVertices);
outs := OutNeighbors(digraph);
- # Create adjacancy matrix
+ # Create adjacency matrix
adjMatrix := EmptyPlist(nrVertices);
parents := EmptyPlist(nrVertices);
edges := EmptyPlist(nrVertices);
@@ -873,40 +873,32 @@ end;
InstallMethod(RandomUniqueEdgeWeightedDigraph,
"for a pos int", [IsPosInt],
-function(n)
- return DIGRAPHS_Random_Edge_Weighted_Digraph_N(n);
-end);
+DIGRAPHS_Random_Edge_Weighted_Digraph_N);
InstallMethod(RandomUniqueEdgeWeightedDigraph,
"for a pos int and a float", [IsPosInt, IsFloat],
-function(n, p)
- return DIGRAPHS_Random_Edge_Weighted_Digraph_N_P(n, p);
-end);
+{n, p} -> DIGRAPHS_Random_Edge_Weighted_Digraph_N_P(n, p));
InstallMethod(RandomUniqueEdgeWeightedDigraph,
"for a pos int and a rational", [IsPosInt, IsRat],
-function(n, p)
- return DIGRAPHS_Random_Edge_Weighted_Digraph_N_P(n, p);
-end);
+{n, p} -> DIGRAPHS_Random_Edge_Weighted_Digraph_N_P(n, p));
InstallMethod(RandomUniqueEdgeWeightedDigraph,
"for a func, a pos int, and a float", [IsFunction, IsPosInt, IsFloat],
-function(filt, n, p)
- return DIGRAPHS_Random_Edge_Weighted_Digraph_Filt_N_P(filt, n, p);
-end);
+{filt, n, p} -> DIGRAPHS_Random_Edge_Weighted_Digraph_Filt_N_P(filt, n, p));
InstallMethod(RandomUniqueEdgeWeightedDigraph,
"for a func, a pos int, and a rational", [IsFunction, IsPosInt, IsRat],
-function(filt, n, p)
- return DIGRAPHS_Random_Edge_Weighted_Digraph_Filt_N_P(filt, n, p);
-end);
+{filt, n, p} -> DIGRAPHS_Random_Edge_Weighted_Digraph_Filt_N_P(filt, n, p));
#############################################################################
# 7. Painting Edge Weighted Digraph
#############################################################################
InstallMethod(DigraphFromPath, "for a digraph, a record, and a pos int",
[IsDigraph, IsRecord, IsPosInt],
-function(digraph, record, destination)
+function(_, record, destination)
+ # TODO: digraph is not used, which is surprising and may suggest
+ # confusion in design. We should work this out.
local idx, distances, edges, p, parents,
nrVertices, outNeighbours, vertex;
@@ -923,7 +915,7 @@ function(digraph, record, destination)
od;
vertex := destination;
- # while vertex isnt the start vertex
+ # while vertex isn't the start vertex
while parents[vertex] <> fail do
p := parents[vertex]; # parent of vertex is p
@@ -936,7 +928,8 @@ end);
InstallMethod(DigraphFromPaths,
"for a digraph, and a record", [IsDigraph, IsRecord],
-function(digraph, record)
+function(_, record)
+ # TODO: digraph is not used - see DigraphFromPath
local idx, distances, edges, parents, nrVertices, outNeighbours,
u, v;
diff --git a/tst/standard/weights.tst b/tst/standard/weights.tst
index edb439052..8721a69dc 100644
--- a/tst/standard/weights.tst
+++ b/tst/standard/weights.tst
@@ -104,31 +104,31 @@ gap> DigraphEdgeWeightedMinimumSpanningTree(d);
rec( mst := , total := 0 )
# digraph with cycle
-gap> d := EdgeWeightedDigraph([[2],[3],[1]],[[5],[10],[15]]);
+gap> d := EdgeWeightedDigraph([[2], [3], [1]], [[5], [10], [15]]);
gap> DigraphEdgeWeightedMinimumSpanningTree(d);
rec( mst := , total := 15 )
# digraph with negative edge
-gap> d := EdgeWeightedDigraph([[2],[]],[[-5],[]]);
+gap> d := EdgeWeightedDigraph([[2], []], [[-5], []]);
gap> DigraphEdgeWeightedMinimumSpanningTree(d);
rec( mst := , total := -5 )
# digraph with negative cycle
-gap> d := EdgeWeightedDigraph([[2],[3],[1]],[[-5],[-10],[-15]]);
+gap> d := EdgeWeightedDigraph([[2], [3], [1]], [[-5], [-10], [-15]]);
gap> DigraphEdgeWeightedMinimumSpanningTree(d);
rec( mst := , total := -25 )
# digraph with parallel edges
-gap> d := EdgeWeightedDigraph([[2,2,2],[1]],[[10,5,15],[7]]);
+gap> d := EdgeWeightedDigraph([[2, 2, 2], [1]], [[10, 5, 15], [7]]);
gap> DigraphEdgeWeightedMinimumSpanningTree(d);
rec( mst := , total := 5 )
# graph one node
-gap> d := EdgeWeightedDigraph([[]],[[]]);
+gap> d := EdgeWeightedDigraph([[]], [[]]);
gap> DigraphEdgeWeightedShortestPath(d, 1);
rec( distances := [ 0 ], edges := [ fail ], parents := [ fail ] )
@@ -140,74 +140,74 @@ rec( distances := [ 0, fail ], edges := [ fail, fail ],
parents := [ fail, fail ] )
# graph with one node and self loop
-gap> d := EdgeWeightedDigraph([[1]],[[5]]);
+gap> d := EdgeWeightedDigraph([[1]], [[5]]);
gap> DigraphEdgeWeightedShortestPath(d, 1);
rec( distances := [ 0 ], edges := [ fail ], parents := [ fail ] )
# graph with two nodes and self loop on second node
-gap> d := EdgeWeightedDigraph([[2],[1,2]],[[5],[5,5]]);
+gap> d := EdgeWeightedDigraph([[2], [1, 2]], [[5], [5, 5]]);
gap> DigraphEdgeWeightedShortestPath(d, 1);
rec( distances := [ 0, 5 ], edges := [ fail, 1 ], parents := [ fail, 1 ] )
# graph with cycle
-gap> d := EdgeWeightedDigraph([[2],[3],[1]],[[2],[3],[4]]);
+gap> d := EdgeWeightedDigraph([[2], [3], [1]], [[2], [3], [4]]);
gap> DigraphEdgeWeightedShortestPath(d, 1);
rec( distances := [ 0, 2, 5 ], edges := [ fail, 1, 1 ],
parents := [ fail, 1, 2 ] )
# parallel edges
-gap> d := EdgeWeightedDigraph([[2,2,2],[1]],[[10,5,15],[7]]);
+gap> d := EdgeWeightedDigraph([[2, 2, 2], [1]], [[10, 5, 15], [7]]);
gap> DigraphEdgeWeightedShortestPath(d, 1);
rec( distances := [ 0, 5 ], edges := [ fail, 2 ], parents := [ fail, 1 ] )
# negative edges
-gap> d := EdgeWeightedDigraph([[2],[1]],[[-2],[7]]);
+gap> d := EdgeWeightedDigraph([[2], [1]], [[-2], [7]]);
gap> DigraphEdgeWeightedShortestPath(d, 1);
rec( distances := [ 0, -2 ], edges := [ fail, 1 ], parents := [ fail, 1 ] )
# parallel negative edges
-gap> d := EdgeWeightedDigraph([[2,2,2],[1]],[[-2,-3,-4],[7]]);
+gap> d := EdgeWeightedDigraph([[2, 2, 2], [1]], [[-2, -3, -4], [7]]);
gap> DigraphEdgeWeightedShortestPath(d, 1);
rec( distances := [ 0, -4 ], edges := [ fail, 3 ], parents := [ fail, 1 ] )
# negative cycle
-gap> d := EdgeWeightedDigraph([[2,2,2],[1]],[[-10,5,-15],[7]]);
+gap> d := EdgeWeightedDigraph([[2, 2, 2], [1]], [[-10, 5, -15], [7]]);
gap> DigraphEdgeWeightedShortestPath(d, 1);
Error, negative cycle exists,
# source not in graph pos int
-gap> d := EdgeWeightedDigraph([[2],[1]],[[2],[7]]);
+gap> d := EdgeWeightedDigraph([[2], [1]], [[2], [7]]);
gap> DigraphEdgeWeightedShortestPath(d, 3);
Error, source vertex does not exist within digraph
# no path exists
-gap> d := EdgeWeightedDigraph([[1],[2]],[[5],[10]]);
+gap> d := EdgeWeightedDigraph([[1], [2]], [[5], [10]]);
gap> DigraphEdgeWeightedShortestPath(d, 1);
rec( distances := [ 0, fail ], edges := [ fail, fail ],
parents := [ fail, fail ] )
# no path exists with negative edge weight
-gap> d := EdgeWeightedDigraph([[2],[2],[]],[[-5],[10],[]]);
+gap> d := EdgeWeightedDigraph([[2], [2], []], [[-5], [10], []]);
gap> r := DigraphEdgeWeightedShortestPath(d, 1);;
-gap> r.distances = [ 0, -5, fail ];
+gap> r.distances = [0, -5, fail];
true
-gap> r.edges = [ fail, 1, fail ];
+gap> r.edges = [fail, 1, fail];
true
-gap> r.parents = [ fail, 1, fail ];
+gap> r.parents = [fail, 1, fail];
true
# parallel edges
-gap> d := EdgeWeightedDigraph([[2,2,2],[]],[[3,2,1],[]]);
+gap> d := EdgeWeightedDigraph([[2, 2, 2], []], [[3, 2, 1], []]);
gap> DigraphEdgeWeightedShortestPaths(d);
rec( distances := [ [ 0, 1 ], [ fail, 0 ] ],
@@ -215,7 +215,7 @@ rec( distances := [ [ 0, 1 ], [ fail, 0 ] ],
parents := [ [ fail, 1 ], [ fail, fail ] ] )
# negative cycle
-gap> d := EdgeWeightedDigraph([[2],[3],[1]],[[-3],[-5],[-7]]);
+gap> d := EdgeWeightedDigraph([[2], [3], [1]], [[-3], [-5], [-7]]);
gap> DigraphEdgeWeightedShortestPaths(d);
Error, negative cycle exists,
@@ -227,7 +227,7 @@ Error, no 1st choice method found for `DigraphEdgeWeightedShortestPath' on 2 a\
rguments
# testing johnson
-gap> d := EdgeWeightedDigraph([[2],[3],[],[],[]],[[3],[5],[],[],[]]);
+gap> d := EdgeWeightedDigraph([[2], [3], [], [], []], [[3], [5], [], [], []]);
gap> DigraphEdgeWeightedShortestPaths(d);
rec( distances := [ [ 0, 3, 8, fail, fail ], [ fail, 0, 5, fail, fail ],
@@ -241,63 +241,63 @@ rec( distances := [ [ 0, 3, 8, fail, fail ], [ fail, 0, 5, fail, fail ],
[ fail, fail, fail, fail, fail ] ] )
# empty digraphs
-gap> d := EdgeWeightedDigraph([],[]);
+gap> d := EdgeWeightedDigraph([], []);
gap> DigraphMaximumFlow(d, 1, 1);
Error, invalid source,
# single vertex (also empty digraphs)
-gap> d := EdgeWeightedDigraph([[]],[[]]);
+gap> d := EdgeWeightedDigraph([[]], [[]]);
gap> DigraphMaximumFlow(d, 1, 1);
rec( flows := [ [ ] ], maxFlow := 0, parents := [ [ ] ] )
# source = dest
-gap> d := EdgeWeightedDigraph([[2],[]],[[5],[]]);
+gap> d := EdgeWeightedDigraph([[2], []], [[5], []]);
gap> DigraphMaximumFlow(d, 1, 1);
rec( flows := [ [ ], [ ] ], maxFlow := 0, parents := [ [ ], [ ] ] )
# has loop
-gap> d := EdgeWeightedDigraph([[1,2],[]],[[5,10],[]]);
+gap> d := EdgeWeightedDigraph([[1, 2], []], [[5, 10], []]);
gap> DigraphMaximumFlow(d, 1, 2);
rec( flows := [ [ ], [ 10 ] ], maxFlow := 10, parents := [ [ ], [ 1 ] ] )
# invalid source
-gap> d := EdgeWeightedDigraph([[1,2],[]],[[5,10],[]]);
+gap> d := EdgeWeightedDigraph([[1, 2], []], [[5, 10], []]);
gap> DigraphMaximumFlow(d, 5, 2);
Error, invalid source,
# invalid sink
-gap> d := EdgeWeightedDigraph([[1,2],[]],[[5,10],[]]);
+gap> d := EdgeWeightedDigraph([[1, 2], []], [[5, 10], []]);
gap> DigraphMaximumFlow(d, 1, 5);
Error, invalid sink,
# sink not reachable
-gap> d := EdgeWeightedDigraph([[1],[]],[[5],[]]);
+gap> d := EdgeWeightedDigraph([[1], []], [[5], []]);
gap> DigraphMaximumFlow(d, 1, 2);
rec( flows := [ [ ], [ ] ], maxFlow := 0, parents := [ [ ], [ ] ] )
# source has in neighbours
-gap> d := EdgeWeightedDigraph([[2],[3],[]],[[5],[10],[]]);
+gap> d := EdgeWeightedDigraph([[2], [3], []], [[5], [10], []]);
gap> DigraphMaximumFlow(d, 2, 3);
rec( flows := [ [ ], [ ], [ 10 ] ], maxFlow := 10,
parents := [ [ ], [ ], [ 2 ] ] )
# sink has out neighbours
-gap> d := EdgeWeightedDigraph([[2],[3],[2]],[[5],[10],[7]]);
+gap> d := EdgeWeightedDigraph([[2], [3], [2]], [[5], [10], [7]]);
gap> DigraphMaximumFlow(d, 2, 3);
rec( flows := [ [ ], [ ], [ 10 ] ], maxFlow := 10,
parents := [ [ ], [ ], [ 2 ] ] )
# cycle
-gap> d := EdgeWeightedDigraph([[2],[3],[1]],[[5],[10],[7]]);
+gap> d := EdgeWeightedDigraph([[2], [3], [1]], [[5], [10], [7]]);
gap> DigraphMaximumFlow(d, 1, 3);
rec( flows := [ [ ], [ 5 ], [ 5 ] ], maxFlow := 5,
@@ -325,32 +325,32 @@ gap> DigraphNrVertices(d);
gap> d := EdgeWeightedDigraph([[2], [1]], [[5], [10]]);;
gap> sp := DigraphEdgeWeightedShortestPath(d, 1);;
gap> sd := DigraphFromPaths(d, sp);;
-gap> DotEdgeWeightedDigraph(d, sd, rec(sourceColour:="red"));;
+gap> DotEdgeWeightedDigraph(d, sd, rec(sourceColour := "red"));;
# dot tests
gap> d := EdgeWeightedDigraph([[2], [1]], [[5], [10]]);;
gap> sp := DigraphEdgeWeightedShortestPath(d, 1);;
gap> sd := DigraphFromPaths(d, sp);;
-gap> DotEdgeWeightedDigraph(d, sd, rec(source:=1));;
+gap> DotEdgeWeightedDigraph(d, sd, rec(source := 1));;
# dot tests
gap> d := EdgeWeightedDigraph([[2], [1]], [[5], [10]]);;
gap> sp := DigraphEdgeWeightedShortestPath(d, 1);;
gap> sd := DigraphFromPaths(d, sp);;
-gap> DotEdgeWeightedDigraph(d, sd, rec(source:=500));
+gap> DotEdgeWeightedDigraph(d, sd, rec(source := 500));
Error, source vertex does not exist,
# dot tests
gap> d := EdgeWeightedDigraph([[2], [1]], [[5], [10]]);;
gap> sp := DigraphEdgeWeightedShortestPath(d, 1);;
gap> sd := DigraphFromPaths(d, sp);;
-gap> DotEdgeWeightedDigraph(d, sd, rec(dest:=2));;
+gap> DotEdgeWeightedDigraph(d, sd, rec(dest := 2));;
# dot tests
gap> d := EdgeWeightedDigraph([[2], [1]], [[5], [10]]);;
gap> sp := DigraphEdgeWeightedShortestPath(d, 1);;
gap> sd := DigraphFromPaths(d, sp);;
-gap> DotEdgeWeightedDigraph(d, sd, rec(dest:=500));
+gap> DotEdgeWeightedDigraph(d, sd, rec(dest := 500));
Error, destination vertex does not exist,
#