Skip to content

Commit 8ef2dca

Browse files
committed
Added ViewString edits to testing
1 parent 86500e9 commit 8ef2dca

File tree

1 file changed

+42
-42
lines changed

1 file changed

+42
-42
lines changed

tst/standard/weights.tst

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ gap> DIGRAPHS_StartTest();
2222

2323
# create edge-weighted digraph
2424
gap> d := EdgeWeightedDigraph([[2], []], [[5], []]);
25-
<immutable digraph with 2 vertices, 1 edge>
25+
<immutable edge-weighted digraph with 2 vertices, 1 edge>
2626
gap> d := EdgeWeightedDigraph(Digraph([[2], []]), [[5], []]);
27-
<immutable digraph with 2 vertices, 1 edge>
27+
<immutable edge-weighted digraph with 2 vertices, 1 edge>
2828
gap> EdgeWeightedDigraphTotalWeight(d);
2929
5
3030

@@ -71,7 +71,7 @@ Error, the number of out-neighbours and weights for the vertex 1 must be equal\
7171

7272
# changing edge weights mutable copy
7373
gap> d := EdgeWeightedDigraph([[2], [1]], [[5], [10]]);
74-
<immutable digraph with 2 vertices, 2 edges>
74+
<immutable edge-weighted digraph with 2 vertices, 2 edges>
7575
gap> m := EdgeWeightsMutableCopy(d);
7676
[ [ 5 ], [ 10 ] ]
7777
gap> m[1] := [25];
@@ -89,11 +89,11 @@ Error, List Assignment: <list> must be a mutable list
8989

9090
# negative edge weights
9191
gap> d := EdgeWeightedDigraph([[2], [1]], [[5], [10]]);
92-
<immutable digraph with 2 vertices, 2 edges>
92+
<immutable edge-weighted digraph with 2 vertices, 2 edges>
9393
gap> IsNegativeEdgeWeightedDigraph(d);
9494
false
9595
gap> d := EdgeWeightedDigraph([[2], [1]], [[-5], [10]]);
96-
<immutable digraph with 2 vertices, 2 edges>
96+
<immutable edge-weighted digraph with 2 vertices, 2 edges>
9797
gap> IsNegativeEdgeWeightedDigraph(d);
9898
true
9999

@@ -103,57 +103,57 @@ true
103103

104104
# not connnected digraph
105105
gap> d := EdgeWeightedDigraph([[1], [2]], [[5], [10]]);
106-
<immutable digraph with 2 vertices, 2 edges>
106+
<immutable edge-weighted digraph with 2 vertices, 2 edges>
107107
gap> EdgeWeightedDigraphMinimumSpanningTree(d);
108108
Error, the argument <D> must be a connected digraph,
109109

110110
# digraph with one node
111111
gap> d := EdgeWeightedDigraph([[]], [[]]);
112-
<immutable empty digraph with 1 vertex>
112+
<immutable edge-weighted empty digraph with 1 vertex>
113113
gap> tree := EdgeWeightedDigraphMinimumSpanningTree(d);
114-
<immutable empty digraph with 1 vertex>
114+
<immutable edge-weighted empty digraph with 1 vertex>
115115
gap> EdgeWeightedDigraphTotalWeight(tree);
116116
0
117117

118118
# digraph with loop
119119
gap> d := EdgeWeightedDigraph([[1]], [[5]]);
120-
<immutable digraph with 1 vertex, 1 edge>
120+
<immutable edge-weighted digraph with 1 vertex, 1 edge>
121121
gap> EdgeWeightedDigraphMinimumSpanningTree(d);
122-
<immutable empty digraph with 1 vertex>
122+
<immutable edge-weighted empty digraph with 1 vertex>
123123

124124
# digraph with cycle
125125
gap> d := EdgeWeightedDigraph([[2], [3], [1]], [[5], [10], [15]]);
126-
<immutable digraph with 3 vertices, 3 edges>
126+
<immutable edge-weighted digraph with 3 vertices, 3 edges>
127127
gap> tree := EdgeWeightedDigraphMinimumSpanningTree(d);
128-
<immutable digraph with 3 vertices, 2 edges>
128+
<immutable edge-weighted digraph with 3 vertices, 2 edges>
129129
gap> EdgeWeightedDigraphTotalWeight(tree);
130130
15
131131

132132
# digraph with negative edge
133133
gap> d := EdgeWeightedDigraph([[2], []], [[-5], []]);
134-
<immutable digraph with 2 vertices, 1 edge>
134+
<immutable edge-weighted digraph with 2 vertices, 1 edge>
135135
gap> EdgeWeightedDigraphMinimumSpanningTree(d);
136-
<immutable digraph with 2 vertices, 1 edge>
136+
<immutable edge-weighted digraph with 2 vertices, 1 edge>
137137

138138
# digraph with negative cycle
139139
gap> d := EdgeWeightedDigraph([[2], [3], [1]], [[-5], [-10], [-15]]);
140-
<immutable digraph with 3 vertices, 3 edges>
140+
<immutable edge-weighted digraph with 3 vertices, 3 edges>
141141
gap> EdgeWeightedDigraphMinimumSpanningTree(d);
142-
<immutable digraph with 3 vertices, 2 edges>
142+
<immutable edge-weighted digraph with 3 vertices, 2 edges>
143143

144144
# digraph with parallel edges
145145
gap> d := EdgeWeightedDigraph([[2, 2, 2], [1]], [[10, 5, 15], [7]]);
146-
<immutable multidigraph with 2 vertices, 4 edges>
146+
<immutable edge-weighted multidigraph with 2 vertices, 4 edges>
147147
gap> EdgeWeightedDigraphMinimumSpanningTree(d);
148-
<immutable digraph with 2 vertices, 1 edge>
148+
<immutable edge-weighted digraph with 2 vertices, 1 edge>
149149

150150
#############################################################################
151151
# 4. Shortest Path
152152
#############################################################################
153153

154154
# Shortest paths: one node
155155
gap> d := EdgeWeightedDigraph([[]], [[]]);
156-
<immutable empty digraph with 1 vertex>
156+
<immutable edge-weighted empty digraph with 1 vertex>
157157
gap> EdgeWeightedDigraphShortestPaths(d, 1);
158158
rec( distances := [ 0 ], edges := [ fail ], parents := [ fail ] )
159159

@@ -165,52 +165,52 @@ rec( distances := [ 0, fail ], edges := [ fail, fail ],
165165

166166
# Shortest paths: one node and loop
167167
gap> d := EdgeWeightedDigraph([[1]], [[5]]);
168-
<immutable digraph with 1 vertex, 1 edge>
168+
<immutable edge-weighted digraph with 1 vertex, 1 edge>
169169
gap> EdgeWeightedDigraphShortestPaths(d, 1);
170170
rec( distances := [ 0 ], edges := [ fail ], parents := [ fail ] )
171171

172172
# Shortest paths: two nodes and loop on second node
173173
gap> d := EdgeWeightedDigraph([[2], [1, 2]], [[5], [5, 5]]);
174-
<immutable digraph with 2 vertices, 3 edges>
174+
<immutable edge-weighted digraph with 2 vertices, 3 edges>
175175
gap> EdgeWeightedDigraphShortestPaths(d, 1);
176176
rec( distances := [ 0, 5 ], edges := [ fail, 1 ], parents := [ fail, 1 ] )
177177

178178
# Shortest paths: cycle
179179
gap> d := EdgeWeightedDigraph([[2], [3], [1]], [[2], [3], [4]]);
180-
<immutable digraph with 3 vertices, 3 edges>
180+
<immutable edge-weighted digraph with 3 vertices, 3 edges>
181181
gap> EdgeWeightedDigraphShortestPaths(d, 1);
182182
rec( distances := [ 0, 2, 5 ], edges := [ fail, 1, 1 ],
183183
parents := [ fail, 1, 2 ] )
184184

185185
# Shortest paths: parallel edges
186186
gap> d := EdgeWeightedDigraph([[2, 2, 2], [1]], [[10, 5, 15], [7]]);
187-
<immutable multidigraph with 2 vertices, 4 edges>
187+
<immutable edge-weighted multidigraph with 2 vertices, 4 edges>
188188
gap> EdgeWeightedDigraphShortestPaths(d, 1);
189189
rec( distances := [ 0, 5 ], edges := [ fail, 2 ], parents := [ fail, 1 ] )
190190

191191
# Shortest paths: negative edges
192192
gap> d := EdgeWeightedDigraph([[2], [1]], [[-2], [7]]);
193-
<immutable digraph with 2 vertices, 2 edges>
193+
<immutable edge-weighted digraph with 2 vertices, 2 edges>
194194
gap> EdgeWeightedDigraphShortestPaths(d, 1);
195195
rec( distances := [ 0, -2 ], edges := [ fail, 1 ], parents := [ fail, 1 ] )
196196

197197
# Shortest paths: parallel negative edges
198198
gap> d := EdgeWeightedDigraph([[2, 2, 2], [1]], [[-2, -3, -4], [7]]);
199-
<immutable multidigraph with 2 vertices, 4 edges>
199+
<immutable edge-weighted multidigraph with 2 vertices, 4 edges>
200200
gap> EdgeWeightedDigraphShortestPaths(d, 1);
201201
rec( distances := [ 0, -4 ], edges := [ fail, 3 ], parents := [ fail, 1 ] )
202202

203203
# Shortest paths: negative cycle
204204
gap> d := EdgeWeightedDigraph([[2, 2, 2], [1]], [[-10, 5, -15], [7]]);
205-
<immutable multidigraph with 2 vertices, 4 edges>
205+
<immutable edge-weighted multidigraph with 2 vertices, 4 edges>
206206
gap> EdgeWeightedDigraphShortestPaths(d, 1);
207207
Error, no method found! For debugging hints type ?Recovery from NoMethodFound
208208
Error, no 2nd choice method found for `EdgeWeightedDigraphShortestPaths' on 2 \
209209
arguments
210210
211211
# Shortest paths: source not in graph
212212
gap> d := EdgeWeightedDigraph([[2], [1]], [[2], [7]]);
213-
<immutable digraph with 2 vertices, 2 edges>
213+
<immutable edge-weighted digraph with 2 vertices, 2 edges>
214214
gap> EdgeWeightedDigraphShortestPaths(d, 3);
215215
Error, the 2nd argument <source> must be a vertex of the 1st argument <D>,
216216
gap> EdgeWeightedDigraphShortestPath(d, 3, 1);
@@ -220,7 +220,7 @@ Error, the 3rd argument <dest> must be a vertex of the 1st argument <D>,
220220
221221
# Shortest paths: no path exists
222222
gap> d := EdgeWeightedDigraph([[1], [2]], [[5], [10]]);
223-
<immutable digraph with 2 vertices, 2 edges>
223+
<immutable edge-weighted digraph with 2 vertices, 2 edges>
224224
gap> EdgeWeightedDigraphShortestPaths(d, 1);
225225
rec( distances := [ 0, fail ], edges := [ fail, fail ],
226226
parents := [ fail, fail ] )
@@ -229,7 +229,7 @@ fail
229229
230230
# Shortest paths: no path exists with negative edge weight
231231
gap> d := EdgeWeightedDigraph([[2], [2], []], [[-5], [10], []]);
232-
<immutable digraph with 3 vertices, 2 edges>
232+
<immutable edge-weighted digraph with 3 vertices, 2 edges>
233233
gap> r := EdgeWeightedDigraphShortestPaths(d, 1);;
234234
gap> r.distances = [0, -5, fail];
235235
true
@@ -240,7 +240,7 @@ true
240240
241241
# Shortest paths: parallel edges
242242
gap> d := EdgeWeightedDigraph([[2, 2, 2], []], [[3, 2, 1], []]);
243-
<immutable multidigraph with 2 vertices, 3 edges>
243+
<immutable edge-weighted multidigraph with 2 vertices, 3 edges>
244244
gap> EdgeWeightedDigraphShortestPaths(d, 1);
245245
rec( distances := [ 0, 1 ], edges := [ fail, 3 ], parents := [ fail, 1 ] )
246246
gap> EdgeWeightedDigraphShortestPaths(d);
@@ -252,7 +252,7 @@ gap> EdgeWeightedDigraphShortestPath(d, 1, 2);
252252
253253
# Shortest paths: negative cycle
254254
gap> d := EdgeWeightedDigraph([[2], [3], [1]], [[-3], [-5], [-7]]);
255-
<immutable digraph with 3 vertices, 3 edges>
255+
<immutable edge-weighted digraph with 3 vertices, 3 edges>
256256
gap> EdgeWeightedDigraphShortestPaths(d);
257257
Error, no method found! For debugging hints type ?Recovery from NoMethodFound
258258
Error, no 2nd choice method found for `EdgeWeightedDigraphShortestPaths' on 1 \
@@ -271,7 +271,7 @@ fail
271271
272272
# Shortest paths: Johnson
273273
gap> d := EdgeWeightedDigraph([[2], [3], [], [], []], [[3], [5], [], [], []]);
274-
<immutable digraph with 5 vertices, 2 edges>
274+
<immutable edge-weighted digraph with 5 vertices, 2 edges>
275275
gap> EdgeWeightedDigraphShortestPaths(d, 1);
276276
rec( distances := [ 0, 3, 8, fail, fail ], edges := [ fail, 1, 1, fail, fail ]
277277
, parents := [ fail, 1, 2, fail, fail ] )
@@ -296,61 +296,61 @@ gap> EdgeWeightedDigraphShortestPath(d, 1, 3);
296296
297297
# Maximum flow: empty digraphs
298298
gap> d := EdgeWeightedDigraph([], []);
299-
<immutable empty digraph with 0 vertices>
299+
<immutable edge-weighted empty digraph with 0 vertices>
300300
gap> DigraphMaximumFlow(d, 1, 1);
301301
Error, <start> must be a vertex of <D>,
302302
303303
# Maximum flow: single vertex (also empty digraphs)
304304
gap> d := EdgeWeightedDigraph([[]], [[]]);
305-
<immutable empty digraph with 1 vertex>
305+
<immutable edge-weighted empty digraph with 1 vertex>
306306
gap> DigraphMaximumFlow(d, 1, 1);
307307
[ [ ] ]
308308
309309
# Maximum flow: source = dest
310310
gap> d := EdgeWeightedDigraph([[2], []], [[5], []]);
311-
<immutable digraph with 2 vertices, 1 edge>
311+
<immutable edge-weighted digraph with 2 vertices, 1 edge>
312312
gap> DigraphMaximumFlow(d, 1, 1);
313313
[ [ 0 ], [ ] ]
314314
315315
# Maximum flow: has loop
316316
gap> d := EdgeWeightedDigraph([[1, 2], []], [[5, 10], []]);
317-
<immutable digraph with 2 vertices, 2 edges>
317+
<immutable edge-weighted digraph with 2 vertices, 2 edges>
318318
gap> DigraphMaximumFlow(d, 1, 2);
319319
[ [ 0, 10 ], [ ] ]
320320
321321
# Maximum flow: invalid source
322322
gap> d := EdgeWeightedDigraph([[1, 2], []], [[5, 10], []]);
323-
<immutable digraph with 2 vertices, 2 edges>
323+
<immutable edge-weighted digraph with 2 vertices, 2 edges>
324324
gap> DigraphMaximumFlow(d, 5, 2);
325325
Error, <start> must be a vertex of <D>,
326326
327327
# Maximum flow: invalid sink
328328
gap> d := EdgeWeightedDigraph([[1, 2], []], [[5, 10], []]);
329-
<immutable digraph with 2 vertices, 2 edges>
329+
<immutable edge-weighted digraph with 2 vertices, 2 edges>
330330
gap> DigraphMaximumFlow(d, 1, 5);
331331
Error, <destination> must be a vertex of <D>,
332332
333333
# Maximum flow: sink not reachable
334334
gap> d := EdgeWeightedDigraph([[1], []], [[5], []]);
335-
<immutable digraph with 2 vertices, 1 edge>
335+
<immutable edge-weighted digraph with 2 vertices, 1 edge>
336336
gap> DigraphMaximumFlow(d, 1, 2);
337337
[ [ 0 ], [ ] ]
338338
339339
# Maximum flow: source has in neighbours
340340
gap> d := EdgeWeightedDigraph([[2], [3], []], [[5], [10], []]);
341-
<immutable digraph with 3 vertices, 2 edges>
341+
<immutable edge-weighted digraph with 3 vertices, 2 edges>
342342
gap> DigraphMaximumFlow(d, 2, 3);
343343
[ [ 0 ], [ 10 ], [ ] ]
344344
345345
# Maximum flow: sink has out-neighbours
346346
gap> d := EdgeWeightedDigraph([[2], [3], [2]], [[5], [10], [7]]);
347-
<immutable digraph with 3 vertices, 3 edges>
347+
<immutable edge-weighted digraph with 3 vertices, 3 edges>
348348
gap> DigraphMaximumFlow(d, 2, 3);
349349
[ [ 0 ], [ 10 ], [ 0 ] ]
350350
351351
# Maximum flow: cycle
352352
gap> d := EdgeWeightedDigraph([[2], [3], [1]], [[5], [10], [7]]);
353-
<immutable digraph with 3 vertices, 3 edges>
353+
<immutable edge-weighted digraph with 3 vertices, 3 edges>
354354
gap> DigraphMaximumFlow(d, 1, 3);
355355
[ [ 5 ], [ 5 ], [ 0 ] ]
356356

0 commit comments

Comments
 (0)