Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quelle  attr.tst   Sprache: unbekannt

 
Spracherkennung für: .tst vermutete Sprache: Unknown {[0] [0] [0]} [Methode: Schwerpunktbildung, einfache Gewichte, sechs Dimensionen]

#############################################################################
##
#W  standard/attr.tst
#Y  Copyright (C) 2014-24                                James D. Mitchell
##                                                          Wilf A. Wilson
##
##  Licensing information can be found in the README file of this package.
##
#############################################################################
##

#@local A, B, D, D1, D2
#@local G, H, M, M1, P, S, a, adj, adj1, adj2, adjacencies, b
#@local circuit, complete15, comps, cycle12, e, edgeCut, erev, filename, forest
#@local g, gNew, gr, gr1, gr2, gr3, gr4, grid, group, i, id, isGraph, j, mat
#@local multiple, names, nbs, nonPlanar, order, planar, probs, proj, r, rd
#@local reflextrans, reflextrans1, reflextrans2, representatives, rev, rgr
#@local rotationSy, rotationSystem, scc, schreierVector, sink, soccer, str
#@local temp, topo, trans, trans1, trans2, tree, wcc, x, y, z
gap> START_TEST("Digraphs package: standard/attr.tst");
gap> LoadPackage("digraphs", false);;

#
gap> DIGRAPHS_StartTest();

# DigraphKings: for a digraph
gap> gr := Digraph([[2], [34], [14], [1]]);
<immutable digraph with 4 vertices, 6 edges>
gap> DigraphKings(gr, 2);
123 ]
gap> gr := Digraph([[], [34], [14], [1]]);
<immutable digraph with 4 vertices, 5 edges>
gap> DigraphKings(gr, 2);
Error, the 1st argument <D> must be a tournament,
gap> gr := RandomTournament(10);
<immutable tournament with 10 vertices>
gap> Length(DigraphKings(gr, 2)) >= 1;
true
gap> Length(DigraphKings(gr, 2)) <> 2;
true

#  DigraphSource and DigraphRange
gap> nbs := [[12221711011], [23212116],
>  [1552211128101], [211523523824],
>  [20172525], [5242252], [11819],
>  [182013311], [15181210], [823152581917],
>  [192172118], [9473], [14102], [112414],
>  [221], [12], [92119], [21241688], [3], [56],
>  [142], [242420], [19820], [71215139],
>  [161219]];;
gap> gr := Digraph(nbs);
<immutable multidigraph with 25 vertices, 100 edges>
gap> HasDigraphSource(gr);
false
gap> HasDigraphRange(gr);
false
gap> DigraphNrVertices(gr);
25
gap> DigraphSource(gr);
1111112222333333334444444
  555566666777888889999101010
  10101010111111111112121212131313141414
  15151617171717181818181819202021212222
  22232323242424242424252525 ]
gap> HasDigraphSource(gr);
true
gap> HasDigraphRange(gr);
true
gap> DigraphRange(gr);
122217110112321211615522111281012115
  2352382420172525524225211819182013
  3111518121082315258191719217211894
  73141021124142211292119212416883
  561422424201982071215139161219 ]
gap> gr := Digraph(nbs);
<immutable multidigraph with 25 vertices, 100 edges>
gap> HasDigraphSource(gr);
false
gap> HasDigraphRange(gr);
false
gap> DigraphRange(gr);
122217110112321211615522111281012115
  2352382420172525524225211819182013
  3111518121082315258191719217211894
  73141021124142211292119212416883
  561422424201982071215139161219 ]
gap> HasDigraphSource(gr);
true
gap> HasDigraphRange(gr);
true
gap> DigraphSource(gr);
1111112222333333334444444
  555566666777888889999101010
  10101010111111111112121212131313141414
  15151617171717181818181819202021212222
  22232323242424242424252525 ]

#  DigraphDual
gap> gr := Digraph([[67], [69], [134589],
> [123456710], [156710], [245910],
> [345678910], [135789], [125],
> [124678]]);;
gap> OutNeighbours(DigraphDual(gr));
[ [ 123458910 ], [ 123457810 ], [ 26710 ], 
  [ 89 ], [ 23489 ], [ 13678 ], [ 12 ], [ 24610 ], 
  [ 34678910 ], [ 35910 ] ]
gap> gr := Digraph(rec(DigraphVertices := ["a", "b"],
> DigraphSource := ["b", "b"], DigraphRange := ["a", "a"]));
<immutable multidigraph with 2 vertices, 2 edges>
gap> DigraphDual(gr);
Error, the argument <D> must be a digraph with no multiple edges,
gap> DigraphDual(DigraphMutableCopy(gr));
Error, the argument <D> must be a digraph with no multiple edges,
gap> gr := Digraph([]);
<immutable empty digraph with 0 vertices>
gap> DigraphDual(gr);
<immutable empty digraph with 0 vertices>
gap> DigraphDual(gr);
<immutable empty digraph with 0 vertices>
gap> gr := Digraph([[], []]);
<immutable empty digraph with 2 vertices>
gap> DigraphDual(gr);
<immutable digraph with 2 vertices, 4 edges>
gap> gr := Digraph(rec(DigraphNrVertices := 2,
>                      DigraphSource := [],
>                      DigraphRange := []));
<immutable empty digraph with 2 vertices>
gap> DigraphDual(gr);
<immutable digraph with 2 vertices, 4 edges>
gap> gr := Digraph([[22], []]);
<immutable multidigraph with 2 vertices, 2 edges>
gap> DigraphDual(gr);
Error, the argument <D> must be a digraph with no multiple edges,
gap> r := rec(DigraphNrVertices := 6,
> DigraphSource := [222222444],
> DigraphRange := [123456345]);;
gap> gr := Digraph(r);
<immutable digraph with 6 vertices, 9 edges>
gap> DigraphDual(gr);
<immutable digraph with 6 vertices, 27 edges>
gap> r := rec(DigraphNrVertices := 4, DigraphSource := [], DigraphRange := []);;
gap> gr := Digraph(r);
<immutable empty digraph with 4 vertices>
gap> DigraphDual(gr);
<immutable digraph with 4 vertices, 16 edges>
gap> gr := Digraph(r);;
gap> SetDigraphVertexLabels(gr, [4321]);
gap> gr2 := DigraphDual(gr);;
gap> DigraphVertexLabels(gr2);
4321 ]
gap> DigraphNrVertices(gr2);
4
gap> gr := Digraph([[1], [13], [12]]);
<immutable digraph with 3 vertices, 5 edges>
gap> DigraphGroup(gr) = Group((23));
true
gap> gr2 := DigraphDual(gr);
<immutable digraph with 3 vertices, 4 edges>
gap> OutNeighbours(gr2);
[ [ 23 ], [ 2 ], [ 3 ] ]
gap> HasDigraphGroup(gr2);
true
gap> DigraphGroup(gr2) = Group((23));
true
gap> DigraphGroup(gr2) = DigraphGroup(gr);
true

#  AdjacencyMatrix
gap> gr := Digraph(rec(DigraphNrVertices := 10,
> DigraphSource := [11111111],
> DigraphRange := [22334455]));
<immutable multidigraph with 10 vertices, 8 edges>
gap> AdjacencyMatrix(gr);
[ [ 0222200000 ], [ 0000000000 ], 
  [ 0000000000 ], [ 0000000000 ], 
  [ 0000000000 ], [ 0000000000 ], 
  [ 0000000000 ], [ 0000000000 ], 
  [ 0000000000 ], [ 0000000000 ] ]
gap> AdjacencyMatrix(Digraph([[]]));
[ [ 0 ] ]
gap> AdjacencyMatrix(Digraph([]));
[  ]
gap> r := rec(DigraphNrVertices := 7,
> DigraphSource := [11223445677],
> DigraphRange := [34246672755]);;
gap> gr := Digraph(r);
<immutable multidigraph with 7 vertices, 11 edges>
gap> adj1 := AdjacencyMatrix(gr);
[ [ 0011000 ], [ 0101000 ], [ 0000010 ], 
  [ 0000011 ], [ 0100000 ], [ 0000001 ], 
  [ 0000200 ] ]
gap> gr := Digraph(OutNeighbours(gr));
<immutable multidigraph with 7 vertices, 11 edges>
gap> adj2 := AdjacencyMatrix(gr);
[ [ 0011000 ], [ 0101000 ], [ 0000010 ], 
  [ 0000011 ], [ 0100000 ], [ 0000001 ], 
  [ 0000200 ] ]
gap> adj1 = adj2;
true
gap> r := rec(DigraphNrVertices := 1,
>             DigraphSource := [11],
>             DigraphRange := [11]);;
gap> gr := Digraph(r);
<immutable multidigraph with 1 vertex, 2 edges>
gap> adj1 := AdjacencyMatrix(gr);
[ [ 2 ] ]
gap> gr := Digraph(OutNeighbours(gr));
<immutable multidigraph with 1 vertex, 2 edges>
gap> adj2 := AdjacencyMatrix(gr);
[ [ 2 ] ]
gap> adj1 = adj2;
true
gap> AdjacencyMatrix(Digraph([]));
[  ]
gap> AdjacencyMatrix(Digraph(rec(DigraphNrVertices := 0,
>                                DigraphSource     := [],
>                                DigraphRange      := [])));
[  ]

#  DigraphNrAdjacencies
gap> G := Digraph([[134567101214151617192021222326282930], 
>  [23467811131417181920212223242627282930],
>  [12456910121415172022242526272830],
>  [12345678101112131415161819202122232425262829],
>  [146791011121415161819202122232425282930],
>  [1567101112131516171819202122232526282930],
>  [12345689101113151618192122232526272830],
>  [256891012131415192021222324252629],
>  [15691213141618202122232425262930],
>  [12346789101113151618192021222528],
>  [123567891112131415161819202123242526272829],
>  [125911121314151617181920212223242627282930],
>  [134589101416171819212223242627282930],
>  [23456789121314151617181920212223242526282930],
>  [1234678101112131416172022232425262728],
>  [136810111314151819202122232425262728],
>  [123678101112131416171819202223262730],
>  [1346789101112131415171819202122232425262830],
>  [13456101113141518192021222425272829],
>  [124789101118202122232425262830],
>  [1234510111213141819202122242526282930],
>  [135789101213141718192124262930],
>  [23456789101114161718192021232425272829],
>  [1236891112141617182022252627282930],
>  [12345891011121314151618192021242527282930],
>  [1256710121314151619202124252627282930],
>  [12456791013171820212324252627282930],
>  [1347891112131416171920212324262729],
>  [14567810111213151617182021232425272830],
>  [1567891011121415181920212224272829]]);;
gap> DigraphNrAdjacencies(G) * 2 - DigraphNrLoops(G) = 
> DigraphNrEdges(DigraphSymmetricClosure(G));
true
gap> DigraphNrAdjacenciesWithoutLoops(G) * 2 + DigraphNrLoops(G) = 
> DigraphNrEdges(DigraphSymmetricClosure(G));
true

#  DigraphTopologicalSort
gap> r := rec(DigraphNrVertices := 20000,
>             DigraphSource     := [],
>             DigraphRange      := []);;
gap> for i in [1 .. 9999] do
>   Add(r.DigraphSource, i);
>   Add(r.DigraphRange, i + 1);
> od;
> Add(r.DigraphSource, 10000);; Add(r.DigraphRange, 20000);;
> Add(r.DigraphSource, 10001);; Add(r.DigraphRange, 1);;
> for i in [10001 .. 19999] do
>   Add(r.DigraphSource, i);
>   Add(r.DigraphRange, i + 1);
> od;
gap> circuit := Digraph(r);
<immutable digraph with 20000 vertices, 20000 edges>
gap> topo := DigraphTopologicalSort(circuit);;
gap> Length(topo);
20000
gap> topo[1] = 20000;
true
gap> topo[20000] = 10001;
true
gap> topo[12345];
17656
gap> gr := Digraph([[2], [1]]);
<immutable digraph with 2 vertices, 2 edges>
gap> DigraphTopologicalSort(gr);
fail
gap> r := rec(DigraphNrVertices := 2,
>             DigraphSource := [11],
>             DigraphRange := [22]);;
gap> multiple := Digraph(r);;
gap> DigraphTopologicalSort(multiple);
21 ]
gap> gr := Digraph([]);
<immutable empty digraph with 0 vertices>
gap> DigraphTopologicalSort(gr);
[  ]
gap> gr := Digraph([[]]);
<immutable empty digraph with 1 vertex>
gap> DigraphTopologicalSort(gr);
1 ]
gap> gr := Digraph([[1]]);
<immutable digraph with 1 vertex, 1 edge>
gap> DigraphTopologicalSort(gr);
1 ]
gap> gr := Digraph([[2], [1]]);
<immutable digraph with 2 vertices, 2 edges>
gap> DigraphTopologicalSort(gr);
fail
gap> r := rec(DigraphNrVertices := 8,
> DigraphSource := [1112344577],
> DigraphRange := [4348226748]);;
gap> grid := Digraph(r);;
gap> DigraphTopologicalSort(grid);
82643175 ]
gap> adj := [[3], [], [234], []];;
gap> gr := Digraph(adj);
<immutable digraph with 4 vertices, 4 edges>
gap> IsAcyclicDigraph(gr);
false
gap> DigraphTopologicalSort(gr);
2431 ]
gap> gr := Digraph([
> [7], [], [], [6], [], [3], [], [], [515], [], [],
> [6], [19], [], [11], [13], [], [17], [], [17]]);
<immutable digraph with 20 vertices, 11 edges>
gap> DigraphTopologicalSort(gr);
7123645811159101219131416171820 ]
gap> gr := Digraph([[2], [], []]);
<immutable digraph with 3 vertices, 1 edge>
gap> DigraphTopologicalSort(gr);
213 ]

#  DigraphStronglyConnectedComponents

# <gr> is Digraph(RightCayleyGraphSemigroup) of the gens:
# [Transformation([133]),
#  Transformation([212]),
#  Transformation([221])];;
gap> adj := [
> [11111], [31011], [31110], [6911], [7811],
> [6119], [7118], [12511], [13411], [14211],
> [15111], [12115], [13114], [14112], [15111]];;
gap> gr := Digraph(adj);
<immutable multidigraph with 15 vertices, 45 edges>
gap> DigraphStronglyConnectedComponents(gr);
rec( 
  comps := [ [ 11115 ], [ 231014 ], [ 46913 ], 
      [ 57812 ] ], id := [ 122343443214321 
     ] )
gap> adj := [[345710], [4510], [1247], [29],
> [4589], [13456], [1246],
> [12345679], [248], [456811], [10]];;
gap> gr := Digraph(adj);
<immutable digraph with 11 vertices, 44 edges>
gap> scc := DigraphStronglyConnectedComponents(gr);
rec( comps := [ [ 1324985671011 ] ], 
  id := [ 11111111111 ] )
gap> gr := Digraph([]);
<immutable empty digraph with 0 vertices>
gap> DigraphStronglyConnectedComponents(gr);
rec( comps := [  ], id := [  ] )
gap> r := rec(DigraphNrVertices := 9,
> DigraphRange := [17694825893948113],
> DigraphSource := [11224456667788999]);;
gap> gr := Digraph(r);
<immutable multidigraph with 9 vertices, 17 edges>
gap> scc := DigraphStronglyConnectedComponents(gr);
rec( comps := [ [ 3 ], [ 179 ], [ 84 ], [ 265 ] ], 
  id := [ 241344232 ] )
gap> wcc := DigraphConnectedComponents(gr);
rec( comps := [ [ 123456789 ] ], 
  id := [ 111111111 ] )
gap> scc := DigraphStronglyConnectedComponents(circuit);;
gap> Length(scc.comps);
20000
gap> Length(scc.comps) = DigraphNrVertices(circuit);
true
gap> gr := CycleDigraph(10);
<immutable cycle digraph with 10 vertices>
gap> gr2 := DigraphRemoveEdge(gr, 101);
<immutable digraph with 10 vertices, 9 edges>
gap> IsStronglyConnectedDigraph(gr);
true
gap> DigraphStronglyConnectedComponents(gr);
rec( comps := [ [ 12345678910 ] ], 
  id := [ 1111111111 ] )
gap> IsAcyclicDigraph(gr2);
true
gap> DigraphStronglyConnectedComponents(gr2);
rec( comps := [ [ 1 ], [ 2 ], [ 3 ], [ 4 ], [ 5 ], [ 6 ], [ 7 ], [ 8 ], 
      [ 9 ], [ 10 ] ], id := [ 12345678910 ] )

#  DigraphNrStronglyConnectedComponents
gap> D := CycleDigraph(10);;
gap> for i in [1 .. 50] do
> D := DigraphDisjointUnion(D, CycleDigraph(10));
> od;
gap> DigraphNrStronglyConnectedComponents(D);
51
gap> D := CayleyDigraph(SymmetricGroup(6));;
gap> DigraphNrStronglyConnectedComponents(D);
1
gap> D := Digraph([[23], [145], [3], [25], [6], [35]]);;
gap> DigraphNrStronglyConnectedComponents(D);
3
gap>  D := Digraph([[]]);;
gap> DigraphNrStronglyConnectedComponents(D);
1
gap> D := EmptyDigraph(0);;
gap> DigraphNrStronglyConnectedComponents(D);
0

#  DigraphConnectedComponents
gap> gr := Digraph([[12], [1], [2], [5], []]);
<immutable digraph with 5 vertices, 5 edges>
gap> wcc := DigraphConnectedComponents(gr);
rec( comps := [ [ 123 ], [ 45 ] ], id := [ 11122 ] )
gap> gr := Digraph([]);
<immutable empty digraph with 0 vertices>
gap> DigraphConnectedComponents(gr);
rec( comps := [  ], id := [  ] )
gap> gr := Digraph([[]]);
<immutable empty digraph with 1 vertex>
gap> DigraphConnectedComponents(gr);
rec( comps := [ [ 1 ] ], id := [ 1 ] )
gap> gr := Digraph([[1], [2], [3], [4]]);
<immutable digraph with 4 vertices, 4 edges>
gap> DigraphConnectedComponents(gr);
rec( comps := [ [ 1 ], [ 2 ], [ 3 ], [ 4 ] ], id := [ 1234 ] )
gap> gr := Digraph([[345789], [14589510],
> [2456710], [6], [111789], [2268], [156910],
> [3467], [1235], [57]]);
<immutable multidigraph with 10 vertices, 45 edges>
gap> DigraphConnectedComponents(gr);
rec( comps := [ [ 12345678910 ] ], 
  id := [ 1111111111 ] )
gap> gr := Digraph(rec(
> DigraphNrVertices := 100,
> DigraphSource     := [89111112131414181922273132,
>                       3234374045485052585858596060,
>                       65667375798181838486868996100,
>                       100100],
> DigraphRange      := [5462285570372032531642666313,
>                       73893654582648365665789596,
>                       97601166661979211329789810044,
>                       5369]));
<immutable digraph with 100 vertices, 44 edges>
gap> OutNeighbours(gr);
[ [  ], [  ], [  ], [  ], [  ], [  ], [  ], [ 54 ], [ 62 ], [  ], [ 2855 ], 
  [ 70 ], [ 37 ], [ 2032 ], [  ], [  ], [  ], [ 53 ], [ 16 ], [  ], [  ], 
  [ 42 ], [  ], [  ], [  ], [  ], [ 66 ], [  ], [  ], [  ], [ 63 ], 
  [ 1373 ], [  ], [ 89 ], [  ], [  ], [ 36 ], [  ], [  ], [ 5 ], [  ], 
  [  ], [  ], [  ], [ 4 ], [  ], [  ], [ 58 ], [  ], [ 26 ], [  ], [ 48 ], 
  [  ], [  ], [  ], [  ], [  ], [ 365665 ], [ 78 ], [ 9596 ], [  ], 
  [  ], [  ], [  ], [ 97 ], [ 60 ], [  ], [  ], [  ], [  ], [  ], [  ], 
  [ 11 ], [  ], [ 66 ], [  ], [  ], [  ], [ 66 ], [  ], [ 1979 ], [  ], 
  [ 21 ], [ 13 ], [  ], [ 2978 ], [  ], [  ], [ 98 ], [  ], [  ], [  ], 
  [  ], [  ], [  ], [ 100 ], [  ], [  ], [  ], [ 445369 ] ]
gap> DigraphConnectedComponents(gr);
rec( comps := [ [ 1 ], [ 2 ], [ 3 ], [ 445 ], [ 540 ], [ 6 ], [ 7 ], 
      [ 854 ], [ 962 ], [ 10 ], 
      [ 1113142028323637485255565865738497 ], 
      [ 1270 ], [ 15 ], 
      [ 1618192744536066697579819596100 ], 
      [ 17 ], [ 2183 ], [ 2242 ], [ 23 ], [ 24 ], [ 25 ], [ 2650 ], 
      [ 29597886 ], [ 30 ], [ 3163 ], [ 33 ], [ 348998 ], [ 35 ], 
      [ 38 ], [ 39 ], [ 41 ], [ 43 ], [ 46 ], [ 47 ], [ 49 ], [ 51 ], [ 57 ], 
      [ 61 ], [ 64 ], [ 67 ], [ 68 ], [ 71 ], [ 72 ], [ 74 ], [ 76 ], [ 77 ], 
      [ 80 ], [ 82 ], [ 85 ], [ 87 ], [ 88 ], [ 90 ], [ 91 ], [ 92 ], [ 93 ], 
      [ 94 ], [ 99 ] ], 
  id := [ 12345678910111211111314151414
      111617181920211411222324112526271111
      282953017311443233113421351114811
      11361122143792438111439401412414211
      431444452214461447161148224950265152
      535455141411265614 ] )

#  DigraphShortestDistances
gap> adj := Concatenation(List([1 .. 11], x -> [x + 1]), [[1]]);;
gap> cycle12 := Digraph(adj);
<immutable digraph with 12 vertices, 12 edges>
gap> mat := DigraphShortestDistances(cycle12);;
gap> Display(mat);
[ [   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11 ],
  [  11,   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10 ],
  [  10,  11,   0,   1,   2,   3,   4,   5,   6,   7,   8,   9 ],
  [   9,  10,  11,   0,   1,   2,   3,   4,   5,   6,   7,   8 ],
  [   8,   9,  10,  11,   0,   1,   2,   3,   4,   5,   6,   7 ],
  [   7,   8,   9,  10,  11,   0,   1,   2,   3,   4,   5,   6 ],
  [   6,   7,   8,   9,  10,  11,   0,   1,   2,   3,   4,   5 ],
  [   5,   6,   7,   8,   9,  10,  11,   0,   1,   2,   3,   4 ],
  [   4,   5,   6,   7,   8,   9,  10,  11,   0,   1,   2,   3 ],
  [   3,   4,   5,   6,   7,   8,   9,  10,  11,   0,   1,   2 ],
  [   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,   0,   1 ],
  [   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,   0 ] ]
gap> DigraphShortestDistances(Digraph([]));
[  ]
gap> mat := DigraphShortestDistances(Digraph([[], []]));
[ [ 0, fail ], [ fail, 0 ] ]
gap> r := rec(DigraphVertices := [1 .. 15],
>             DigraphSource   := [],
>             DigraphRange    := []);;
gap> for i in [1 .. 15] do
>   for j in [1 .. 15] do
>     Add(r.DigraphSource, i);
>     Add(r.DigraphRange, j);
>   od;
> od;
gap> complete15 := Digraph(r);
<immutable digraph with 15 vertices, 225 edges>
gap> Display(DigraphShortestDistances(complete15));
[ [  0,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1 ],
  [  1,  0,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1 ],
  [  1,  1,  0,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1 ],
  [  1,  1,  1,  0,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1 ],
  [  1,  1,  1,  1,  0,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1 ],
  [  1,  1,  1,  1,  1,  0,  1,  1,  1,  1,  1,  1,  1,  1,  1 ],
  [  1,  1,  1,  1,  1,  1,  0,  1,  1,  1,  1,  1,  1,  1,  1 ],
  [  1,  1,  1,  1,  1,  1,  1,  0,  1,  1,  1,  1,  1,  1,  1 ],
  [  1,  1,  1,  1,  1,  1,  1,  1,  0,  1,  1,  1,  1,  1,  1 ],
  [  1,  1,  1,  1,  1,  1,  1,  1,  1,  0,  1,  1,  1,  1,  1 ],
  [  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  0,  1,  1,  1,  1 ],
  [  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  0,  1,  1,  1 ],
  [  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  0,  1,  1 ],
  [  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  0,  1 ],
  [  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  0 ] ]
gap> r := rec(DigraphNrVertices := 7,
>             DigraphRange      := [35546253372],
>             DigraphSource     := [11122334557]);;
gap> gr := Digraph(r);
<immutable multidigraph with 7 vertices, 11 edges>
gap> Display(DigraphShortestDistances(gr));
[ [     0,     2,     1,     3,     1,     3,     2 ],
  [  fail,     0,     2,     1,     3,     1,     4 ],
  [  fail,     1,     0,     2,     1,     2,     2 ],
  [  fail,     2,     1,     0,     2,     3,     3 ],
  [  fail,     2,     1,     3,     0,     3,     1 ],
  [  fail,  fail,  fail,  fail,  fail,     0,  fail ],
  [  fail,     1,     3,     2,     4,     2,     0 ] ]

#  DigraphShortestDistances, using connectivity data
gap> gr := CycleDigraph(3);;
gap> DIGRAPHS_ConnectivityData(gr);
[  ]
gap> DigraphShortestDistances(gr);
[ [ 012 ], [ 201 ], [ 120 ] ]
gap> gr := CompleteDigraph(3);;
gap> DIGRAPH_ConnectivityDataForVertex(gr, 2);;
gap> DigraphShortestDistances(gr);
[ [ 011 ], [ 101 ], [ 110 ] ]

#  OutNeighbours and InNeighbours
gap> gr := Digraph(rec(DigraphNrVertices := 10,
>                      DigraphSource := [1155710],
>                      DigraphRange := [3311071]));
<immutable multidigraph with 10 vertices, 6 edges>
gap> InNeighbours(gr);
[ [ 510 ], [  ], [ 11 ], [  ], [  ], [  ], [ 7 ], [  ], [  ], [ 5 ] ]
gap> OutNeighbours(gr);
[ [ 33 ], [  ], [  ], [  ], [ 110 ], [  ], [ 7 ], [  ], [  ], [ 1 ] ]
gap> gr := Digraph([[114], [234], [2444], [2]]);
<immutable multidigraph with 4 vertices, 11 edges>
gap> InNeighbours(gr);
[ [ 11 ], [ 234 ], [ 2 ], [ 12333 ] ]
gap> OutNeighbours(gr);
[ [ 114 ], [ 234 ], [ 2444 ], [ 2 ] ]

#  OutDegree and OutDegreeSequence and InDegrees and InDegreeSequence
gap> r := rec(DigraphNrVertices := 0, DigraphSource := [], DigraphRange := []);;
gap> gr1 := Digraph(r);
<immutable empty digraph with 0 vertices>
gap> OutDegrees(gr1);
[  ]
gap> OutDegreeSequence(gr1);
[  ]
gap> InDegrees(gr1);
[  ]
gap> InDegreeSequence(gr1);
[  ]
gap> gr2 := Digraph([]);
<immutable empty digraph with 0 vertices>
gap> OutDegrees(gr2);
[  ]
gap> OutDegreeSequence(gr2);
[  ]
gap> InDegrees(gr2);
[  ]
gap> InDegreeSequence(gr2);
[  ]
gap> gr3 := Digraph([]);
<immutable empty digraph with 0 vertices>
gap> InNeighbours(gr3);
[  ]
gap> OutDegrees(gr3);
[  ]
gap> OutDegreeSequence(gr3);
[  ]
gap> InDegrees(gr3);
[  ]
gap> InDegreeSequence(gr3);
[  ]
gap> adj := [
> [671], [1336], [5], [14448], [13467],
> [77], [145657], [56]];;
gap> gr1 := Digraph(adj);
<immutable multidigraph with 8 vertices, 28 edges>
gap> OutDegrees(gr1);
34155262 ]
gap> OutDegreeSequence(gr1);
65543221 ]
gap> InDegrees(gr1);
50354551 ]
gap> InDegreeSequence(gr1);
55554310 ]
gap> gr2 := Digraph(adj);
<immutable multidigraph with 8 vertices, 28 edges>
gap> InNeighbours(gr2);;
gap> InDegrees(gr2);
50354551 ]
gap> InDegreeSequence(gr2);
55554310 ]
gap> r := rec(DigraphNrVertices := 8,
> DigraphSource := [11122223444445555566,
>                   77777788],
> DigraphRange := [67113365144481346777,
>                  14565756]);;
gap> gr3 := Digraph(r);
<immutable multidigraph with 8 vertices, 28 edges>
gap> OutDegrees(gr3);
34155262 ]
gap> OutDegreeSequence(gr3);
65543221 ]
gap> InDegrees(gr3);
50354551 ]
gap> InDegreeSequence(gr3);
55554310 ]
gap> OutDegrees(EmptyDigraph(5));
00000 ]
gap> InDegrees(EmptyDigraph(5));
00000 ]
gap> gr := EmptyDigraph(5);; OutNeighbours(gr);;
gap> OutDegrees(gr);
00000 ]
gap> gr := EmptyDigraph(5);; OutNeighbours(gr);;
gap> InDegrees(gr);
00000 ]

#  DigraphEdges
gap> r := rec(
> DigraphNrVertices := 5,
> DigraphSource := [112355],
> DigraphRange := [143522]);
rec( DigraphNrVertices := 5, DigraphRange := [ 143522 ], 
  DigraphSource := [ 112355 ] )
gap> gr := Digraph(r);
<immutable multidigraph with 5 vertices, 6 edges>
gap> DigraphEdges(gr);
[ [ 11 ], [ 14 ], [ 23 ], [ 35 ], [ 52 ], [ 52 ] ]
gap> gr := Digraph([[4], [2313], [33], [], [145]]);
<immutable multidigraph with 5 vertices, 10 edges>
gap> DigraphEdges(gr);
[ [ 14 ], [ 22 ], [ 23 ], [ 21 ], [ 23 ], [ 33 ], [ 33 ], 
  [ 51 ], [ 54 ], [ 55 ] ]
gap> gr := Digraph([[123568], [6678], [123467],
> [235627], [5655], [328], [157], [67]]);
<immutable multidigraph with 8 vertices, 34 edges>
gap> DigraphEdges(gr);
[ [ 11 ], [ 12 ], [ 13 ], [ 15 ], [ 16 ], [ 18 ], [ 26 ], 
  [ 26 ], [ 27 ], [ 28 ], [ 31 ], [ 32 ], [ 33 ], [ 34 ], 
  [ 36 ], [ 37 ], [ 42 ], [ 43 ], [ 45 ], [ 46 ], [ 42 ], 
  [ 47 ], [ 55 ], [ 56 ], [ 55 ], [ 55 ], [ 63 ], [ 62 ], 
  [ 68 ], [ 71 ], [ 75 ], [ 77 ], [ 86 ], [ 87 ] ]

#  DigraphSources and DigraphSinks
gap> r := rec(DigraphNrVertices := 10,
> DigraphSource := [223335777799999],
> DigraphRange := [226824268685824]);;
gap> gr := Digraph(r);
<immutable multidigraph with 10 vertices, 15 edges>
gap> DigraphSinks(gr);
146810 ]
gap> DigraphSources(gr);
137910 ]
gap> gr := Digraph(OutNeighbours(gr));;
gap> DigraphSinks(gr);
146810 ]
gap> DigraphSources(gr);
137910 ]
gap> gr := Digraph(r);;
gap> InNeighbours(gr);
[ [  ], [ 22379 ], [  ], [ 59 ], [ 9 ], [ 377 ], [  ], 
  [ 3799 ], [  ], [  ] ]
gap> DigraphSinks(gr);
146810 ]
gap> DigraphSources(gr);
137910 ]
gap> gr := Digraph(r);;
gap> OutDegrees(gr);
0230104050 ]
gap> InDegrees(gr);
0502130400 ]
gap> DigraphSinks(gr);
146810 ]
gap> DigraphSources(gr);
137910 ]

#  DigraphPeriod
gap> gr := EmptyDigraph(100);
<immutable empty digraph with 100 vertices>
gap> DigraphPeriod(gr);
0
gap> gr := CompleteDigraph(100);
<immutable complete digraph with 100 vertices>
gap> DigraphPeriod(gr);
1
gap> gr := Digraph([[22], [3], [4], [1]]);
<immutable multidigraph with 4 vertices, 5 edges>
gap> DigraphPeriod(gr);
4
gap> gr := Digraph([[2], [3], [4], []]);
<immutable digraph with 4 vertices, 3 edges>
gap> HasIsAcyclicDigraph(gr);
false
gap> DigraphPeriod(gr);
0
gap> HasIsAcyclicDigraph(gr);
true
gap> IsAcyclicDigraph(gr);
true
gap> gr := Digraph([[2], [3], [4], []]);
<immutable digraph with 4 vertices, 3 edges>
gap> IsAcyclicDigraph(gr);
true
gap> DigraphPeriod(gr);
0

#  DigraphDiameter 1
gap> gr := Digraph([[2], []]);;
gap> DigraphDiameter(gr);
fail
gap> gr := Digraph([[2], [3], [45], [5], [1]]);;
gap> DigraphDiameter(gr);
4
gap> gr := Digraph([[12], [1]]);;
gap> DigraphDiameter(gr);
1
gap> gr := Digraph([[2], [3], []]);;
gap> IsStronglyConnectedDigraph(gr);
false
gap> DigraphDiameter(gr);
fail
gap> gr := Digraph([[1]]);;
gap> DigraphDiameter(gr);
0
gap> gr := EmptyDigraph(0);;
gap> DigraphDiameter(gr);
fail
gap> gr := EmptyDigraph(1);;
gap> DigraphDiameter(gr);
0

#  DigraphDiameter 2
# For a digraph (not strongly connected) with too many vertices for
# Floyd-Warshall
gap> str := Concatenation(
> ".~?Ng_k?QDoFG]?MaO?IHoBwu?`cGBQPGAXD_Ic]AaKO^xO`\\dMD}VGYwcq}DTKWSsq?mrRAP",
> "BmZ?]HlAACzLoWSv_ur`EvMSE[y@VrIfWAU]GkH{AlgAEU_W?yBbBg[FqaGUII?kguBW^{xiO?G",
> "hOGIdOP`SsmHBR?OdL`SCDGhRgLLNPfs~AJSWYh@hHtICFSoHlR`KTQ@aREU{hxZr|_^B}kW}Yt",
> "?jeLGam?Fix`mcvVgW`Zy}Axj}Dub[}ZAD]c}VIp@HxeuOEOMmqOFyDuTDxX[aDfpAsEd@YSO\\",
> "kQUpSloModdnANU~H\\[cXpkxEVN@X\\GcdNjkCMH~]?^DYJpf^nMHq|Gzw]F^nW?YVP@XTBLHy",
> "Sa}X[GrVu?X^kLT~OerEoCDqD_aKBAlIt_cp[bkEaVMhQFA?qJITjogWqVuDokD|oyIMExukP?w",
> "bEPjCqEWvclpQKOlTB[UcTp__A~S^zepSpkLAFDS[\\Gcbq[vGGd{aCldib^HAPKdGHqWWjI?oB",
> "exQHZdWdp^{_Qdq@dkCkUWVVed^XJKXviPXLR@diWXAj_f[rUdYTPTxtQHKPOJMGCPCxwNjfkoq",
> "]kVVNrng?RUYHju^mO^IWHO[GQUsQE[bdOXSpwDmWMz\\i|GCKORhKhedO[eqsmfNRGUlLiQ_{B",
> "fB{X|PA{_@BjTGOpRYjPrGNTq]lW@SPVjG|}lOMyvITjkyAchhs@u?SYx]oqtZDLFDrX@NGDzJB",
> "jbvXySCvs^Ja`BYof|kfF`mGe[hErQiGTB?Ul{R|oH|vEES}YO[IVDqxm_D`]|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YNe~PoZ}epn}ZGwsXaHWDC\\__]pu{CwKKDBWFEBoQByocL^A`_r^wWEEVMCeEowW]GBa?WtQ",
> "Jus?kHM^Cx@kSgFpUOrE@_iXwrP@bTBEMQ[DHpuPCzsW[^AcGe_fGAL{aaoGQ^zHQDkeC`dPIRI",
> "?~cDxWGPdgQUV_acjJj?UAwPKpBAJdEAThMBPF}rKRCkEY?_B@rUNhBeZRVxqI{VjM`QkLoTroD",
> "Kv]]aPEFsCbyDWfXCh]sMEFPP~iKDKsYLX@{mjcYPC|hlJufqOqGKhiSu]iCCykKxj?^CDLYHxt",
> "oUjVXz\\]`Ht}@OUUoRFoAAeLeN_f\\a`Og{XnXPqsKyzspk{gDILhEmqrl\\YMuPDRJS^Y|PEv",
> "S~uDvATYWdr\\UW~vMKw\\}hltFLv[Hc^`gLwDLrp\\hZM|PYbQa]PakE}R|gYvukN[v?bXvDwM",
> "[IUnBP\\pjV|^uIX}mHinwiXt[^DqS{YBAFzb`]mNDEetTu|nGr]G~xONpRNJTzznttBozPzMXA",
> "?`QTPUbJW~[uO^VASUqTsK_wvrsptNhEdcyCR?skjP~eFyIDIoUQwGxi_zOtavRPqqjOhgR_RAY",
> "v|RJ[dripPXn|XFXY^@y_mmg{z?L?biatW\\cNrClQnXtqWfYBSiEE}mufCz]AsGv[QUDY`GS^?",
> "yswWQOzoAWWU?SsRbzwJDW~^qDv?{CZl@L{ge]EUCvUFc{ABDCNG]VpWWCEPLObx@F|nhMuQ`En",
> "zrGWcfubY^STJVft{lYsHxV?|ERyp|OhyXckj|gmJbxykH?fAddpSmp}Nvjc[pCc^POcVkr^}tQ",
> "Rz`W~nsXUbTMwIcNpD@r]n`{_APJKFiU}UO|gJ[ZhJXj}stivsAumX}e?MAPhcZkZfYQgqx|[l^",
> "WGOsZDfHNmBwze{E~aj~oF~~Ch`^Nx`K^");;
gap> gr := DigraphFromDiSparse6String(str);
<immutable digraph with 1000 vertices, 1053 edges>
gap> DigraphDiameter(gr);
fail

#  DigraphSymmetricClosure
gap> gr1 := Digraph([[2], [1]]);
<immutable digraph with 2 vertices, 2 edges>
gap> IsSymmetricDigraph(gr1);
true
gap> gr2 := DigraphSymmetricClosure(gr1);
<immutable symmetric digraph with 2 vertices, 2 edges>
gap> IsIdenticalObj(gr1, gr2);
true
gap> gr1 = gr2;
true
gap> gr1 := Digraph([[1111]]);
<immutable multidigraph with 1 vertex, 4 edges>
gap> gr2 := DigraphSymmetricClosure(gr1);
<immutable multidigraph with 1 vertex, 4 edges>
gap> IsIdenticalObj(gr1, gr2);
true
gap> gr1 = gr2;
true
gap> gr1 := Digraph(
> [[], [45], [12], [3], [2101112], [281012], [5],
> [1112], [12], [12], [2678], [3810]]);
<immutable digraph with 12 vertices, 24 edges>
gap> IsSymmetricDigraph(gr1);
false
gap> gr2 := DigraphSymmetricClosure(gr1);
<immutable symmetric digraph with 12 vertices, 38 edges>
gap> HasIsSymmetricDigraph(gr2);
true
gap> IsSymmetricDigraph(gr2);
true
gap> gr3 := Digraph(
> [[], [45116], [412], [23], [21011127],
> [81012211], [511], [11126], [12], [5612],
> [76258], [1053869]]);;
gap> gr2 = gr3;
true
gap> gr := DigraphSymmetricClosure(ChainDigraph(10000));
<immutable symmetric digraph with 10000 vertices, 19998 edges>
gap> IsSymmetricDigraph(gr);
true
gap> gr := DigraphCopy(gr);
<immutable digraph with 10000 vertices, 19998 edges>
gap> IsSymmetricDigraph(gr);
true

#  Digraph(Reflexive)TransitiveClosure
gap> gr := Digraph(rec(DigraphNrVertices := 2,
>                      DigraphSource := [11],
>                      DigraphRange := [22]));
<immutable multidigraph with 2 vertices, 2 edges>
gap> DigraphReflexiveTransitiveClosure(gr);
Error, the argument <D> must be a digraph with no multiple edges,
gap> DigraphTransitiveClosure(gr);
Error, the argument <D> must be a digraph with no multiple edges,
gap> r := rec(DigraphVertices := [1 .. 4], DigraphSource := [11234],
> DigraphRange := [12341]);;
gap> gr := Digraph(r);
<immutable digraph with 4 vertices, 5 edges>
gap> IsAcyclicDigraph(gr);
false
gap> DigraphTopologicalSort(gr);
fail
gap> gr1 := DigraphTransitiveClosure(gr);
<immutable transitive digraph with 4 vertices, 16 edges>
gap> gr2 := DigraphReflexiveTransitiveClosure(gr);
<immutable preorder digraph with 4 vertices, 16 edges>
gap> gr1 = gr2;
true
gap> gr1 = DigraphReflexiveTransitiveClosure(DigraphMutableCopy(gr));
true
gap> adj := [[26], [3], [7], [3], [], [27], [5]];;
gap> gr := Digraph(adj);
<immutable digraph with 7 vertices, 8 edges>
gap> IsAcyclicDigraph(gr);
true
gap> gr1 := DigraphTransitiveClosure(gr);
<immutable transitive digraph with 7 vertices, 18 edges>
gap> gr2 := DigraphReflexiveTransitiveClosure(DigraphImmutableCopy(gr));
<immutable preorder digraph with 7 vertices, 25 edges>
gap> gr := Digraph([[2], [3], [4], [3]]);
<immutable digraph with 4 vertices, 4 edges>
gap> gr1 := DigraphTransitiveClosure(gr);
<immutable transitive digraph with 4 vertices, 9 edges>
gap> gr2 := DigraphReflexiveTransitiveClosure(gr);
<immutable preorder digraph with 4 vertices, 11 edges>
gap> gr := Digraph([[2], [3], [45], [], [5]]);
<immutable digraph with 5 vertices, 5 edges>
gap> gr1 := DigraphTransitiveClosure(gr);
<immutable transitive digraph with 5 vertices, 10 edges>
gap> gr2 := DigraphReflexiveTransitiveClosure(gr);
<immutable preorder digraph with 5 vertices, 14 edges>
gap> gr := Digraph(
> [[145678], [57891013], [24610],
>  [791011], [7910121315], [781013], [1011],
>  [7101213141516], [710111416], [11], [11],
>  [71314], [1011], [71011], [71316], [71011]]);
<immutable digraph with 16 vertices, 60 edges>
gap> trans1 := DigraphTransitiveClosure(gr);
<immutable transitive digraph with 16 vertices, 98 edges>
gap> trans2 := DigraphByAdjacencyMatrix(DIGRAPH_TRANS_CLOSURE(gr));
<immutable digraph with 16 vertices, 98 edges>
gap> trans1 = trans2;
true
gap> trans := Digraph(OutNeighbours(trans1));
<immutable digraph with 16 vertices, 98 edges>
gap> IsReflexiveDigraph(trans);
false
gap> IsTransitiveDigraph(trans);
true
gap> IS_TRANSITIVE_DIGRAPH(trans);
true
gap> reflextrans1 := DigraphReflexiveTransitiveClosure(gr);
<immutable preorder digraph with 16 vertices, 112 edges>
gap> reflextrans2 :=
> DigraphByAdjacencyMatrix(DIGRAPH_REFLEX_TRANS_CLOSURE(gr));
<immutable digraph with 16 vertices, 112 edges>
gap> reflextrans1 = reflextrans2;
true
gap> reflextrans := Digraph(OutNeighbours(reflextrans1));
<immutable digraph with 16 vertices, 112 edges>
gap> IsReflexiveDigraph(reflextrans);
true
gap> IsTransitiveDigraph(reflextrans);
true
gap> IS_TRANSITIVE_DIGRAPH(reflextrans);
true

#  ReducedDigraph
gap> gr := EmptyDigraph(0);;
gap> ReducedDigraph(gr) = gr;
true
gap> DigraphEdges(ReducedDigraph(Digraph(IsMutableDigraph, [[2], []])));
[ [ 12 ] ]
gap> gr := Digraph([[24261], [], [], [214], [],
> [1777], [46]]);
<immutable multidigraph with 7 vertices, 14 edges>
gap> rd := ReducedDigraph(gr);
<immutable multidigraph with 5 vertices, 14 edges>
gap> DigraphVertexLabels(rd);
12467 ]
gap> gr := CompleteDigraph(10);
<immutable complete digraph with 10 vertices>
gap> rd := ReducedDigraph(gr);
<immutable complete digraph with 10 vertices>
gap> rd = gr;
true
gap> DigraphVertexLabels(gr) = DigraphVertexLabels(rd);
true
gap> gr := Digraph([[], [42], [], [3]]);
<immutable digraph with 4 vertices, 3 edges>
gap> SetDigraphVertexLabels(gr, ["one", "two", "three", "four"]);
gap> rd := ReducedDigraph(gr);
<immutable digraph with 3 vertices, 3 edges>
gap> DigraphVertexLabels(gr);
[ "one", "two", "three", "four" ]
gap> DigraphVertexLabels(rd);
[ "two", "three", "four" ]
gap> gr := Digraph([[], [42], [], [3]]);
<immutable digraph with 4 vertices, 3 edges>
gap> SetDigraphEdgeLabels(gr, [[], ["a", "b"], [], ["c"]]);
gap> rd := ReducedDigraph(gr);
<immutable digraph with 3 vertices, 3 edges>
gap> DigraphEdgeLabels(gr);
[ [  ], [ "a", "b" ], [  ], [ "c" ] ]
gap> DigraphEdgeLabels(rd);
[ [ "a", "b" ], [  ], [ "c" ] ]

#  DigraphAllSimpleCircuits
gap> gr := Digraph([]);;
gap> DigraphAllSimpleCircuits(gr);
[  ]
gap> gr := ChainDigraph(4);;
gap> DigraphAllSimpleCircuits(gr);
[  ]
gap> gr := CompleteDigraph(2);;
gap> DigraphAllSimpleCircuits(gr);
[ [ 12 ] ]
gap> gr := CompleteDigraph(3);;
gap> DigraphAllSimpleCircuits(gr);
[ [ 12 ], [ 123 ], [ 13 ], [ 132 ], [ 23 ] ]
gap> gr := Digraph(["a", "b"], ["a", "b"], ["b", "a"]);
<immutable digraph with 2 vertices, 2 edges>
gap> DigraphAllSimpleCircuits(gr);
[ [ 12 ] ]
gap> gr := Digraph([[], [3], [24], [54], [4]]);
<immutable digraph with 5 vertices, 6 edges>
gap> DigraphAllSimpleCircuits(gr);
[ [ 4 ], [ 45 ], [ 23 ] ]
gap> gr := Digraph([[], [], [], [4], [], [], [8], [7]]);
<immutable digraph with 8 vertices, 3 edges>
gap> DigraphAllSimpleCircuits(gr);
[ [ 4 ], [ 78 ] ]
gap> gr := Digraph([[12], [21]]);
<immutable digraph with 2 vertices, 4 edges>
gap> DigraphAllSimpleCircuits(gr);
[ [ 1 ], [ 2 ], [ 12 ] ]
gap> gr := Digraph([[4], [13], [12], [23]]);;
gap> DigraphAllSimpleCircuits(gr);
[ [ 142 ], [ 1423 ], [ 143 ], [ 1432 ], [ 23 ] ]
gap> gr := Digraph([[367], [368], [123678],
> [2348], [234567], [13457], [2368],
> [1238]]);;
gap> Length(DigraphAllSimpleCircuits(gr));
259

#  DigraphAllUndirectedSimpleCircuits
gap> gr := Digraph([]);;
gap> DigraphAllUndirectedSimpleCircuits(gr);
[  ]
gap> gr := ChainDigraph(4);;
gap> DigraphAllUndirectedSimpleCircuits(gr);
[  ]
gap> gr := CompleteDigraph(2);;
gap> DigraphAllUndirectedSimpleCircuits(gr);
[  ]
gap> gr := CompleteDigraph(3);;
gap> DigraphAllUndirectedSimpleCircuits(gr);
[ [ 123 ] ]
gap> gr := Digraph([[], [3], [24], [54], [4]]);
<immutable digraph with 5 vertices, 6 edges>
gap> DigraphAllUndirectedSimpleCircuits(gr);
[ [ 4 ] ]
gap> gr := Digraph([[12], [21]]);
<immutable digraph with 2 vertices, 4 edges>
gap> DigraphAllUndirectedSimpleCircuits(gr);
[ [ 1 ], [ 2 ] ]
gap> gr := Digraph([[4], [13], [12], [23]]);;
gap> DigraphAllUndirectedSimpleCircuits(gr);
[ [ 123 ], [ 1234 ], [ 124 ], [ 1243 ], [ 1324 ], 
  [ 134 ], [ 234 ] ]
gap> gr := Digraph([[367], [368], [123678],
> [2348], [234567], [13457], [2368],
> [1238]]);;
gap> Length(DigraphAllUndirectedSimpleCircuits(gr));
1330

# DigraphAllChordlessCycles
gap> gr := Digraph([]);;
gap> DigraphAllChordlessCycles(gr);
[  ]
gap> gr := ChainDigraph(4);;
gap> DigraphAllChordlessCycles(gr);
[  ]
gap> D := CycleDigraph(3);;
gap> DigraphAllChordlessCycles(D);
[ [ 213 ] ]
gap> D := CompleteDigraph(4);;
gap> DigraphAllChordlessCycles(D);
[ [ 213 ], [ 214 ], [ 314 ], [ 324 ] ]
gap> D := Digraph([[245], [36], [47], [8], [68], [7], [8], []]);;
gap> DigraphAllChordlessCycles(D);
[ [ 6587 ], [ 348562 ], [ 3487 ], [ 1485 ], 
  [ 148762 ], [ 1432 ], [ 143765 ], [ 3267 ], 
  [ 2156 ], [ 215873 ] ]

# check that DigraphAllChordlessCycles do not change the input graph
gap> g := Digraph([[237], [148], [149], [2310], [679], [5810],
>                  [851], [762], [5103], [694]]);;
gap> DigraphAllChordlessCycles(g);
[ [ 7865 ], [ 65910 ], [ 34106571 ], 
  [ 34106871 ], [ 34109 ], [ 24106571 ], 
  [ 241068 ], [ 24109578 ], [ 24109571 ], 
  [ 3421 ], [ 3428759 ], [ 3428659 ], 
  [ 31786109 ], [ 31759 ], [ 2178 ], 
  [ 3128659 ], [ 31286109 ] ]
gap> DigraphAllUndirectedSimpleCircuits(g);
[ [ 1243 ], [ 124395687 ], [ 1243957 ], 
  [ 1243910657 ], [ 1243910687 ], 
  [ 12410657 ], [ 124106593 ], 
  [ 12410687 ], [ 12410687593 ], 
  [ 1241093 ], [ 1241095687 ], 
  [ 12410957 ], [ 128657 ], [ 1286593 ], 
  [ 1286591043 ], [ 12861043 ], 
  [ 12861043957 ], [ 12861093 ], 
  [ 128610957 ], [ 1287 ], [ 1287561043 ],
  [ 1287561093 ], [ 1287593 ], 
  [ 1287591043 ], [ 13428657 ], 
  [ 13428610957 ], [ 134287 ], 
  [ 13410657 ], [ 13410687 ], 
  [ 1341095687 ], [ 13410957 ], 
  [ 1395687 ], [ 13956104287 ], 
  [ 13957 ], [ 13910428657 ], 
  [ 139104287 ], [ 13910657 ], 
  [ 13910687 ], [ 2439568 ], [ 2439578 ], 
  [ 2439106578 ], [ 24391068 ], 
  [ 24106578 ], [ 241068 ], [ 24109568 ], 
  [ 24109578 ], [ 4395610 ], 
  [ 439578610 ], [ 43910 ], [ 5687 ], 
  [ 95610 ], [ 9578610 ] ]

# FacialCycles
gap> g := Digraph([]);;
gap> rotationSy := [];;
gap> FacialWalks(g, rotationSy);
[  ]
gap> g := Digraph([[2], [13], [24], [3]]);;;
gap> rotationSy := [[2], [13], [24], [3]];;
gap> FacialWalks(g, rotationSy);
[ [ 123432 ] ]
gap> g := CycleDigraph(4);;
gap> planar := PlanarEmbedding(g);
[ [ 2 ], [ 3 ], [ 4 ], [ 1 ] ]
gap> FacialWalks(g, planar);
[ [ 1234 ] ]
gap> nonPlanar := [[24], [13], [24], [13]];;
gap> FacialWalks(g, nonPlanar);
[ [ 1234 ] ]
gap> g := CompleteMultipartiteDigraph([222]);;
gap> rotationSystem := PlanarEmbedding(g);
[ [ 3546 ], [ 6453 ], [ 6251 ], [ 1526 ], 
  [ 1324 ], [ 1423 ] ]
gap> FacialWalks(g, rotationSystem);
[ [ 136 ], [ 145 ], [ 153 ], [ 164 ], [ 235 ], 
  [ 246 ], [ 254 ], [ 263 ] ]
gap> g := Digraph([[234], [135], [124], [135], [246], [579], [6810], [7910], [6810], [789]]);;
gap> rotationSy := PlanarEmbedding(g);
[ [ 243 ], [ 351 ], [ 142 ], [ 153 ], [ 246 ], 
  [ 579 ], [ 8106 ], [ 9107 ], [ 6108 ], [ 789 ] ]
gap> FacialWalks(g, rotationSy);
[ [ 123 ], [ 134 ], [ 1456789652 ], [ 2543 ], 
  [ 69107 ], [ 7108 ], [ 8109 ] ]

#  Issue #676
gap> D := Digraph([[], [3], []]);;
gap> SetDigraphVertexLabels(D, ["one", "two", "three"]);
gap> DigraphAllSimpleCircuits(D);
[  ]

#  DigraphLongestSimpleCircuit
gap> gr := Digraph([]);;
gap> DigraphLongestSimpleCircuit(gr);
fail
gap> gr := Digraph([[], [2]]);;
gap> DigraphLongestSimpleCircuit(gr);
2 ]
gap> gr := Digraph([[], [3], [24], [54], [4]]);;
gap> DigraphLongestSimpleCircuit(gr);
45 ]
gap> gr := ChainDigraph(10);;
gap> DigraphLongestSimpleCircuit(gr);
fail
gap> gr := Digraph([[3], [1], [14], [11]]);;
gap> DigraphLongestSimpleCircuit(gr);
134 ]
gap> gr := Digraph([[2610], [3], [4], [5], [1],
>                   [7], [8], [9], [1], [11], [12], [13], [1]]);;
gap> DigraphLongestSimpleCircuit(gr);
12345 ]
gap> gr := Digraph([[2610], [3], [4], [5], [1],
>                   [7], [8], [9], [1], [11], [12], [113], [14], [1]]);;
gap> DigraphLongestSimpleCircuit(gr);
11011121314 ]

#  AsTransformation
gap> gr := Digraph([[2], [13], [4], [3]]);;
gap> AsTransformation(gr);
fail
gap> gr := AsDigraph(Transformation([111]), 5);
<immutable functional digraph with 5 vertices>
gap> DigraphEdges(gr);
[ [ 11 ], [ 21 ], [ 31 ], [ 44 ], [ 55 ] ]
gap> AsTransformation(gr);
Transformation( [ 111 ] )

#  DigraphBicomponents
gap> DigraphBicomponents(EmptyDigraph(0));
fail
gap> DigraphBicomponents(EmptyDigraph(1));
fail
gap> DigraphBicomponents(EmptyDigraph(2));
[ [ 1 ], [ 2 ] ]
gap> DigraphBicomponents(EmptyDigraph(3));
[ [ 12 ], [ 3 ] ]
gap> DigraphBicomponents(EmptyDigraph(4));
[ [ 123 ], [ 4 ] ]
gap> DigraphBicomponents(CompleteBipartiteDigraph(35));
[ [ 123 ], [ 45678 ] ]
gap> DigraphBicomponents(Digraph([[2], [], [], [3]]));
[ [ 13 ], [ 24 ] ]
gap> DigraphBicomponents(CycleDigraph(3));
fail

#  DigraphLoops
gap> gr := ChainDigraph(4);;
gap> DigraphHasLoops(gr);
false
gap> DigraphLoops(gr);
[  ]
gap> gr := Digraph([[2], [1]]);;
gap> DigraphLoops(gr);
[  ]
gap> gr := Digraph([[156], [13456], [134], [246], [2],
> [145]]);
<immutable digraph with 6 vertices, 18 edges>
gap> DigraphLoops(gr);
134 ]

#  Out/InDegreeSequence with known automorphsims and sets
gap> gr := Digraph([[2345], [], [], [], []]);;
gap> OutDegrees(gr);
40000 ]
gap> InDegrees(gr);
01111 ]
gap> InDegreeSet(gr);
01 ]
gap> OutDegrees(gr);
40000 ]
gap> OutDegreeSet(gr);
04 ]
gap> gr := Digraph([[2345], [], [], [], []]);;
gap> InNeighbours(gr);;
gap> DigraphGroup(gr);
Group([ (4,5), (3,4), (2,3) ])
gap> InDegreeSequence(gr);
11110 ]
gap> gr := DigraphSymmetricClosure(ChainDigraph(4));;
gap> DigraphGroup(gr);
Group([ (1,4)(2,3) ])
gap> HasDigraphGroup(gr);
true
gap> OutDegreeSequence(gr);
2211 ]

#  Diameter and UndirectedGirth with known automorphisms
gap> gr := Digraph([[2345], [], [], [], []]);;
gap> DigraphGroup(gr);
Group([ (4,5), (3,4), (2,3) ])
gap> DigraphDiameter(gr);
fail
gap> gr := Digraph([[2345], [6], [6], [6], [6], [1]]);;
gap> DigraphGroup(gr);
Group([ (4,5), (3,4), (2,3) ])
gap> DigraphDiameter(gr);
3
gap> gr := DigraphSymmetricClosure(CycleDigraph(7));;
gap> DigraphUndirectedGirth(gr);
7
gap> DigraphDiameter(gr);
3
gap> DigraphGroup(gr) = DihedralGroup(IsPermGroup, 14);
true
gap> gr := DigraphSymmetricClosure(DigraphAddEdge(CycleDigraph(7), 12));;
gap> IsMultiDigraph(gr);
true
gap> SetDigraphGroup(gr, Group((12)(37)(46)));
gap> DigraphDiameter(gr);
3
gap> DigraphUndirectedGirth(gr);
2
gap> gr := DigraphSymmetricClosure(CycleDigraph(7));;
gap> DigraphDiameter(gr);
3
gap> DigraphUndirectedGirth(gr);
7
gap> DigraphGroup(gr) = DihedralGroup(IsPermGroup, 14);
true
gap> gr := Digraph([[], [3], [2]]);;
gap> DigraphUndirectedGirth(gr);
infinity
gap> DigraphDiameter(gr);
fail
gap> gr := Digraph([[24], [13], [23], [15], [45]]);;
gap> DigraphGroup(gr);
Group([ (2,4)(3,5) ])
gap> DigraphDiameter(gr);
4
gap> DigraphUndirectedGirth(gr);
1
gap> gr := Digraph([[2244], [113], [2], [115], [4]]);
<immutable multidigraph with 5 vertices, 12 edges>
gap> DigraphDiameter(gr);
4
gap> DigraphUndirectedGirth(gr);
2
gap> gr := EmptyDigraph(0);;
gap> DigraphUndirectedGirth(gr);
infinity
gap> DigraphDiameter(gr);
fail

#  DigraphBooleanAdjacencyMatrix
gap> gr := CompleteDigraph(4);;
gap> mat := BooleanAdjacencyMatrix(gr);
[ [ false, true, true, true ], [ true, false, true, true ], 
  [ true, true, false, true ], [ true, true, true, false ] ]
gap> IsSymmetricDigraph(gr) and mat = TransposedMat(mat);
true
gap> gr := EmptyDigraph(5);;
gap> mat := BooleanAdjacencyMatrix(gr);
[ [ false, false, false, false, false ], [ false, false, false, false, false ]
    , [ false, false, false, false, false ], 
  [ false, false, false, false, false ], 
  [ false, false, false, false, false ] ]
gap> IsSymmetricDigraph(gr) and mat = TransposedMat(mat);
true
gap> gr := CycleDigraph(4);;
gap> mat := BooleanAdjacencyMatrix(gr);
[ [ false, true, false, false ], [ false, false, true, false ], 
  [ false, false, false, true ], [ true, false, false, false ] ]
gap> not (IsSymmetricDigraph(gr) or mat = TransposedMat(mat));
true
gap> gr := ChainDigraph(4);;
gap> mat := BooleanAdjacencyMatrix(gr);
[ [ false, true, false, false ], [ false, false, true, false ], 
  [ false, false, false, true ], [ false, false, false, false ] ]
gap> not (IsSymmetricDigraph(gr) or mat = TransposedMat(mat));
true
gap> gr := Digraph([
> [1468], [2810], [4], [16], [67], [12410],
> [3], [3], [18], [25]]);;
gap> mat := BooleanAdjacencyMatrix(gr);
[ [ true, false, false, true, false, true, false, true, false, false ], 
  [ false, true, false, false, false, false, false, true, false, true ], 
  [ false, false, false, true, false, false, false, false, false, false ], 
  [ true, false, false, false, false, true, false, false, false, false ], 
  [ false, false, false, false, false, true, true, false, false, false ], 
  [ true, true, false, true, false, false, false, false, false, true ], 
  [ false, false, true, false, false, false, false, false, false, false ], 
  [ false, false, true, false, false, false, false, false, false, false ], 
  [ true, false, false, false, false, false, false, true, false, false ], 
  [ false, true, false, false, true, false, false, false, false, false ] ]
gap> gr = DigraphByAdjacencyMatrix(mat);
true

#  DigraphUndirectedGirth: easy cases
gap> gr := Digraph([[2], [3], []]);;
gap> DigraphUndirectedGirth(gr);
Error, the argument <D> must be a symmetric digraph,
gap> gr := Digraph([[2], [13], [23]]);;
gap> DigraphUndirectedGirth(gr);
1
gap> gr := Digraph([[22], [113], [2]]);;
gap> DigraphUndirectedGirth(gr);
2

#  DigraphGirth
gap> gr := Digraph([[1], [1]]);
<immutable digraph with 2 vertices, 2 edges>
gap> DigraphGirth(gr);
1
gap> gr := Digraph([[23], [3], [4], []]);
<immutable digraph with 4 vertices, 4 edges>
gap> DigraphGirth(gr);
infinity
gap> gr := Digraph([[23], [3], [4], [1]]);
<immutable digraph with 4 vertices, 5 edges>
gap> DigraphGirth(gr);
3
gap> gr := EmptyDigraph(42);;
gap> DigraphGirth(gr);
infinity
gap> gr := EmptyDigraph(0);;
gap> DigraphGirth(gr);
infinity
gap> gr := Digraph([[2], [1]]);;
gap> DigraphGirth(gr);
2
gap> DigraphUndirectedGirth(gr);
infinity
gap> gr := Digraph([[2], [1], [4], [56], [], []]);;
gap> DigraphGirth(gr);
2
gap> DigraphUndirectedGirth(gr);
Error, the argument <D> must be a symmetric digraph,

# DigraphOddGirth
gap> gr := Digraph([[23], [3], [1]]);
<immutable digraph with 3 vertices, 4 edges>
gap> DigraphOddGirth(gr);
3
gap> gr := Digraph([[2], [3], [], [3], [4]]);
<immutable digraph with 5 vertices, 4 edges>
gap> DigraphOddGirth(gr);
infinity
gap> gr := Digraph([[1]]);
<immutable digraph with 1 vertex, 1 edge>
gap> DigraphOddGirth(gr);
1
gap> gr := Digraph([[2], []]);
<immutable digraph with 2 vertices, 1 edge>
gap> DigraphOddGirth(gr);
infinity
gap> gr := CycleDigraph(4);
<immutable cycle digraph with 4 vertices>
gap> DigraphOddGirth(gr);
infinity
gap> gr := DigraphDisjointUnion(CycleDigraph(2), CycleDigraph(3));;
gap> for i in [1 .. 50] do
> gr := DigraphDisjointUnion(gr, CycleDigraph(3));
> od;
gap> DigraphOddGirth(gr);
3
gap> G := Digraph(IsMutableDigraph, [[]]);
<mutable empty digraph with 1 vertex>
gap> for i in [2 .. 200] do
>   DigraphAddVertex(G, i);
>   DigraphAddEdges(G, [[1, i], [i, 1]]);
> od;
gap> D := CycleDigraph(IsMutableDigraph, 7);
<mutable digraph with 7 vertices, 7 edges>
gap> for i in [1 .. 10] do
>   DigraphDisjointUnion(D, G);
> od;
gap> DigraphOddGirth(D);
7
gap> D := DigraphFromDigraph6String("&IWsC_A?_PG_GDKC?cO");
<immutable digraph with 10 vertices, 22 edges>
gap> DigraphGirth(D);
2
gap> DigraphOddGirth(D);
3

# DigraphMycielskian
gap> D1 := DigraphSymmetricClosure(CycleDigraph(2));
<immutable cycle digraph with 2 vertices>
gap> D2 := DigraphSymmetricClosure(CycleDigraph(5));
<immutable symmetric digraph with 5 vertices, 10 edges>
gap> IsIsomorphicDigraph(DigraphMycielskian(D1), D2);
true
gap> D := DigraphSymmetricClosure(CayleyDigraph(DihedralGroup(8)));
<immutable symmetric digraph with 8 vertices, 32 edges>
gap> ChromaticNumber(D);
4
gap> D := DigraphMycielskian(D);
<immutable digraph with 17 vertices, 112 edges>
gap> ChromaticNumber(D);
5
gap> D1 := Digraph([[], [3], [2]]);
<immutable digraph with 3 vertices, 2 edges>
gap> D2 := Digraph([[], [34], [25], [26], [36], [457], [6]]);
<immutable digraph with 7 vertices, 12 edges>
gap> IsIsomorphicDigraph(DigraphMycielskian(D1), D2);
true
gap> D := DigraphSymmetricClosure(CycleDigraph(5));
<immutable symmetric digraph with 5 vertices, 10 edges>
gap> D := DigraphMutableCopy(D);
<mutable digraph with 5 vertices, 10 edges>
gap> DigraphMycielskian(D);
<mutable digraph with 11 vertices, 40 edges>
gap> D := DigraphSymmetricClosure(Digraph([[12], [1]]));
<immutable symmetric digraph with 2 vertices, 3 edges>
gap> D := DigraphMutableCopy(D);
<mutable digraph with 2 vertices, 3 edges>
gap> DigraphMycielskian(D);
<mutable digraph with 5 vertices, 13 edges>
gap> D := DigraphEdgeUnion(CycleDigraph(3), CycleDigraph(3));
<immutable multidigraph with 3 vertices, 6 edges>
gap> DigraphMycielskian(D);
Error, the argument <D> must be a symmetric digraph with no multiple edges,
gap> DigraphMycielskian(DigraphMutableCopy(D));
Error, the argument <D> must be a symmetric digraph with no multiple edges,
gap> D := DigraphEdgeUnion(CompleteDigraph(3), CompleteDigraph(3));
<immutable multidigraph with 3 vertices, 12 edges>
gap> DigraphMycielskian(D);
Error, the argument <D> must be a symmetric digraph with no multiple edges,
gap> DigraphMycielskian(DigraphMutableCopy(D));
Error, the argument <D> must be a symmetric digraph with no multiple edges,

#  DigraphDegeneracy and DigraphDegeneracyOrdering
gap> gr := Digraph([[22], [11]]);;
gap> IsMultiDigraph(gr) and IsSymmetricDigraph(gr);
true
gap> DigraphDegeneracy(gr);
Error, the argument <D> must be a symmetric digraph with no multiple edges,
gap> DigraphDegeneracyOrdering(gr);
Error, the argument <D> must be a symmetric digraph with no multiple edges,
gap> gr := Digraph([[2], []]);
<immutable digraph with 2 vertices, 1 edge>
gap> not IsMultiDigraph(gr) and not IsSymmetricDigraph(gr);
true
gap> DigraphDegeneracy(gr);
Error, the argument <D> must be a symmetric digraph with no multiple edges,
gap> DigraphDegeneracyOrdering(gr);
Error, the argument <D> must be a symmetric digraph with no multiple edges,
gap> gr := CompleteDigraph(5);;
gap> DigraphDegeneracy(gr);
4
gap> DigraphDegeneracyOrdering(gr);
54321 ]
gap> gr := DigraphSymmetricClosure(ChainDigraph(4));
<immutable symmetric digraph with 4 vertices, 6 edges>
gap> DigraphDegeneracy(gr);
1
gap> DigraphDegeneracyOrdering(gr);
4321 ]
gap> gr := Digraph([[3], [], [1]]);
<immutable digraph with 3 vertices, 2 edges>
gap> DigraphDegeneracy(gr);
1
gap> gr := DigraphSymmetricClosure(Digraph(
> [[25], [35], [4], [56], [], []]));
<immutable symmetric digraph with 6 vertices, 14 edges>
gap> DigraphDegeneracy(gr);
2
gap> DigraphDegeneracyOrdering(gr);
643251 ]

#  DigraphGirth with known automorphisms
gap> gr := Digraph([[2345], [63], [62], [6], [6], [1]]);;
gap> DigraphGirth(gr);
2
gap> gr := Digraph([[2345], [63], [62], [6], [6], [1]]);;
gap> DigraphGroup(gr) = Group([(45), (23)]);
true
gap> DigraphGirth(gr);
2
gap> gr := Digraph([[2610], [3], [4], [5], [1],
>                   [7], [8], [9], [1], [11], [12], [13], [1]]);;
gap> DigraphGirth(gr);
5
gap> gr := Digraph([[2610], [3], [4], [5], [1],
>                   [7], [8], [9], [1], [11], [12], [13], [1]]);;
gap> DigraphGroup(gr);
Group([ (6,10)(7,11)(8,12)(9,13), (2,6)(3,7)(4,8)(5,9) ])
gap> DigraphGirth(gr);
5

#  MaximalSymmetricSubdigraph and MaximalSymmetricSubdigraphWithoutLoops
gap> gr := Digraph([[2], [1]]);;
gap> IsSymmetricDigraph(gr);
true
gap> MaximalSymmetricSubdigraph(gr) = gr;
true
gap> gr2 := Digraph([[22], [11]]);;
gap> IsSymmetricDigraph(gr2) and IsMultiDigraph(gr2);
true
gap> MaximalSymmetricSubdigraph(gr2) = gr;
true
gap> gr := Digraph([[23], [13], [4], [4]]);
<immutable digraph with 4 vertices, 6 edges>
gap> IsSymmetricDigraph(gr);
false
gap> gr2 := MaximalSymmetricSubdigraph(gr);
<immutable symmetric digraph with 4 vertices, 3 edges>
gap> OutNeighbours(gr2);
[ [ 2 ], [ 1 ], [  ], [ 4 ] ]
gap> gr2 := MaximalSymmetricSubdigraphWithoutLoops(gr);
<immutable symmetric digraph with 4 vertices, 2 edges>
gap> OutNeighbours(gr2);
[ [ 2 ], [ 1 ], [  ], [  ] ]
gap> gr := Digraph([[22], [11]]);
<immutable multidigraph with 2 vertices, 4 edges>
gap> gr2 := MaximalSymmetricSubdigraphWithoutLoops(gr);
<immutable symmetric digraph with 2 vertices, 2 edges>
gap> OutNeighbours(gr2);
[ [ 2 ], [ 1 ] ]
gap> gr := Digraph([[122], [11]]);
<immutable multidigraph with 2 vertices, 5 edges>
gap> IsSymmetricDigraph(gr);
true
gap> gr3 := MaximalSymmetricSubdigraphWithoutLoops(gr);
<immutable symmetric digraph with 2 vertices, 2 edges>
gap> gr2 = gr3;
true
gap> gr := Digraph([[23], [1], [13]]);
<immutable digraph with 3 vertices, 5 edges>
gap> IsSymmetricDigraph(gr);
true
gap> gr := MaximalSymmetricSubdigraphWithoutLoops(gr);
<immutable symmetric digraph with 3 vertices, 4 edges>
gap> OutNeighbours(gr);
[ [ 23 ], [ 1 ], [ 1 ] ]
gap> D := Digraph(IsImmutableDigraph, [[22], [1]]);
<immutable multidigraph with 2 vertices, 3 edges>
gap> DigraphRemoveAllMultipleEdges(D);;
gap> HasDigraphRemoveAllMultipleEdgesAttr(D);
true
gap> IsCompleteDigraph(MaximalSymmetricSubdigraph(D));
true

#  RepresentativeOutNeighbours
gap> gr := CycleDigraph(5);
<immutable cycle digraph with 5 vertices>
gap> RepresentativeOutNeighbours(gr);
[ [ 2 ] ]
gap> DigraphOrbitReps(gr);
1 ]
gap> gr := Digraph([[2], [3], []]);
<immutable digraph with 3 vertices, 2 edges>
gap> RepresentativeOutNeighbours(gr);
[ [ 2 ], [ 3 ], [  ] ]

#  DigraphAdjacencyFunction
gap> gr := Digraph([[13], [2], []]);
<immutable digraph with 3 vertices, 3 edges>
gap> adj := DigraphAdjacencyFunction(gr);
function( u, v ) ... end
gap> adj(11);
true
gap> adj(31);
false
gap> adj(27);
false

#  Test ChromaticNumber
gap> ChromaticNumber(Digraph([[1]]));
Error, the argument <D> must be a digraph with no loops,
gap> ChromaticNumber(NullDigraph(10));
1
gap> ChromaticNumber(CompleteDigraph(10));
10
gap> ChromaticNumber(CompleteBipartiteDigraph(55));
2
gap> ChromaticNumber(DigraphRemoveEdge(CompleteDigraph(10), [12]));
10
gap> ChromaticNumber(DigraphDisjointUnion(CompleteDigraph(10),
> CompleteBipartiteDigraph(5050)));
10
gap> ChromaticNumber(Digraph([[48], [610], [9], [239], [],
> [3], [4], [6], [], [57]]));
3
gap> DigraphColouring(Digraph([[48], [610], [9], [239], [],
> [3], [4], [6], [], [57]]), 2);
fail
gap> DigraphColouring(Digraph([[48], [610], [9], [239], [],
> [3], [4], [6], [], [57]]), 3);
Transformation( [ 2231212321 ] )
gap> ChromaticNumber(DigraphDisjointUnion(CompleteDigraph(1),
> Digraph([[2], [4], [12], [3]])));
3
gap> ChromaticNumber(DigraphDisjointUnion(CompleteDigraph(1),
> Digraph([[2], [4], [12], [3], [123]])));
4
gap> gr := DigraphFromDigraph6String(Concatenation(
> "&l??O?C?A_@???CE????GAAG?C??M?????@_?OO??G??@?IC???_C?G?o??C?AO???c_??A?",
> "A?S???OAA???OG???G_A??C?@?cC????_@G???S??C_?C???[??A?A?OA?O?@?A?@A???GGO",
> "??`?_O??G?@?A??G?@AH????AA?O@??_??b???Cg??C???_??W?G????d?G?C@A?C???GC?W",
> "?????K???__O[??????O?W???O@??_G?@?CG??G?@G?C??@G???_Q?O?O?c???OAO?C??C?G",
> "?O??A@??D??G?C_?A??O?_GA??@@?_?G???E?IW??????_@G?C??"));
<immutable digraph with 45 vertices, 180 edges>
gap> ChromaticNumber(gr);
3
gap> DigraphColouring(gr, 3);
Transformation( [ 12123211122123311121,
  223331123332323231213123,
  3 ] )
gap> DigraphColouring(gr, 2);
fail
gap> DigraphGreedyColouring(gr);
Transformation( [ 11111221222112121223,
  323332144233333134432143,
  1 ] )
gap> gr := Digraph([[234], [3], [], []]);
<immutable digraph with 4 vertices, 4 edges>
gap> ChromaticNumber(gr);
3
gap> ChromaticNumber(EmptyDigraph(0));
0
gap> gr := CompleteDigraph(4);;
gap> gr := DigraphAddVertex(gr);;
gap> ChromaticNumber(gr);
4
gap> gr := DigraphFromDiSparse6String(Concatenation(
> ".~?C?_O?WF?MD?L`[DgX?}@oX`o?W^?}Fgb@mHOTa_?Od`ODOd`}EGnA?HW]`?IGfaULOLak",
> "LGA?sBoYAiMOt`[Lw_AGJWP`WHGs_gNWSBIMGF@oKhCASIWxc[BWUAgLGY@uFhKAY?OBBuRp",
> "EdGH_i_cDOaDEHGf_{COdcQNw|DEV?MCuPG`ASUhH`[I@ADqKOqEAHOiCiTgT`gNPSaWSgNB",
> "iSGTAeLpIcwS@SD[YGeE]L@UbGVGNBwSGE@_M@^`SHotBi[oBBOXH^_SEou_oG?sB[UGeA{\\",
> "Gq_CBo`AgK@WDeHPNE_[wXeq@oXDuGP\\aSIo{bK^hC`WJp`fMC_bEW\\G`AOK`[E_^iFF}IOy",
> "CMapZ_?BoWAw[@vGeN?~CKZGNBcPPwaOH_rD{ax?DKXAD_[P`u_CLISCsUgaAkbwKAKMGTAK",
> "O`BCgZQO_oT@T_oB_kB?[YTHaCoYA?OPkF?dGKEk\\ACHmAodAcL`RHiJPYDmW`jFYFpba_Pq",
> "MH[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ueA",
> "B?vDMJ_vEeM@kEyNp@fwCpi`OD`beYKPlFeK@WEk^IC?gBoRBoWHiFaKqBfmMpCDOVg`CORg",
> "KB?Xa@_SYP{fC`x`EW]GbaeYiQAaHhVEq[AOh[M@PF[]QF_WBogB?NpoFUA?pBOYgMD_VaP_",
> "WGpFE?`HGEmV``aCKpLDmPpjGmgPDDGUPz_oD`CHY?PK`cF@CaC`GRCOS@~bcW@xF}B?mGKa",
> "WK@oNO~CWU`wdKV@kGAB_VASKpgFoeWC?sD@gEkaAa_sEO~EW]`}IUK?{H{hH?D_^qHGkbQf",
> "_oJ@kGCdQdf[_wpBwRpRE?Z`x`GGpXDg^gL?wL@FGOiWRAOXAUJEIPgFQI@rGiN`OFcex|HW",
> "eqv`WE?_AsU`}fi@oZAOSa@__]QQJ]C@LGocWbA[RPMDO^qBa[O@NDUVQBGWhGZF?`aHIsjw",
> "HCGdXkFKaQwa?L@hGWjwqC?Yq[KUAPyGK`aqe[cyw_oH@GD{\\xjF}C`]EkbaPJAI?tC?YQ@_",
> "KO@bKm??RE_^Q}_WRAAHULpCC_\\AGKm?PeFS\\qyKmBoOIopBEKqAQCHSsi^LEMgF@olQuLQC",
> "@OHotwUEEuoPA{^A_K?pw`CG[@tHYH`a_sO`BCo`a__SCp]IspxGI?nrSdCdbILiCOsJStiZ",
> "JeDOqC?PaPHYC?jDSXR^hOpwTA_UQOHggG?@yK@@C_\\rEbwRQHKYG?aA[N`HK}A?gCKVwSAQ",
> "??mFEIpLFoiHZGWgqiLaK`wFsrILLmSQ[KC{XhGyVPnHoubdaoS`]D{lrl`WG?nB?QPPEwyg",
> "JD?Ta@Io|GX@wG@lHkkbYaCHOoJgrWqGkmRCL_wWIBo[AFIgpbZ_kQ`~IKlrD`GD_sGoewiB",
> "?QaKJr"));
<immutable digraph with 256 vertices, 1371 edges>
gap> gr := DigraphDisjointUnion(gr, CompleteDigraph(5));
<immutable digraph with 261 vertices, 1391 edges>
gap> ChromaticNumber(gr);
5
gap> gr := Digraph([[2473], [3581], [1692],
> [5716], [6824], [4935], [8149], [9257],
> [7368]]);;
gap> ChromaticNumber(gr);
3
gap> gr := DigraphSymmetricClosure(ChainDigraph(5));
<immutable symmetric digraph with 5 vertices, 8 edges>
gap> DigraphGreedyColouring(gr);;
gap> ChromaticNumber(gr);
2
gap> gr := DigraphFromGraph6String("KmKk~K??G@_@");
<immutable symmetric digraph with 12 vertices, 42 edges>
gap> ChromaticNumber(gr);
4
gap> gr := CycleDigraph(7);
<immutable cycle digraph with 7 vertices>
gap> ChromaticNumber(gr);
3
gap> gr := CycleDigraph(71);
<immutable cycle digraph with 71 vertices>
gap> ChromaticNumber(gr);
3
gap> gr := CycleDigraph(1001);
<immutable cycle digraph with 1001 vertices>
gap> ChromaticNumber(gr);
3
gap> a := DigraphRemoveEdges(CompleteDigraph(50), [[12], [21]]);;
gap> b := DigraphAddVertex(a);;
gap> ChromaticNumber(a);
49
gap> ChromaticNumber(b);
49
gap> D := DigraphFromGraph6String("ElNG");
<immutable symmetric digraph with 6 vertices, 18 edges>
gap> ChromaticNumber(D);
3
gap> IsSymmetricDigraph(D) and IsRegularDigraph(D) and OutDegreeSet(D) = [3];
true
gap> IsBiconnectedDigraph(D);
true
gap> D := Digraph(OutNeighbours(CycleDigraph(13)));;
gap> ChromaticNumber(D);
3

#  Test ChromaticNumber Lawler
gap> ChromaticNumber(NullDigraph(10) : lawler);
1
gap> ChromaticNumber(CompleteDigraph(10) : lawler);
10
gap> ChromaticNumber(CompleteBipartiteDigraph(55) : lawler);
2
gap> ChromaticNumber(DigraphRemoveEdge(CompleteDigraph(10), [12]) : lawler);
10
gap> ChromaticNumber(Digraph([[48], [610], [9], [239], [],
> [3], [4], [6], [], [57]]) : lawler);
3
gap> ChromaticNumber(DigraphDisjointUnion(CompleteDigraph(1),
> Digraph([[2], [4], [12], [3]])) : lawler);
3
gap> ChromaticNumber(DigraphDisjointUnion(CompleteDigraph(1),
> Digraph([[2], [4], [12], [3], [123]])) : lawler);
4
gap> gr := Digraph([[234], [3], [], []]);
<immutable digraph with 4 vertices, 4 edges>
gap> ChromaticNumber(gr : lawler);
3
gap> ChromaticNumber(EmptyDigraph(0) : lawler);
0
gap> gr := CompleteDigraph(4);;
gap> gr := DigraphAddVertex(gr);;
gap> ChromaticNumber(gr : lawler);
4
gap> gr := Digraph([[2473], [3581], [1692],
> [5716], [6824], [4935], [8149], [9257],
> [7368]]);;
gap> ChromaticNumber(gr : lawler);
3
gap> gr := DigraphSymmetricClosure(ChainDigraph(5));
<immutable symmetric digraph with 5 vertices, 8 edges>
gap> ChromaticNumber(gr : lawler);
2
gap> gr := DigraphFromGraph6String("KmKk~K??G@_@");
<immutable symmetric digraph with 12 vertices, 42 edges>
gap> ChromaticNumber(gr : lawler);
4
gap> gr := CycleDigraph(7);
<immutable cycle digraph with 7 vertices>
gap> ChromaticNumber(gr : lawler);
3
gap> ChromaticNumber(gr : lawler);
3
gap> ChromaticNumber(gr : lawler);
3

#  Test ChromaticNumber Byskov
gap> ChromaticNumber(NullDigraph(10) : byskov);
1
gap> ChromaticNumber(CompleteDigraph(10) : byskov);
10
gap> ChromaticNumber(CompleteBipartiteDigraph(55) : byskov);
2
gap> ChromaticNumber(DigraphRemoveEdge(CompleteDigraph(10), [12]) : byskov);
10
gap> ChromaticNumber(Digraph([[48], [610], [9], [239], [],
> [3], [4], [6], [], [57]]) : byskov);
3
gap> ChromaticNumber(DigraphDisjointUnion(CompleteDigraph(1),
> Digraph([[2], [4], [12], [3]])) : byskov);
3
gap> ChromaticNumber(DigraphDisjointUnion(CompleteDigraph(1),
> Digraph([[2], [4], [12], [3], [123]])) : byskov);
4
gap> gr := Digraph([[234], [3], [], []]);
<immutable digraph with 4 vertices, 4 edges>
gap> ChromaticNumber(gr : byskov);
3
gap> ChromaticNumber(EmptyDigraph(0) : byskov);
0
gap> gr := CompleteDigraph(4);;
gap> gr := DigraphAddVertex(gr);;
gap> ChromaticNumber(gr : byskov);
4
gap> gr := Digraph([[2473], [3581], [1692],
> [5716], [6824], [4935], [8149], [9257],
> [7368]]);;
gap> ChromaticNumber(gr : byskov);
3
gap> gr := DigraphSymmetricClosure(ChainDigraph(5));
<immutable symmetric digraph with 5 vertices, 8 edges>
gap> ChromaticNumber(gr : byskov);
2
gap> gr := DigraphFromGraph6String("KmKk~K??G@_@");
<immutable symmetric digraph with 12 vertices, 42 edges>
gap> ChromaticNumber(gr : byskov);
4
gap> gr := CycleDigraph(7);
<immutable cycle digraph with 7 vertices>
gap> ChromaticNumber(gr : byskov);
3
gap> ChromaticNumber(gr : byskov);
3
gap> ChromaticNumber(gr : byskov);
3

# Extra tests for under three colourable check
gap> DIGRAPHS_UnderThreeColourable(Digraph([[1]]));
Error, the argument <D> must be a digraph with no loops,
gap> DIGRAPHS_UnderThreeColourable(EmptyDigraph(0));
0

#  Test ChromaticNumber Zykov
gap> ChromaticNumber(NullDigraph(10) : zykov);
1
gap> ChromaticNumber(CompleteDigraph(10) : zykov);
10
gap> ChromaticNumber(CompleteBipartiteDigraph(55) : zykov);
2
gap> ChromaticNumber(DigraphRemoveEdge(CompleteDigraph(10), [12]) : zykov);
10
gap> ChromaticNumber(Digraph([[48], [610], [9], [239], [],
> [3], [4], [6], [], [57]]) : zykov);
3
gap> ChromaticNumber(DigraphDisjointUnion(CompleteDigraph(1),
> Digraph([[2], [4], [12], [3]])) : zykov);
3
gap> ChromaticNumber(DigraphDisjointUnion(CompleteDigraph(1),
> Digraph([[2], [4], [12], [3], [123]])) : zykov);
4
gap> gr := Digraph([[234], [3], [], []]);
<immutable digraph with 4 vertices, 4 edges>
gap> ChromaticNumber(gr : zykov);
3
gap> ChromaticNumber(EmptyDigraph(0) : zykov);
0
gap> gr := CompleteDigraph(4);;
gap> gr := DigraphAddVertex(gr);;
gap> ChromaticNumber(gr : zykov);
4
gap> gr := Digraph([[2473], [3581], [1692],
> [5716], [6824], [4935], [8149], [9257],
> [7368]]);;
gap> ChromaticNumber(gr : zykov);
3
gap> gr := DigraphSymmetricClosure(ChainDigraph(5));
<immutable symmetric digraph with 5 vertices, 8 edges>
gap> ChromaticNumber(gr : zykov);
2
gap> gr := DigraphFromGraph6String("KmKk~K??G@_@");
<immutable symmetric digraph with 12 vertices, 42 edges>
gap> ChromaticNumber(gr : zykov);
4
gap> gr := CycleDigraph(7);
<immutable cycle digraph with 7 vertices>
gap> ChromaticNumber(gr : zykov);
3
gap> ChromaticNumber(gr : zykov);
3
gap> ChromaticNumber(gr : zykov);
3
gap> a := DigraphRemoveEdges(CompleteDigraph(50), [[12], [21]]);;
gap> b := DigraphAddVertex(a);;
gap> ChromaticNumber(a : zykov);
49
gap> ChromaticNumber(b : zykov);
49

#  Test ChromaticNumber Christofides
gap> ChromaticNumber(NullDigraph(10) : christofides);
1
gap> ChromaticNumber(CompleteDigraph(10) : christofides);
10
gap> ChromaticNumber(CompleteBipartiteDigraph(55) : christofides);
2
gap> ChromaticNumber(DigraphRemoveEdge(CompleteDigraph(10), [12]) : christofides);
10
gap> ChromaticNumber(Digraph([[48], [610], [9], [239], [],
> [3], [4], [6], [], [57]]) : christofides);
3
gap> ChromaticNumber(DigraphDisjointUnion(CompleteDigraph(1),
> Digraph([[2], [4], [12], [3]])) : christofides);
3
gap> ChromaticNumber(DigraphDisjointUnion(CompleteDigraph(1),
> Digraph([[2], [4], [12], [3], [123]])) : christofides);
4
gap> gr := Digraph([[234], [3], [], []]);
<immutable digraph with 4 vertices, 4 edges>
gap> ChromaticNumber(gr : christofides);
3
gap> ChromaticNumber(EmptyDigraph(0) : christofides);
0
gap> gr := CompleteDigraph(4);;
gap> gr := DigraphAddVertex(gr);;
gap> ChromaticNumber(gr : christofides);
4
gap> gr := Digraph([[2473], [3581], [1692],
> [5716], [6824], [4935], [8149], [9257],
> [7368]]);;
gap> ChromaticNumber(gr : christofides);
3
gap> gr := DigraphSymmetricClosure(ChainDigraph(5));
<immutable symmetric digraph with 5 vertices, 8 edges>
gap> ChromaticNumber(gr : christofides);
2
gap> gr := DigraphFromGraph6String("KmKk~K??G@_@");
<immutable symmetric digraph with 12 vertices, 42 edges>
gap> ChromaticNumber(gr : christofides);
4
gap> gr := CycleDigraph(7);
<immutable cycle digraph with 7 vertices>
gap> ChromaticNumber(gr : christofides);
3
gap> ChromaticNumber(gr : christofides);
3
gap> ChromaticNumber(gr : christofides);
3
gap> a := DigraphRemoveEdges(CompleteDigraph(50), [[12], [21]]);;
gap> b := DigraphAddVertex(a);;
gap> ChromaticNumber(a : christofides);
49
gap> ChromaticNumber(b : christofides);
49

#  DegreeMatrix
gap> gr := Digraph([[234], [25], [154], [1], [1124]]);;
gap> DegreeMatrix(gr);
[ [ 30000 ], [ 02000 ], [ 00300 ], [ 00010 ], 
  [ 00004 ] ]
gap> DegreeMatrix(Digraph([]));
[  ]
gap> DegreeMatrix(Digraph([[]]));
[ [ 0 ] ]
gap> DegreeMatrix(Digraph([[1]]));
[ [ 1 ] ]

#  LaplacianMatrix
gap> gr := Digraph([[234], [25], [154], [1], [1124]]);;
gap> LaplacianMatrix(gr);
[ [ 3, -1, -1, -10 ], [ 0100, -1 ], [ -103, -1, -1 ], 
  [ -10010 ], [ -2, -10, -14 ] ]
gap> LaplacianMatrix(Digraph([]));
[  ]
gap> LaplacianMatrix(Digraph([[1]]));
[ [ 0 ] ]
gap> LaplacianMatrix(CycleDigraph(5));
[ [ 1, -1000 ], [ 01, -100 ], [ 001, -10 ], 
  [ 0001, -1 ], [ -10001 ] ]
gap> LaplacianMatrix(CompleteDigraph(5));
[ [ 4, -1, -1, -1, -1 ], [ -14, -1, -1, -1 ], [ -1, -14, -1, -1 ], 
  [ -1, -1, -14, -1 ], [ -1, -1, -1, -14 ] ]

#  NrSpanningTrees
gap> NrSpanningTrees(CompleteDigraph(5));
125
gap> NrSpanningTrees(CycleDigraph(5));
Error, the argument <D> must be a symmetric digraph,
gap> NrSpanningTrees(DigraphSymmetricClosure(CycleDigraph(5)));
5
gap> NrSpanningTrees(Digraph([]));
0
gap> NrSpanningTrees(Digraph([[1]]));
1
gap> NrSpanningTrees(Digraph([[234], [15], [15], [15], [234]]));
12

#  UndirectedSpanningTree and UndirectedSpanningForest
gap> gr := EmptyDigraph(0);
<immutable empty digraph with 0 vertices>
gap> tree := UndirectedSpanningTree(gr);
fail
gap> forest := UndirectedSpanningForest(gr);
fail
gap> UndirectedSpanningForest(EmptyDigraph(IsMutableDigraph, 0));
fail
gap> UndirectedSpanningTree(ChainDigraph(IsMutableDigraph, 4));
fail
gap> gr := EmptyDigraph(1);
<immutable empty digraph with 1 vertex>
gap> tree := UndirectedSpanningTree(gr);
<immutable empty digraph with 1 vertex>
gap> forest := UndirectedSpanningForest(gr);
<immutable empty digraph with 1 vertex>
gap> IsUndirectedSpanningTree(gr, gr);
true
gap> IsUndirectedSpanningTree(gr, forest);
true
gap> gr = forest;
true
gap> gr := EmptyDigraph(2);
<immutable empty digraph with 2 vertices>
gap> tree := UndirectedSpanningTree(gr);
fail
gap> forest := UndirectedSpanningForest(gr);
<immutable empty digraph with 2 vertices>
gap> IsUndirectedTree(forest);
false
gap> IsUndirectedSpanningForest(gr, forest);
true
gap> gr = forest;
true
gap> gr := DigraphFromDigraph6String("&IG@qqW?HO?BSQGA?CG");
<immutable digraph with 10 vertices, 23 edges>
gap> IsStronglyConnectedDigraph(gr);
true
gap> UndirectedSpanningTree(gr);
fail
gap> UndirectedSpanningTree(gr);
fail
gap> DigraphEdges(UndirectedSpanningForest(gr));
[ [ 27 ], [ 72 ] ]
gap> DigraphEdges(UndirectedSpanningForest(gr));
[ [ 27 ], [ 72 ] ]
gap> IsUndirectedSpanningForest(gr, UndirectedSpanningForest(gr));
true
gap> D := DigraphFromDigraph6String("&I~~~~^Znn~|~~x^|v{");
<immutable digraph with 10 vertices, 89 edges>
gap> tree := UndirectedSpanningTree(D);
<immutable undirected tree with 10 vertices>
gap> IsUndirectedSpanningTree(D, tree);
true
gap> tree := UndirectedSpanningTree(DigraphMutableCopy(D));
<mutable digraph with 10 vertices, 18 edges>
gap> IsUndirectedSpanningTree(D, tree);
true

# ArticulationPoints
gap> ArticulationPoints(CycleDigraph(5));
[  ]
gap> StrongOrientation(DigraphSymmetricClosure(CycleDigraph(5)))
> = CycleDigraph(5);
true
gap> ArticulationPoints(Digraph([[27], [35], [4], [2], [6], [1], []]));
12 ]
gap> StrongOrientation(Digraph([[27], [35], [4], [2], [6], [1], []]));
Error, not yet implemented
gap> ArticulationPoints(ChainDigraph(5));
234 ]
gap> StrongOrientation(ChainDigraph(5));
Error, not yet implemented
gap> ArticulationPoints(NullDigraph(5));
[  ]
gap> StrongOrientation(NullDigraph(5));
fail
gap> gr :=
> Digraph([[355587], [38], [653], [], [66], [56], [36], []
> , [], [19], [23], [], [4076], [7279], [4648], [2268], [
26], [1760], [17], [42], [3491], [6887], [1446], [2380
> ], [68], [], [], [], [], [], [2835], [], [184094], [], [
>  274478], [], [25], [71], [72], [233], [87], [], [42], [
> ], [43], [63], [], [5889], [6897], [2440], [13], [9], [
44], [80], [], [40], [78], [9], [], [354457], [], [], [67,
7481], [], [86], [], [5493], [6679], [], [], [], [], [100
> ], [19], [6268], [87], [41589], [6186], [], [41], [21,
41], [5964], [], [53], [59], [1433], [], [], [377192], [
320], [56], [56], [], [89], [], [1143885], [], [19], [
30], [5698]]);
<immutable digraph with 100 vertices, 110 edges>
gap> IsConnectedDigraph(gr);
false
gap> ArticulationPoints(gr);
[  ]
gap> StrongOrientation(gr);
Error, not yet implemented
gap> gr := DigraphCopy(gr);
<immutable digraph with 100 vertices, 110 edges>
gap> ArticulationPoints(gr);
[  ]
gap> IsConnectedDigraph(gr);
false
gap> ArticulationPoints(Digraph([[12], [2]]));
[  ]
gap> StrongOrientation(Digraph([[12], [2]]));
Error, not yet implemented
gap> gr := Digraph([[1122222], [2233], []]);  # path
<immutable multidigraph with 3 vertices, 11 edges>
gap> ArticulationPoints(gr);
2 ]
gap> StrongOrientation(gr);
Error, not yet implemented
gap> gr := Digraph([[1122222], [2233], [111]]);  # cycle
<immutable multidigraph with 3 vertices, 14 edges>
gap> ArticulationPoints(gr);
[  ]
gap> gr := Digraph([[2], [3], [], [3]]);
<immutable digraph with 4 vertices, 3 edges>
gap> ArticulationPoints(gr);
23 ]
gap> IsConnectedDigraph(DigraphRemoveVertex(gr, 3));
false
gap> IsConnectedDigraph(DigraphRemoveVertex(gr, 2));
false
gap> IsConnectedDigraph(DigraphRemoveVertex(gr, 1));
true
gap> IsConnectedDigraph(DigraphRemoveVertex(gr, 4));
true
gap> ArticulationPoints(Digraph([]));
[  ]
gap> ArticulationPoints(Digraph([[]]));
[  ]
gap> ArticulationPoints(Digraph([[1]]));
[  ]
gap> ArticulationPoints(Digraph([[11]]));
[  ]
gap> ArticulationPoints(Digraph([[1], [2]]));
[  ]
gap> ArticulationPoints(Digraph([[2], [1]]));
[  ]
gap> ArticulationPoints(DigraphFromGraph6String("FlCX?"));
34 ]
gap> ArticulationPoints(Digraph([[245], [14], [47], [123567],
>                                [14], [47], [346]]));
4 ]
gap> gr := DigraphFromSparse6String(
> ":~?@V`OINBg_McouHAxQD@gyYEW}Q_@_YdgE`?OgZgpEbfYQKDGqiDQEI`wGdjoADGZG\
> FIJONFQSplq]y@IwvbPKhMh}JGK?OLzW{agKKfRCtarqTGayQGb]rMIurapkxPG?RGcI]\
> IBtB_`EQKJ@LmxlL_?k^QieOkB|T");
<immutable symmetric digraph with 87 vertices, 214 edges>
gap> ArticulationPoints(gr);
13811121517181921232730363741424651
  5259606163666869737576798487 ]
gap> IsDuplicateFree(last);
true
gap> ForAll(ArticulationPoints(gr),
> x -> not IsConnectedDigraph(DigraphRemoveVertex(gr, x)));
true
gap> Set(ArticulationPoints(gr))
> = Filtered(DigraphVertices(gr),
>            x -> not IsConnectedDigraph(DigraphRemoveVertex(gr, x)));
true
gap> D := Digraph([[25], [1345], [24], [23], [12]]);
<immutable digraph with 5 vertices, 12 edges>
gap> Bridges(D);
[  ]
gap> ArticulationPoints(D);
2 ]
gap> D := Digraph([[2], [3], [4], [2]]);
<immutable digraph with 4 vertices, 4 edges>
gap> Bridges(D);
[ [ 12 ] ]
gap> ArticulationPoints(D);
2 ]
gap> D := Digraph([[1122], [2233], []]);
<immutable multidigraph with 3 vertices, 8 edges>
gap> ArticulationPoints(D);
2 ]
gap> Bridges(D);
[ [ 23 ], [ 12 ] ]

# MinimalCyclicEdgeCut
gap> g := HypercubeGraph(3);;
gap> edgeCut := MinimalCyclicEdgeCut(g);
[ [ 15 ], [ 26 ], [ 48 ], [ 37 ] ]
gap> edgeCut := Concatenation(edgeCut, List(edgeCut, Reversed));
[ [ 15 ], [ 26 ], [ 48 ], [ 37 ], [ 51 ], [ 62 ], [ 84 ], 
  [ 73 ] ]
gap> gNew := DigraphRemoveEdges(g, edgeCut);
<immutable digraph with 8 vertices, 16 edges>
gap> IsConnectedDigraph(gNew);
false
gap> MinimalCyclicEdgeCut(CompleteDigraph(4));
fail
gap> MinimalCyclicEdgeCut(CycleGraph(8));
fail
gap> g := DigraphByEdges([[12], [13], [17], [24], [29],
>   [35], [310], [46], [47], [56], [57], [613], [89],
>   [810], [814], [911], [1012], [1113], [1114], [1213], [1214]]);;
gap> edgeCut := MinimalCyclicEdgeCut(g);
[ [ 29 ], [ 310 ], [ 613 ] ]
gap> gNew := DigraphRemoveEdges(g, edgeCut);
<immutable digraph with 14 vertices, 18 edges>
gap> IsConnectedDigraph(gNew);
false

# ArticulationPoints: Issue #777
gap> D1 := DigraphFromGraph6String("LCHK?p?O?c@`?_");
<immutable symmetric digraph with 13 vertices, 30 edges>
gap> ArticulationPoints(D1);
2567 ]
gap> x := (1462)(37851311109);;
gap> D2 := OnDigraphs(D1, x);;
gap> ArticulationPoints(D2) = OnSets(ArticulationPoints(D1), x);
true
gap> D := DigraphFromDigraph6String("&C?gG");
<immutable digraph with 4 vertices, 3 edges>
gap> ArticulationPoints(D);
3 ]
gap> D := Digraph([[], [3], [1], [3], [3], [3], [3], [3], [3]]);
<immutable digraph with 9 vertices, 8 edges>
gap> ArticulationPoints(D);
3 ]

# StrongOrientation
gap> filename := Concatenation(DIGRAPHS_Dir(), "/data/graph5.g6.gz");;
gap> D := ReadDigraphs(filename);;
gap> ForAll(D,
>           d -> StrongOrientation(d) = fail
>                or IsStronglyConnectedDigraph(StrongOrientation(d)));
true
gap> Number(D, d -> StrongOrientation(d) <> fail);
11
gap> Number(D, IsBridgelessDigraph);
11
gap> D := Filtered(D, d -> StrongOrientation(d) <> fail);;
gap> ForAll(D, d -> IsSubdigraph(d, StrongOrientation(d)));
true
gap> ForAll(D,
> d -> DigraphNrEdges(d) / 2 = DigraphNrEdges(StrongOrientation(d)));
true

#  HamiltonianPath
gap> g := Digraph([]);
<immutable empty digraph with 0 vertices>
gap> HamiltonianPath(g);
[  ]
gap> g := Digraph([[]]);
<immutable empty digraph with 1 vertex>
gap> HamiltonianPath(g);
1 ]
gap> g := Digraph([[], []]);
<immutable empty digraph with 2 vertices>
gap> HamiltonianPath(g);
fail
gap> g := Digraph([[1]]);
<immutable digraph with 1 vertex, 1 edge>
gap> HamiltonianPath(g);
1 ]
gap> g := Digraph([[22], []]);
<immutable multidigraph with 2 vertices, 2 edges>
gap> HamiltonianPath(g);
fail
gap> g := Digraph([[2], [1]]);
<immutable digraph with 2 vertices, 2 edges>
gap> HamiltonianPath(g);
12 ]
gap> g := Digraph([[3], [3], []]);
<immutable digraph with 3 vertices, 2 edges>
gap> HamiltonianPath(g);
fail
gap> g := Digraph([[3], [3], [12]]);
<immutable digraph with 3 vertices, 4 edges>
gap> HamiltonianPath(g);
fail
gap> g := Digraph([[3], [], [2]]);
<immutable digraph with 3 vertices, 2 edges>
gap> HamiltonianPath(g);
fail
gap> g := Digraph([[2], [3], [1]]);
<immutable digraph with 3 vertices, 3 edges>
gap> HamiltonianPath(g);
123 ]
gap> g := Digraph([[2], [3], [1], []]);
<immutable digraph with 4 vertices, 3 edges>
gap> HamiltonianPath(g);
fail
gap> g := Digraph([[2], [3], [14], []]);
<immutable digraph with 4 vertices, 4 edges>
gap> HamiltonianPath(g);
fail
gap> g := Digraph([[36], [4], [21], [51], [3], [4]]);
<immutable digraph with 6 vertices, 9 edges>
gap> HamiltonianPath(g);
fail
gap> g := Digraph([[36], [41], [21], [51], [3], [4]]);
<immutable digraph with 6 vertices, 10 edges>
gap> HamiltonianPath(g);
164532 ]
gap> g := Digraph([[36], [4], [21], [51], [3], [47], []]);
<immutable digraph with 7 vertices, 10 edges>
gap> HamiltonianPath(g);
fail
gap> g := Digraph([[367], [41], [21], [51], [3], [47], [6]]);
<immutable digraph with 7 vertices, 13 edges>
gap> HamiltonianPath(g);
1764532 ]
gap>  g := Digraph([[36], [4], [21], [51], [3], [47], [6]]);
<immutable digraph with 7 vertices, 11 edges>
gap> HamiltonianPath(g);
fail
gap> g := Digraph([[5610], [29], [37], [23], [910], [29], [1],
>                  [23479], [310], [4568]]);
<immutable digraph with 10 vertices, 25 edges>
gap> HamiltonianPath(g);
fail
gap> g := Digraph([[24610], [134567910], [1578],
>                  [610], [17], [34679], [2347],
>                  [2456], [23567910], [235]]);
<immutable digraph with 10 vertices, 43 edges>
gap> HamiltonianPath(g);
14691038572 ]
gap> IsDigraphMonomorphism(CycleDigraph(10),
>                          g,
>                          Transformation(HamiltonianPath(g)));
true
gap> g := CompleteMultipartiteDigraph([130]);
<immutable complete bipartite digraph with bicomponent sizes 1 and 30>
gap> HamiltonianPath(g);
fail
gap> g := Digraph([[256], [317], [428], [539], [1410],
>                  [189], [2910], [3106], [467], [578]]);
<immutable digraph with 10 vertices, 30 edges>
gap> HamiltonianPath(g);
fail
gap> g := CompleteMultipartiteDigraph([1615]);
<immutable complete bipartite digraph with bicomponent sizes 16 and 15>
gap> HamiltonianPath(g);
fail
gap> g := CompleteMultipartiteDigraph([115111111]);
<immutable complete multipartite digraph with 22 vertices, 252 edges>
gap> HamiltonianPath(g);
fail
gap> g := CycleDigraph(100);
<immutable cycle digraph with 100 vertices>
gap> HamiltonianPath(g);
77787980818283848586878889909192939495
  9697989910012345678910111213141516
  17181920212223242526272829303132333435
  36373839404142434445464748495051525354
  55565758596061626364656667686970717273
  747576 ]
gap> g := CycleDigraph(513);
<immutable cycle digraph with 513 vertices>
gap> g := DigraphAddEdges(g, [[68], [87], [79]]);
<immutable digraph with 513 vertices, 516 edges>
gap> g := DigraphRemoveEdge(g, [67]);
<immutable digraph with 513 vertices, 515 edges>
gap> HamiltonianPath(g);
123456879101112131415161718192021
  22232425262728293031323334353637383940
  41424344454647484950515253545556575859
  60616263646566676869707172737475767778
  79808182838485868788899091929394959697
  9899100101102103104105106107108109110111112
  113114115116117118119120121122123124125126127
  128129130131132133134135136137138139140141142
  143144145146147148149150151152153154155156157
  158159160161162163164165166167168169170171172
  173174175176177178179180181182183184185186187
  188189190191192193194195196197198199200201202
  203204205206207208209210211212213214215216217
  218219220221222223224225226227228229230231232
  233234235236237238239240241242243244245246247
  248249250251252253254255256257258259260261262
  263264265266267268269270271272273274275276277
  278279280281282283284285286287288289290291292
  293294295296297298299300301302303304305306307
  308309310311312313314315316317318319320321322
  323324325326327328329330331332333334335336337
  338339340341342343344345346347348349350351352
  353354355356357358359360361362363364365366367
  368369370371372373374375376377378379380381382
  383384385386387388389390391392393394395396397
  398399400401402403404405406407408409410411412
  413414415416417418419420421422423424425426427
  428429430431432433434435436437438439440441442
  443444445446447448449450451452453454455456457
  458459460461462463464465466467468469470471472
  473474475476477478479480481482483484485486487
  488489490491492493494495496497498499500501502
  5035045055065075085095105115125131 ]
gap> gr := DigraphAddEdges(DigraphAddVertex(CycleDigraph(600)),
>                          [[600601], [601600]]);
<immutable digraph with 601 vertices, 602 edges>
gap> HamiltonianPath(gr);
fail

# DigraphCore
gap> D := Digraph([[36], [1], [4], [57], [1], [27], [41]]);
<immutable digraph with 7 vertices, 11 edges>
gap> DigraphCore(D);
13467 ]
gap> D := Digraph([[23], [13], [124], [1]]);
<immutable digraph with 4 vertices, 8 edges>
gap> DigraphCore(D);
123 ]
gap> DIGRAPHS_FREE_HOMOS_DATA();;
gap> DigraphHomomorphism(D, InducedSubdigraph(D, DigraphCore(D)));
Transformation( [ 1323 ] )
gap> D := CompleteDigraph(10);
<immutable complete digraph with 10 vertices>
gap> DigraphCore(D);
1 .. 10 ]
gap> D := Digraph([[2], [3], [4], [5], [6], [2]]);
<immutable digraph with 6 vertices, 6 edges>
gap> DigraphCore(D);
23456 ]
gap> D := Digraph([[2], [1], [45], [5], [4]]);
<immutable digraph with 5 vertices, 6 edges>
gap> DigraphCore(D);
345 ]
gap> D := EmptyDigraph(0);
<immutable empty digraph with 0 vertices>
gap> DigraphCore(D);
[  ]
gap> D := EmptyDigraph(1000);
<immutable empty digraph with 1000 vertices>
gap> DigraphCore(D);
1 ]
gap> D := EmptyDigraph(IsMutableDigraph, 0);
<mutable empty digraph with 0 vertices>
gap> for i in [2 .. 15] do
> DigraphDisjointUnion(D, CycleDigraph(i));
> od;
gap> DigraphCore(D);
12345101112131421222324252627555657
  58596061626364657879808182838485868788
  8990 ]
gap> D1 := DigraphFromDigraph6String("&FJBWqNbXV?");
<immutable digraph with 7 vertices, 24 edges>
gap> IsDigraphCore(D1);
true
gap> D2 := DigraphFromDigraph6String("&FJbWqNbWu?");
<immutable digraph with 7 vertices, 24 edges>
gap> IsDigraphCore(D2);
true
gap> M1 := DigraphMycielskian(D1);
<immutable digraph with 15 vertices, 86 edges>
gap> IsDigraphCore(M1);
true
gap> D := DigraphDisjointUnion(D1, D2, M1);
<immutable digraph with 29 vertices, 134 edges>
gap> DigraphCore(D);
8 .. 29 ]
gap> IsDigraphCore(InducedSubdigraph(D, DigraphCore(D)));
true
gap> str := ".qb`hOAW@fAiG]g??aGD[TXAbjgWl^?fkG{~cA@p`e~EIRlHSxBFHx\\RJ@ERCYhV\
> SoIDvIE?c?x_YBJg?IWmoN_djWMyKnckGkdMqBsQMBWsBaK?\\BBFWOvY[vcHp]N";;
gap> D := DigraphFromDiSparse6String(str);
<immutable digraph with 50 vertices, 79 edges>
gap> DigraphCore(D);
1247891112131415161718192122232526
  29303234353637383940414243444647484950 ]
gap> D := Digraph([[28], [3], [1], [5], [6], [7], [4], []]);
<immutable digraph with 8 vertices, 8 edges>
gap> DigraphCore(D);
1 .. 7 ]
gap> D := Digraph([[], [2]]);
<immutable digraph with 2 vertices, 1 edge>
gap> DigraphCore(D);
2 ]
gap> D := DigraphDisjointUnion(EmptyDigraph(1), CompleteBipartiteDigraph(33));
<immutable digraph with 7 vertices, 18 edges>
gap> DigraphCore(D);
25 ]
gap> D := DigraphFromDigraph6String("&IO?_@?A?CG??O?_G??");
<immutable digraph with 10 vertices, 9 edges>
gap> DigraphCore(D);
789 ]
gap> D := CycleDigraph(IsMutableDigraph, 2);
<mutable digraph with 2 vertices, 2 edges>
gap> for i in [1 .. 9] do
>      DigraphDisjointUnion(D, D);
>    od;
gap> DigraphCore(D);
12 ]
gap> D := DigraphFromDigraph6String("&G?_cO`EO?@??");
<immutable digraph with 8 vertices, 10 edges>
gap> DigraphCore(D);
25 ]
gap> D := DigraphFromDigraph6String("&GSY??A?SA?O?");
<immutable digraph with 8 vertices, 10 edges>
gap> DigraphCore(D);
12 ]
gap> D := Digraph([[2], [13], []]);;
gap> DigraphCore(D);
12 ]

# MaximalAntiSymmetricSubdigraph
gap> MaximalAntiSymmetricSubdigraph(Digraph([[22], [1]]));
<immutable antisymmetric digraph with 2 vertices, 1 edge>
gap> MaximalAntiSymmetricSubdigraph(Digraph(IsMutableDigraph, [[22], [1]]));
<mutable digraph with 2 vertices, 1 edge>
gap> D := Digraph(IsMutableDigraph, [[1]]);
<mutable digraph with 1 vertex, 1 edge>
gap> MaximalAntiSymmetricSubdigraph(D) = D;
true
gap> MaximalAntiSymmetricSubdigraph(NullDigraph(0));
<immutable empty digraph with 0 vertices>
gap> IsAntisymmetricDigraph(DigraphCopy(last));
true
gap> MaximalAntiSymmetricSubdigraph(NullDigraph(1));
<immutable empty digraph with 1 vertex>
gap> IsAntisymmetricDigraph(DigraphCopy(last));
true
gap> MaximalAntiSymmetricSubdigraph(CompleteDigraph(1));
<immutable empty digraph with 1 vertex>
gap> IsAntisymmetricDigraph(DigraphCopy(last));
true
gap> MaximalAntiSymmetricSubdigraph(CompleteBipartiteDigraph(230000));
<immutable antisymmetric digraph with 30002 vertices, 60000 edges>
gap> IsAntisymmetricDigraph(DigraphCopy(last));
true
gap> MaximalAntiSymmetricSubdigraph(Digraph([[1122], []]));
<immutable antisymmetric digraph with 2 vertices, 2 edges>
gap> OutNeighbours(last);
[ [ 12 ], [  ] ]
gap> MaximalAntiSymmetricSubdigraph(CompleteDigraph(10));
<immutable antisymmetric digraph with 10 vertices, 45 edges>
gap> D := CompleteDigraph(10);
<immutable complete digraph with 10 vertices>
gap> MaximalAntiSymmetricSubdigraph(D);
<immutable antisymmetric digraph with 10 vertices, 45 edges>
gap> MaximalAntiSymmetricSubdigraph(D);
<immutable antisymmetric digraph with 10 vertices, 45 edges>
gap> D := Digraph(IsImmutableDigraph, [[22], [1]]);
<immutable multidigraph with 2 vertices, 3 edges>
gap> DigraphRemoveAllMultipleEdges(D);;
gap> HasDigraphRemoveAllMultipleEdgesAttr(D);
true
gap> IsChainDigraph(MaximalAntiSymmetricSubdigraph(D));
true

# CharacteristicPolynomial
gap> gr := Digraph([
> [222], [1368910], [468],
> [1239], [33], [35610], [127],
> [123105610], [1345810],
> [2346710]]);
<immutable multidigraph with 10 vertices, 44 edges>
gap> CharacteristicPolynomial(gr);
x_1^10-3*x_1^9-7*x_1^8-x_1^7+14*x_1^6+x_1^5-26*x_1^4+51*x_1^3-10*x_1^2+18*x_1-\
30
gap> gr := CompleteDigraph(5);
<immutable complete digraph with 5 vertices>
gap> CharacteristicPolynomial(gr);
x_1^5-10*x_1^3-20*x_1^2-15*x_1-4

# IsVertexTransitive
gap> IsVertexTransitive(Digraph([]));
true
gap> IsVertexTransitive(Digraph([[1], [2]]));
true
gap> IsVertexTransitive(Digraph([[2], [3], []]));
false
gap> IsVertexTransitive(CompleteDigraph(20));
true

# IsEdgeTransitive
gap> IsEdgeTransitive(Digraph([]));
true
gap> IsEdgeTransitive(Digraph([[1], [2]]));
true
gap> IsEdgeTransitive(Digraph([[2], [3], []]));
false
gap> IsEdgeTransitive(CompleteDigraph(20));
true
gap> IsEdgeTransitive(Digraph([[2], [333], []]));
Error, the argument <D> must be a digraph with no multiple edges,

# AsGraph
gap> D := NullDigraph(IsMutableDigraph, 3);
<mutable empty digraph with 3 vertices>
gap> AsGraph(D);
rec( adjacencies := [ [  ], [  ], [  ] ], group := Group(()), isGraph := true,
  names := [ 1 .. 3 ], order := 3, representatives := [ 123 ], 
  schreierVector := [ -1, -2, -3 ] )

# DigraphSource
gap> D := NullDigraph(IsMutableDigraph, 3);
<mutable empty digraph with 3 vertices>
gap> DigraphSource(D);
[  ]
gap> DigraphRange(D);
[  ]
gap> DigraphSymmetricClosure(NullDigraph(IsMutableDigraph, 1));
<mutable empty digraph with 1 vertex>
gap> D := Digraph([[2], []]);
<immutable digraph with 2 vertices, 1 edge>
gap> DigraphSymmetricClosure(D);
<immutable symmetric digraph with 2 vertices, 2 edges>
gap> DigraphSymmetricClosure(D);
<immutable symmetric digraph with 2 vertices, 2 edges>
gap> D := Digraph(IsMutableDigraph, [[22], []]);
<mutable multidigraph with 2 vertices, 2 edges>
gap> DigraphTransitiveClosure(D);
Error, the argument <D> must be a digraph with no multiple edges,
gap> DigraphReflexiveTransitiveClosure(D);
Error, the argument <D> must be a digraph with no multiple edges,
gap> MakeImmutable(D);
<immutable multidigraph with 2 vertices, 2 edges>
gap> DigraphTransitiveClosure(D);
Error, the argument <D> must be a digraph with no multiple edges,
gap> D := Digraph([[2], []]);
<immutable digraph with 2 vertices, 1 edge>
gap> DigraphTransitiveClosure(D);
<immutable transitive digraph with 2 vertices, 1 edge>
gap> DigraphTransitiveClosure(D);
<immutable transitive digraph with 2 vertices, 1 edge>
gap> DigraphReflexiveTransitiveClosure(D);
<immutable preorder digraph with 2 vertices, 3 edges>
gap> DigraphReflexiveTransitiveClosure(D);
<immutable preorder digraph with 2 vertices, 3 edges>
gap> D := DigraphMutableCopy(DigraphSymmetricClosure(D));
<mutable digraph with 2 vertices, 2 edges>
gap> MaximalSymmetricSubdigraphWithoutLoops(D);
<mutable digraph with 2 vertices, 2 edges>
gap> MaximalSymmetricSubdigraphWithoutLoops(MakeImmutable(D));
<immutable symmetric digraph with 2 vertices, 2 edges>
gap> MaximalSymmetricSubdigraphWithoutLoops(D);
<immutable symmetric digraph with 2 vertices, 2 edges>
gap> D := CycleDigraph(IsMutableDigraph, 10);
<mutable digraph with 10 vertices, 10 edges>
gap> UndirectedSpanningForest(D);
<mutable empty digraph with 10 vertices>

#  Digraph(Reflexive)TransitiveReduction

# Check errors
gap> gr := Digraph([[22], []]);
<immutable multidigraph with 2 vertices, 2 edges>
gap> DigraphTransitiveReduction(gr);
Error, the argument <D> must be a digraph with no multiple edges,
gap> DigraphReflexiveTransitiveReduction(gr);
Error, the argument <D> must be a digraph with no multiple edges,
gap> gr := Digraph([[2], [1]]);
<immutable digraph with 2 vertices, 2 edges>
gap> DigraphTransitiveReduction(gr);
Error, not yet implemented for non-topologically sortable digraphs,
gap> DigraphReflexiveTransitiveReduction(gr);
Error, not yet implemented for non-topologically sortable digraphs,
gap> D := Digraph(IsImmutableDigraph, [[123], [3], [3]]);;
gap> DigraphRemoveLoops(D);; HasDigraphRemoveLoopsAttr(D);
true
gap> DigraphReflexiveTransitiveReduction(D) = ChainDigraph(3);
true

# Working examples
gap> gr1 := ChainDigraph(6);
<immutable chain digraph with 6 vertices>
gap> gr2 := DigraphReflexiveTransitiveClosure(gr1);
<immutable preorder digraph with 6 vertices, 21 edges>
gap> DigraphTransitiveReduction(gr2) = gr1;  # trans reduction contains loops
false
gap> DigraphReflexiveTransitiveReduction(gr2) = gr1;  # ref trans reduct doesnt
true
gap> gr3 := DigraphAddEdge(gr1, [33]);
<immutable digraph with 6 vertices, 6 edges>
gap> DigraphHasLoops(gr3);
true
gap> gr4 := DigraphTransitiveClosure(gr3);
<immutable transitive digraph with 6 vertices, 16 edges>
gap> gr2 = gr4;
false
gap> DigraphReflexiveTransitiveReduction(gr4) = gr1;
true
gap> DigraphReflexiveTransitiveReduction(gr4) = gr3;
false
gap> DigraphTransitiveReduction(gr4) = gr3;
true

# Special cases
gap> DigraphTransitiveReduction(EmptyDigraph(0)) = EmptyDigraph(0);
true
gap> DigraphReflexiveTransitiveReduction(EmptyDigraph(0)) = EmptyDigraph(0);
true

#  DigraphReverse
gap> gr := DigraphFromDigraph6String("&DHUEe_");
<immutable digraph with 5 vertices, 11 edges>
gap> rgr := DigraphReverse(gr);
<immutable digraph with 5 vertices, 11 edges>
gap> OutNeighbours(rgr);
[ [ 234 ], [ 45 ], [ 125 ], [ 4 ], [ 25 ] ]
gap> gr = DigraphReverse(rgr);
true
gap> gr := Digraph(rec(DigraphNrVertices := 5,
> DigraphSource := [11222223444555],
> DigraphRange := [13122454135113]));
<immutable multidigraph with 5 vertices, 14 edges>
gap> e := DigraphEdges(gr);
[ [ 11 ], [ 13 ], [ 21 ], [ 22 ], [ 22 ], [ 24 ], [ 25 ], 
  [ 34 ], [ 41 ], [ 43 ], [ 45 ], [ 51 ], [ 51 ], [ 53 ] ]
gap> rev := DigraphReverse(gr);
<immutable multidigraph with 5 vertices, 14 edges>
gap> erev := DigraphEdges(rev);;
gap> temp := List(erev, x -> [x[2], x[1]]);;
gap> Sort(temp);
gap> e = temp;
true
gap> gr := Digraph([[2], [1]]);
<immutable digraph with 2 vertices, 2 edges>
gap> IsSymmetricDigraph(gr);
true
gap> DigraphReverse(gr) = gr;
true
gap> gr := Digraph([[2], [1]]);
<immutable digraph with 2 vertices, 2 edges>
gap> SetIsSymmetricDigraph(gr, true);
gap> gr = DigraphReverse(gr);
true
gap> DigraphReverse(Digraph(IsMutableDigraph, [[2], [1]]))
> = CompleteDigraph(2);
true
gap> OutNeighbours(DigraphReverse(ChainDigraph(IsMutableDigraph, 5)));
[ [  ], [ 1 ], [ 2 ], [ 3 ], [ 4 ] ]

# DigraphCartesianProductProjections
gap> D := DigraphCartesianProduct(ChainDigraph(3), CycleDigraph(4),
> Digraph([[2], [2]]));;
gap> HasDigraphCartesianProductProjections(D);
true
gap> proj := DigraphCartesianProductProjections(D);; Length(proj);
3
gap> IsIdempotent(proj[2]);
true
gap> RankOfTransformation(proj[3]);
2
gap> S := ImageSetOfTransformation(proj[2]);;
gap> IsIsomorphicDigraph(CycleDigraph(4), InducedSubdigraph(D, S));
true
gap> G := DigraphRemoveLoops(RandomDigraph(12));;
gap> H := DigraphRemoveLoops(RandomDigraph(50));;
gap> D := DigraphCartesianProduct(G, H);;
gap> proj := DigraphCartesianProductProjections(D);;
gap> IsIdempotent(proj[1]);
true
gap> RankOfTransformation(proj[2]);
50
gap> S := ImageSetOfTransformation(proj[2]);;
gap> IsIsomorphicDigraph(H, InducedSubdigraph(D, S));
true

# DigraphDirectProductProjections
gap> D := DigraphDirectProduct(ChainDigraph(3), CycleDigraph(4),
> Digraph([[2], [2]]));;
gap> HasDigraphDirectProductProjections(D);
true
gap> proj := DigraphDirectProductProjections(D);; Length(proj);
3
gap> IsIdempotent(proj[2]);
true
gap> RankOfTransformation(proj[3]);
2
gap> P := DigraphRemoveAllMultipleEdges(
> ReducedDigraph(OnDigraphs(D, proj[2])));;
gap> IsIsomorphicDigraph(CycleDigraph(4), P);
true
gap> G := ReducedDigraph(RandomDigraph(12));;
gap> H := ReducedDigraph(RandomDigraph(50));;
gap> D := DigraphDirectProduct(G, H);;
gap> proj := DigraphDirectProductProjections(D);;
gap> IsIdempotent(proj[1]);
true
gap> P := DigraphRemoveAllMultipleEdges(
> ReducedDigraph(OnDigraphs(D, proj[2])));;
gap> IsIsomorphicDigraph(H, P);
true

# DigraphMaximalMatching
gap> D := DigraphFromDigraph6String("&Sq_MN|bDCLy~Xj}u}GxOLlGfqJtnSQ|l\
> Q?lYvjbqN~XNNAQYDJE[UHOhyGOqtsjCWJy[");
<immutable digraph with 20 vertices, 205 edges>
gap> M := DigraphMaximalMatching(D);; IsMaximalMatching(D, M);
true
gap> D := DigraphFromDigraph6String(IsMutable,
> "&Sq_MN|bDCLy~Xj}u}GxOLlGfqJtnSQ|lQ?lYvjbqN~XNNAQYDJE[UHOhyGOqtsjCWJy[");
<mutable digraph with 20 vertices, 205 edges>
gap> M := DigraphMaximalMatching(D);; IsMaximalMatching(D, M);
true
gap> D := Digraph(IsMutable, [[2], [3], [4], [1]]);
<mutable digraph with 4 vertices, 4 edges>
gap> M := DigraphMaximalMatching(D);;
gap> M = [[12], [34]] or M = [[23], [41]];
true
gap> D;
<mutable digraph with 4 vertices, 4 edges>

# DigraphMaximumMatching
gap> D := DigraphFromDiSparse6String(
> ".]cBn@kqAlt?EpclQp|M}bAgFjHkoDsIuACyCM_Hj");
<immutable digraph with 30 vertices, 26 edges>
gap> M := DigraphMaximumMatching(D);; IsMaximalMatching(D, M);
true
gap> Length(M);
14
gap> D := Digraph([[5678], [678], [78], [8], [], [], [], []]);
<immutable digraph with 8 vertices, 10 edges>
gap> DigraphMaximumMatching(D);
[ [ 15 ], [ 26 ], [ 37 ], [ 48 ] ]
gap> D := Digraph(IsMutable, [[23], [14], [24], [5], [35]]);
<mutable digraph with 5 vertices, 9 edges>
gap> M := DigraphMaximumMatching(D);; IsMaximalMatching(D, M);
true
gap> Length(M);
3
gap> D := DigraphFromDiSparse6String("\
> .~?B]zsE?cB?kH?cK?{M?{O?SIaWHaoQ_{X??@?wJ@gT`{[BKF@s^BG[_OOAca?{@@gXB_^bK?A\
> gXbGc_gF@o\\dGG`gXC[X`K__OC?oG@GI@wOAGQAWSAoWBOZBo_CGgDGkDk?BGd_wMBgfdsFC{Q\
> Ao]CGmdsJBGbC_ebGdD{ZDsXCgnEsC?oHAWkDsFbK@BGb`?PDsD?wfcGmE[Fb?ZD?mEWsE{LBGb\
> DSmEW~aOmE[XB_^C[XbKmEW~G[gDp@_x?dop_wfdosGKWDp@dsJBGt`wYDopFHJH{FA{F_waG@I\
> I[OC?mbGtdsUDor`?IAG_DGmFhVbWgDovGHH_GXBwbFcFCwqdpVJKXG{XGx]_wVISC?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bGdDWzGpFJp^KPfLhpMytWSXCYCPyP_waIaQTcFLXoQimdor\
> Ni?Pir_yRTaxXKF@`jRQm_x?HPSTc??GB?gF@WK@gMAgVBG[Bg^CObC_dCofDOjDonE?qEguF?y\
> FW{Fp?GPDGpFHPKI@QIXSIpZJ`]Jx_KPbK`eKxgLPjLhoMHsMxzOQBOaFPIKPyOQIQQYSQiVRQ\\
> \RqdTIiTYkTqnUAsUiwVI{WRBWbDWzGXJIYBPYRRYjUY{GDGmJHxNSAC?mNHyV{mGHMMQLUS]Do\
> rNiLUsFLXoTrRYrW");;
gap> M := DigraphMaximumMatching(D);; IsMaximalMatching(D, M);
true
gap> Length(M);
111
gap> M1 := [
> [1198], [261], [3219], [4189], [510], [663], [798], [826],
> [962], [1118], [1281], [13155], [1467], [1530], [16125],
> [17168], [1923], [20162], [21143], [22197], [24166], [2579],
> [27154], [2856], [2970], [31221], [3292], [3390], [34134],
> [35101], [3654], [3739], [38209], [40108], [41130], [42218],
> [43144], [44120], [45116], [46192], [47217], [48159], [49203],
> [50128], [51141], [5266], [53188], [5557], [5882], [59171],
> [6099], [64126], [65216], [68208], [69102], [71182], [7296],
> [73137], [74184], [75152], [76111], [77185], [78167], [80207],
> [8397], [84201], [85202], [86206], [87117], [8894], [89112],
> [91115], [93176], [95195], [100158], [103170], [104114],
> [105131], [106139], [107177], [109127], [110133], [113212],
> [118119], [121199], [122142], [123157], [124145], [129183],
> [132181], [135178], [136172], [138150], [140165], [146210],
> [147211], [148149], [151161], [153187], [156191], [160193],
> [163169], [164174], [173175], [179220], [180213], [186214],
> [190205], [194204], [196200], [215222]];;
gap> M = M1;
true
gap> D := DigraphFromDiSparse6String("\
> .~?@}~ggEb?eM@X?@_?CC@OWIAowO_PEPdOOPcX_HBHaPDgWICW[GAOoLE@e?@`ESbp]PfG_[cP\
> M?@_gMCPk\\_OOJC@CQDPWYd@yHB@_[`pqPD`gdcQA[IH_XFHCUEaShapCd_?SEA_wPCpk\\GAK\
> cHQiPJwMPHQeGFAE^frQPCqKn_OOJCPSUEaShJQwq__MA?o[GAOoLBpCSDp_XF@w^GQGeHq_jJB\
> CrLBSwfrOtMWSMCQ}@CPGdfBePDaShKb]PCq{u_?SEA_wPEpscJrm]MW{^MXCdIRGvNgCPCaS{`\
> os[IAkxNXCiJrAFFA_xPXCRGAgnKCYPGAgnQGOJCPSdIQwv_@C\\HA|?_PCdNCQA?pwpMBe@C@C\
> db`CnOGCPHWCPHSPK_rCxRWs[IBc|PX[^MW_[GbeSFbd@`@CTHQwvQgkPHQwvQgGBBpOVF@w^Hb\
> CsLR_xMcDARTHSTgCOCQTMbp{sMSHXdp{xTDe@CQTO_b_xRTeDB`CnMsA^MTPXVGGBD@w^HbCwM\
> SDLSdXXVg_WFACaKrdTaP_XFAoxcPKnNx[^MTd[a?cKE@c[GQGfJBKxPTTaWwCOCQTCRd@YVWs[\
> MSTRdp{xUTpdfbd@Tdd`fACrMUHeb`CnOC|^bp{sLRcyOddZVHCRJr|cfrdSUTp_b`CnOC|kcQ{\
> oPca@CQTMSDtffBc|PTMPCqKnLhCRGAKiJr?uNs@EQCdcZfDsd@weMTd`_PCQHRpC`pogMSTF_P\
> CdPCpPfA_jMSULFBdDSuaFFA_jMSTyfBc|PTLr]~");;
gap> M := DigraphMaximumMatching(D);; IsMaximalMatching(D, M);
true
gap> Length(M);
63
gap> M1 := [
> [176], [256], [395], [457], [522], [660], [730], [8125],
> [952], [10100], [1128], [1289], [1340], [14105], [1537],
> [1667], [1791], [1858], [19120], [2073], [2187], [2363],
> [2485], [2599], [2645], [2746], [2990], [3178], [3298],
> [3374], [34108], [3586], [36117], [3848], [39119], [4184],
> [4275], [4371], [44123], [4788], [49114], [5083], [5168],
> [5392], [5459], [5564], [6177], [62116], [65118], [66107],
> [69104], [70103], [72121], [79115], [80113], [8194], [82122],
> [93110], [96109], [97112], [101111], [102106], [124126]];;
gap> M = M1;
true
gap> D := DigraphFromDiSparse6String("\
> .~?BG`WHawSbOT_wJbwYcOOcgCCS`d?SBkj?gedo_`sp?OOdSuCCC?o^bS[cwgdD?A[wdC}gofF\
> [FGLJA_\\GhIi?uio_j?RF[bH|OaGyjgjjwOFdAHXYdhMbSQIDdE`KKTf?PalGh__jIKYHXPe@H\
> gD]kLfdXcekPA`pmoSfslG[[n_CCGx_gpGd~CGdDhfic}IKBAhPbS@?XJJpnbogGHdg\\_kXslS\
> aHeKJKaeXphhqk@pqOODABe[fKHgqoTfCKEPOrOSFxEHHqNQKr`qd@|cTc`YSqMb@G]CsRptl`h\
> LSc@G`QrSZSS@?G~h`hPKD@X@GpTTLiMifSyjc@[NYUmq@PAOp[D?o]bG\\Gq[T|uiMvCq]Ryjv\
> H^LUbchZKejUsoRC]mqga`}RaocpHH`wNczJ@WPY]hHPJ|DKa@OqHUK@DhMNYbij@axmQr@xCJ@\
> KP@sVAcYAkA?wJboOcOOcgabSgBkjCsmCCMCkP_Sieo__cCb_ifWggGwdC}gofF[FGLJBhDHSMh\
> oMi?uiONHSCH|U@w_fcocXNfhOaLBjwCAD`Dk~ILOkhKKTf?PSKThDLPbSoHKPGD]m@fkctaGUM\
> LYmoSC{}LklG\\{CGxnw`K|SfsBAmCBp]L{gGHd_@BJ{jKDbg@bLSaHXKpgafS@BpijxpqOADAB\
> eWycxHKHgNeUAmW@_qI@YhCSFxEHHqr`^MSgN@|cOokeSqMb@?WBoeaXHptl`hLSc@GdkRSZfxw\
> pIc_gJGHEIiblHiMijc@CN[_OIGQCNOYJuWXBhERancXuuy^nSZCxis[VChZK`ddijvo]H@YLYV\
> dPuaaohHKNCzJ@WKY]w`DOIH_GHDhzS\\TTlmQv");;
gap> M := DigraphMaximumMatching(D);; IsMaximalMatching(D, M);
true
gap> Length(M);
96
gap> D := DigraphFromDiSparse6String("\
> .~?BZ_O?__B_SF?CE_kC_[A@[M@KP?sDACC@{M_OL`cJ`OV`GU`?T_{EA[DASCAKB_O]_GMBk?@\
> g[b[JBSIBKHBCGA{FC{TCsDAcCAWc_WQ_OP_G`_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YDxE_oXGkWDhC__kG[jGSAAgiGK@A_hGC?AWgaOffkOCg{c_zi[aFHQ`_`F@Pc\
> @ObwuH{HBot`?sHlK_oZEPJbOpHTH_WnHCAAwm_GUDhEd`DKCSG`^dPBJsQDHAJkPD@@JcfG@Z`\
> weFxY`odJKcFhW``V`WzIsICHT`G_FHS`?wI[FBovIPnbguIHmb_tLkCBWs_WYL[XEPLLS@B@KL\
> K?AxJaonK{TKslKkRDcQDXEK[PDPDKSO`xBKCfGP^NsLCp@JsKG@\\NcJC_~J`z`ObFsHCO|JPx\
> `?{JHw_w_F[EBxVMsDBoxIpt__\\IhsexSM\\R_GtISXE`oeXnawqHxmaopLiMahka_nH`jPcRH\
> YJaOlPSPDcODXGKyG`wiGxeO{MGpdOtDKcKCxCOcJCpachAgH_OL^OCFCO~N{`Fp}_g_Fh|SCCF\
> a^_W]FXYNY]bgyJLWRc?BWwIxwR[YExUMyYepTMqXb@SRCVE`RMcUIPrQsTEPPMSSe@NMARaPnQ\
> SPDpLLqPdhKLiO`wkLcMHSLDPiUSKDHGPcJD@FLAJUCICxEKyIT{HCpeTsGChd_wcGYFTcEGPbO\
> qj_gaGHaOii__`GACTKBC?~O[ABx^OS@Bp]OIe_?\\Ji?Sk[FX[NycbWyJ[YFHYNiaf@XNa`b?v\
> JA_epVNQ^WstRrDagsIi\\WcrRbBePRMqZaOpRR@aHPMaXWCnMYWV{NDpNMQVVsMDhpVkLD`LMA\
> TVcKHaSV[JDPmQYy`OhHPlVKHD@kQKGCxGLYOU{FCpFLQNUsEGphPsDC`DPkCKyKU[BPYqZ[ACH\
> APRY");;
gap> M := DigraphMaximumMatching(D);; IsMaximalMatching(D, M);
true
gap> Length(M);
111

# DigraphMaximumMatching: Issue #461, reported by Leonard Soicher on 2021-05-06.
# See https://github.com/digraphs/Digraphs/issues/461
gap> D := DigraphFromGraph6String("Cr");
<immutable symmetric digraph with 4 vertices, 8 edges>
gap> SetDigraphVertexLabels(D, [[11], [21], [12], [22]]);
gap> IsMaximumMatching(D, DigraphMaximumMatching(D));
true

# DigraphNrLoops
gap> D := EmptyDigraph(5);
<immutable empty digraph with 5 vertices>
gap> DigraphNrLoops(D);
0
gap> D := CompleteDigraph(5);
<immutable complete digraph with 5 vertices>
gap> DigraphNrLoops(D);
0
gap> D := Digraph([[23], [14], [335], [], [25]]);
<immutable multidigraph with 5 vertices, 9 edges>
gap> DigraphNrLoops(D);
3
gap> D := Digraph([[2], [3], [12]]);
<immutable digraph with 3 vertices, 4 edges>
gap> DigraphNrLoops(D);
0
gap> D := Digraph([[12], [23], [34], [145], [25]]);
<immutable digraph with 5 vertices, 11 edges>
gap> DigraphNrLoops(D);
5
gap> D := Digraph([[144], [224], [4], [35], [5]]);
<immutable multidigraph with 5 vertices, 10 edges>
gap> DigraphNrLoops(D);
4
gap> D := Digraph(IsMutableDigraph,
>                 [[12], [23], [34], [145], [25]]);
<mutable digraph with 5 vertices, 11 edges>
gap> DigraphNrLoops(D);
5
gap> D;
<mutable digraph with 5 vertices, 11 edges>
gap> D := DigraphByAdjacencyMatrix([
> [121],
> [110],
> [001]]);
<immutable multidigraph with 3 vertices, 7 edges>
gap> DigraphNrLoops(D);
3
gap> D := CompleteDigraph(IsImmutableDigraph, 3);
<immutable complete digraph with 3 vertices>
gap> DigraphHasLoops(D);
false
gap> HasDigraphHasLoops(D) and not DigraphHasLoops(D);
true
gap> DigraphNrLoops(D) = 0;
true

#  DigraphAddAllLoops
gap> gr := CompleteDigraph(10);
<immutable complete digraph with 10 vertices>
gap> OutNeighbours(gr)[1];
2345678910 ]
gap> gr2 := DigraphAddAllLoops(gr);
<immutable reflexive digraph with 10 vertices, 100 edges>
gap> OutNeighbours(gr2)[1];
23456789101 ]
gap> gr3 := DigraphAddAllLoops(gr);
<immutable reflexive digraph with 10 vertices, 100 edges>
gap> OutNeighbours(gr3)[1];
23456789101 ]
gap> gr := EmptyDigraph(100);
<immutable empty digraph with 100 vertices>
gap> DigraphAddAllLoops(gr);
<immutable reflexive digraph with 100 vertices, 100 edges>
gap> gr := Digraph([[123], [2222], [51], [1234], [5]]);
<immutable multidigraph with 5 vertices, 14 edges>
gap> gr2 := DigraphAddAllLoops(gr);
<immutable reflexive multidigraph with 5 vertices, 15 edges>
gap> OutNeighbours(gr2);
[ [ 123 ], [ 2222 ], [ 513 ], [ 1234 ], [ 5 ] ]
gap> D := Digraph(IsImmutableDigraph,
> [[13], [215], [34], [234], [51]]);;
gap> IsReflexiveDigraph(D);
true
gap> IsIdenticalObj(D, DigraphAddAllLoops(D));
false

# DigraphAddAllLoops - mutable
gap> D := Digraph(IsMutableDigraph,
> [[1], [34], [56], [423], [45], [1]]);
<mutable digraph with 6 vertices, 11 edges>
gap> DigraphAddAllLoops(D);
<mutable digraph with 6 vertices, 14 edges>
gap> IsIdenticalObj(last, D);
true
gap> D := Digraph([[1], [34], [56], [423], [45], [1]]);
<immutable digraph with 6 vertices, 11 edges>
gap> DigraphAddAllLoops(D);
<immutable reflexive digraph with 6 vertices, 14 edges>
gap> IsIdenticalObj(last, D);
false
gap> D := Digraph([[1], [34], [56], [423], [45], [1]]);
<immutable digraph with 6 vertices, 11 edges>
gap> D := DigraphAddEdge(D, 13);
<immutable digraph with 6 vertices, 12 edges>
gap> D := DigraphAddEdge(D, 13);
<immutable multidigraph with 6 vertices, 13 edges>
gap> D := DigraphRemoveEdge(D, 13);
Error, the 1st argument <D> must be a digraph with no multiple edges,
gap> D := Digraph([[1], [34], [56], [423], [45], [1]]);
<immutable digraph with 6 vertices, 11 edges>
gap> D := DigraphAddEdge(D, 13);
<immutable digraph with 6 vertices, 12 edges>
gap> D := DigraphRemoveEdge(D, 13);
<immutable digraph with 6 vertices, 11 edges>
gap> D := DigraphRemoveEdge(D, 13);
<immutable digraph with 6 vertices, 11 edges>

# Semimodular lattices
gap> D := DigraphFromDigraph6String("&C[o?");
<immutable digraph with 4 vertices, 5 edges>
gap> IsUpperSemimodularDigraph(D);
false
gap> IsLowerSemimodularDigraph(D);
false
gap> NonUpperSemimodularPair(D);
Error, the argument (a digraph) is not a lattice
gap> NonLowerSemimodularPair(D);
Error, the argument (a digraph) is not a lattice
gap> D := DigraphFromDigraph6String("&K~~]mKaC_EgLb?_?~?g?m?a?b");
<immutable digraph with 12 vertices, 54 edges>
gap> IsUpperSemimodularDigraph(D);
true
gap> NonUpperSemimodularPair(D);
fail
gap> IsLowerSemimodularDigraph(D);
true
gap> NonLowerSemimodularPair(D);
fail
gap> D := DigraphFromDigraph6String("&M~~sc`lYUZO__KIBboC_@h?U_?_GL?A_?c");
<immutable digraph with 14 vertices, 66 edges>
gap> IsUpperSemimodularDigraph(D);
true
gap> IsLowerSemimodularDigraph(D);
false
gap> NonLowerSemimodularPair(D);
109 ]

# DigraphJoinTable and DigraphMeetTable
gap> D := DigraphReflexiveTransitiveClosure(ChainDigraph(4));
<immutable preorder digraph with 4 vertices, 10 edges>
gap> x := PartialOrderDigraphJoinOfVertices(D, 13);
3
gap> y := PartialOrderDigraphMeetOfVertices(D, 32);
2
gap> A := DigraphJoinTable(D);
[ [ 1234 ], [ 2234 ], [ 3334 ], [ 4444 ] ]
gap> B := DigraphMeetTable(D);
[ [ 1111 ], [ 1222 ], [ 1233 ], [ 1234 ] ]
gap> A[13] = x;
true
gap> B[32] = y;
true
gap> D := Digraph(IsMutable, [[23], [4], [4], []]);
<mutable digraph with 4 vertices, 4 edges>
gap> DigraphReflexiveTransitiveClosure(D);
<mutable digraph with 4 vertices, 9 edges>
gap> x := PartialOrderDigraphJoinOfVertices(D, 23);;
gap> y := PartialOrderDigraphMeetOfVertices(D, 23);;
gap> z := PartialOrderDigraphMeetOfVertices(D, 14);;
gap> A := DigraphJoinTable(D);
[ [ 1234 ], [ 2244 ], [ 3434 ], [ 4444 ] ]
gap> B := DigraphMeetTable(D);
[ [ 1111 ], [ 1212 ], [ 1133 ], [ 1234 ] ]
gap> D;
<mutable digraph with 4 vertices, 9 edges>
gap> A[23] = x;
true
gap> B[23] = y;
true
gap> B[14] = z;
true
gap> D := ChainDigraph(3);
<immutable chain digraph with 3 vertices>
gap> DigraphJoinTable(D);
fail
gap> D := DigraphAddVertex(D, 4);
<immutable digraph with 4 vertices, 2 edges>
gap> D := DigraphAddEdge(D, [43]);
<immutable digraph with 4 vertices, 3 edges>
gap> D := DigraphReflexiveTransitiveClosure(D);
<immutable preorder digraph with 4 vertices, 8 edges>
gap> x := PartialOrderDigraphJoinOfVertices(D, 13);;
gap> y := PartialOrderDigraphJoinOfVertices(D, 14);;
gap> z := PartialOrderDigraphJoinOfVertices(D, 12);;
gap> A := DigraphJoinTable(D);
[ [ 1233 ], [ 2233 ], [ 3333 ], [ 3334 ] ]
gap> A[13] = x;
true
gap> A[14] = y;
true
gap> A[12] = z;
true
gap> DigraphMeetTable(D);
fail
gap> D := DigraphFromDigraph6String(
> "&Q~~~VObJJtD?BB?`@?@?~~?Ob?Jt?E^?AT?@p??`??P??N??D??B??@");
<immutable digraph with 18 vertices, 97 edges>
gap> x := PartialOrderDigraphJoinOfVertices(D, 48);;
gap> y := PartialOrderDigraphJoinOfVertices(D, 110);;
gap> z := PartialOrderDigraphMeetOfVertices(D, 1415);;
gap> A := DigraphJoinTable(D);;
gap> B := DigraphMeetTable(D);;
gap> A[48] = x;
true
gap> A[110] = y;
true
gap> B[1415] = z;
true

# DigraphAbsorptionProbabilities
gap> gr := Digraph([[234], [3], [2], []]);
<immutable digraph with 4 vertices, 5 edges>
gap> DigraphStronglyConnectedComponents(gr).comps;  # this ordering is used
[ [ 23 ], [ 4 ], [ 1 ] ]
gap> DigraphAbsorptionProbabilities(gr);
[ [ 2/31/30 ], [ 100 ], [ 100 ], [ 010 ] ]
gap> DigraphAbsorptionProbabilities(EmptyDigraph(0));
[  ]
gap> DigraphAbsorptionProbabilities(EmptyDigraph(1));
[ [ 1 ] ]
gap> DigraphAbsorptionProbabilities(CompleteDigraph(5));
[ [ 1 ], [ 1 ], [ 1 ], [ 1 ], [ 1 ] ]
gap> DigraphAbsorptionProbabilities(ChainDigraph(4));
[ [ 0001 ], [ 0001 ], [ 0001 ], [ 0001 ] ]
gap> DigraphAbsorptionProbabilities(CycleDigraph(5));
[ [ 1 ], [ 1 ], [ 1 ], [ 1 ], [ 1 ] ]
gap> gr := ChainDigraph(250);;
gap> probs := DigraphAbsorptionProbabilities(gr);;
gap> scc := DigraphStronglyConnectedComponents(gr);;
gap> sink := DigraphSinks(gr)[1];;
gap> ForAll(probs,  # all zeros except for the sink
>           v -> ForAll([1 .. 250],
>                       comp -> v[comp] = 0
>                       or (v[comp] = 1 and scc.id[comp] = sink)));
true
gap> gr := Digraph([[1], []]);;
gap> DigraphAbsorptionProbabilities(gr);
[ [ 10 ], [ 01 ] ]

# DigraphAbsorptionExpectedSteps
gap> DigraphAbsorptionExpectedSteps(Digraph([[2], [3], [2]]));
100 ]
gap> DigraphAbsorptionExpectedSteps(Digraph([]));
[  ]
gap> DigraphAbsorptionExpectedSteps(Digraph([[1]]));
0 ]
gap> DigraphAbsorptionExpectedSteps(Digraph([[12], [2]]));
20 ]
gap> DigraphAbsorptionExpectedSteps(ChainDigraph(5));
43210 ]
gap> DigraphAbsorptionExpectedSteps(CompleteDigraph(5));
00000 ]

# DigraphAbsorptionExpectedSteps: mutable digraphs
gap> gr := Digraph(IsMutableDigraph, [[12], [2]]);;
gap> IsMutableDigraph(gr);
true
gap> DigraphAbsorptionExpectedSteps(gr);
20 ]
gap> DigraphAbsorptionExpectedSteps(gr);
20 ]
gap> DigraphAddEdge(gr, [21]);;
gap> DigraphAbsorptionExpectedSteps(gr);
00 ]
gap> DigraphAbsorptionExpectedSteps(gr);
00 ]

# Absorption motivating example: game of 'Soccer Dice'
gap> soccer := Digraph([[723514],
>                       [723554],
>                       [755551],
>                       [772555],
>                       [667774],
>                       [], []]);;
gap> DigraphStronglyConnectedComponents(soccer).comps;  # this ordering is used
[ [ 7 ], [ 6 ], [ 12354 ] ]
gap> DigraphAbsorptionProbabilities(soccer) =
>     [[3473 / 44931020 / 44930],
>      [3365 / 44931128 / 44930],
>      [3211 / 44931282 / 44930],
>      [3471 / 44931022 / 44930],
>      [2825 / 44931668 / 44930],
>      [010],
>      [100]];
true
gap> DigraphAbsorptionExpectedSteps(soccer);
13026/449311868/449310716/44939510/44936078/449300 ]

# Absorption motivating example: a flea on the vertices of a dodecahedron.
gap> gr := Digraph("dodecahedral");;
gap> gr := DigraphRemoveEdges(gr, List(OutNeighbours(gr)[1], v -> [1, v]));
<immutable digraph with 20 vertices, 57 edges>
gap> DigraphAbsorptionExpectedSteps(gr)[1];
0
gap> DigraphAbsorptionExpectedSteps(gr)[2];
19

# Test Digraphs above the max size
gap> DigraphHomomorphism(NullDigraph(65555), NullDigraph(1));
Error, the 1st argument <digraph1> must have at most 65534 vertices, found 655\
55,
gap> DigraphHomomorphism(NullDigraph(1), NullDigraph(65555));
Error, the 2nd argument <digraph2> must have at most 65534 vertices, found 655\
55,

# Test Digraph hashing
# This has a small chance to randomly fail. Sorry if it does!
gap> D1 := RandomMultiDigraph(100);;
gap> D2 := Digraph(List(OutNeighbours(D1), x -> Shuffle(ShallowCopy(x))));;
gap> D1 = D2;
true
gap> OutNeighbours(D1) = OutNeighbours(D2);
false
gap> DigraphHash(D1) = DigraphHash(D2);
true
gap> while D1 = D2 do
> D2 := RandomMultiDigraph(100);
> od;;
gap> DigraphHash(D1) = DigraphHash(D2);
false

#
gap> DIGRAPHS_StopTest();
gap> STOP_TEST("Digraphs package: standard/attr.tst", 0);

[Dauer der Verarbeitung: 0.297 Sekunden, vorverarbeitet 2026-06-16]

                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik