@@ -109,6 +109,22 @@ gap> gr := DigraphRemoveEdge(gr, [2, 1]);
109
109
gap> DigraphEdges(gr);
110
110
[ [ 1 , 2 ] ]
111
111
112
+ # DigraphRemoveAllEdges: for a digraph
113
+ gap> gr := Digraph(IsImmutableDigraph, [[ 2 , 3 ] , [ 3 ] , [ 4 ] , []] );
114
+ < immutable digraph with 4 vertices, 4 edges>
115
+ gap> DigraphRemoveAllEdges(gr);
116
+ Error, Argument must be a mutable digraph
117
+ gap> gr2 := Digraph(IsMutableDigraph, [[ 2 , 3 ] , [ 3 ] , [ 4 ] , []] );
118
+ < mutable digraph with 4 vertices, 4 edges>
119
+ gap> DigraphRemoveAllEdges(gr2);
120
+ < mutable empty digraph with 4 vertices>
121
+ gap> gr3 := Digraph(IsMutableDigraph, [[] , [] , [] , []] );
122
+ < mutable empty digraph with 4 vertices>
123
+ gap> DigraphRemoveAllEdges(gr3);
124
+ < mutable empty digraph with 4 vertices>
125
+ gap> OutNeighbours(gr3);
126
+ [ [ ] , [ ] , [ ] , [ ] ]
127
+
112
128
# OnDigraphs: for a digraph and a perm
113
129
gap> gr := Digraph([[ 2 ] , [ 1 ] , [ 3 ]] );
114
130
< immutable digraph with 3 vertices, 3 edges>
@@ -2523,6 +2539,40 @@ gap> OutNeighbours(last);
2523
2539
gap> LexicographicProduct(ChainDigraph(3 ), CycleDigraph(7 ));
2524
2540
< immutable digraph with 21 vertices, 119 edges>
2525
2541
2542
+ # SwapDigraphs
2543
+ gap> D1 := Digraph([[ 2 , 3 , 4 ] , [ 1 , 3 , 4 , 5 ] , [ 1 , 2 ] , [ 5 ] , [ 4 ]] );
2544
+ < immutable digraph with 5 vertices, 11 edges>
2545
+ gap> D2 := Digraph(IsMutableDigraph, [[ 4 ] ,[ 5 ] ,[ 1 ,2 ] ,[] ,[]] );
2546
+ < mutable digraph with 5 vertices, 4 edges>
2547
+ gap> SwapDigraphs(D1, D2);
2548
+ Error, Arguments must be mutable digraphs
2549
+ gap> D1 := Digraph(IsMutableDigraph, [[ 2 , 3 , 4 ] , [ 1 , 3 , 4 , 5 ] , [ 1 , 2 ] , [ 5 ] , [ 4 ]] );
2550
+ < mutable digraph with 5 vertices, 11 edges>
2551
+ gap> SwapDigraphs(D1, D2);
2552
+ gap> OutNeighbours(D1);
2553
+ [ [ 4 ] , [ 5 ] , [ 1 , 2 ] , [ ] , [ ] ]
2554
+ gap> OutNeighbours(D2);
2555
+ [ [ 2 , 3 , 4 ] , [ 1 , 3 , 4 , 5 ] , [ 1 , 2 ] , [ 5 ] , [ 4 ] ]
2556
+ gap> D3 := Digraph(IsMutableDigraph, [[ 2 ] ,[ 1 ] ,[ 2 ]] );
2557
+ < mutable digraph with 3 vertices, 3 edges>
2558
+ gap> SwapDigraphs(D1, D3);
2559
+ gap> OutNeighbours(D1);
2560
+ [ [ 2 ] , [ 1 ] , [ 2 ] ]
2561
+ gap> OutNeighbours(D3);
2562
+ [ [ 4 ] , [ 5 ] , [ 1 , 2 ] , [ ] , [ ] ]
2563
+ gap> SwapDigraphs(D1, D3);
2564
+ gap> OutNeighbours(D1);
2565
+ [ [ 4 ] , [ 5 ] , [ 1 , 2 ] , [ ] , [ ] ]
2566
+ gap> OutNeighbours(D3);
2567
+ [ [ 2 ] , [ 1 ] , [ 2 ] ]
2568
+ gap> D2 := Digraph(IsMutableDigraph, [[] ,[] ,[]] );
2569
+ < mutable empty digraph with 3 vertices>
2570
+ gap> SwapDigraphs(D3, D2);
2571
+ gap> OutNeighbours(D2);
2572
+ [ [ 2 ] , [ 1 ] , [ 2 ] ]
2573
+ gap> OutNeighbours(D3);
2574
+ [ [ ] , [ ] , [ ] ]
2575
+
2526
2576
# DigraphShortestPathSpanningTree
2527
2577
gap> D := Digraph([[ 2 , 3 , 4 ] , [ 1 , 3 , 4 , 5 ] , [ 1 , 2 ] , [ 5 ] , [ 4 ]] );
2528
2578
< immutable digraph with 5 vertices, 11 edges>
0 commit comments