Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/GAP/pkg/digraphs/tst/standard/   (GAP Algebra Version 4.15.1©)  Datei vom 27.8.2025 mit Größe 7 kB image not shown  

Quelle  constructors.tst   Sprache: unbekannt

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

#############################################################################
##
#W  standard/constructors.tst
#Y  Copyright (C) 2019                                  James D. Mitchell
##
##  Licensing information can be found in the README file of this package.
##
#############################################################################
##

#@local adj, bddigraph, bdgroup, ddigraph, digraph, gr, gr2, gr3, group, n, out
gap> START_TEST("Digraphs package: standard/constructors.tst");
gap> LoadPackage("digraphs", false);;

#
gap> DIGRAPHS_StartTest();

# BipartiteDoubleDigraph
gap> n := 5;
5
gap> adj := function(x, y)
> return ((x + 1) mod n) = (y mod n);
> end;
function( x, y ) ... end
gap> group := CyclicGroup(IsPermGroup, n);
Group([ (1,2,3,4,5) ])
gap> digraph := Digraph(group, [1 .. n], \^, adj);
<immutable digraph with 5 vertices, 5 edges>
gap> bddigraph := BipartiteDoubleDigraph(digraph);
<immutable digraph with 10 vertices, 10 edges>
gap> bdgroup := DigraphGroup(bddigraph);
Group([ (1,2,3,4,5)(6,7,8,9,10), (1,6)(2,7)(3,8)(4,9)(5,10) ])

#  DoubleDigraph
gap> out := [[234], [], [], []];
[ [ 234 ], [  ], [  ], [  ] ]
gap> group := Group([(23), (24)]);
Group([ (2,3), (2,4) ])
gap> digraph := Digraph(out);
<immutable digraph with 4 vertices, 3 edges>
gap> SetDigraphGroup(digraph, group);
gap> ddigraph := BipartiteDoubleDigraph(digraph);
<immutable digraph with 8 vertices, 6 edges>
gap> DigraphGroup(ddigraph);
Group([ (2,3)(6,7), (2,4)(6,8), (1,5)(2,6)(3,7)(4,8) ])
gap> ddigraph := DoubleDigraph(digraph);
<immutable digraph with 8 vertices, 12 edges>
gap> DigraphGroup(ddigraph);
Group([ (2,3)(6,7), (2,4)(6,8), (1,5)(2,6)(3,7)(4,8) ])

#  (Bipartite)DoubleDigraph with multidigraph
gap> gr := Digraph([[23], [1], []]);;
gap> gr2 := DoubleDigraph(gr);
<immutable digraph with 6 vertices, 12 edges>
gap> OutNeighbours(gr2);
[ [ 2356 ], [ 14 ], [  ], [ 5623 ], [ 41 ], [  ] ]
gap> gr2 := BipartiteDoubleDigraph(gr);
<immutable digraph with 6 vertices, 6 edges>
gap> OutNeighbours(gr2);
[ [ 56 ], [ 4 ], [  ], [ 23 ], [ 1 ], [  ] ]
gap> gr := Digraph([[223], [1], []]);;
gap> gr2 := DoubleDigraph(gr);
<immutable multidigraph with 6 vertices, 16 edges>
gap> OutNeighbours(gr2);
[ [ 223556 ], [ 14 ], [  ], [ 556223 ], [ 41 ], [  ] ]
gap> gr2 := BipartiteDoubleDigraph(gr);
<immutable multidigraph with 6 vertices, 8 edges>
gap> OutNeighbours(gr2);
[ [ 556 ], [ 4 ], [  ], [ 223 ], [ 1 ], [  ] ]

#  DistanceDigraph
gap> out := [[7079103], [7692116], [7793117],
> [7894118], [667188], [89106107], [89108125],
> [90109126], [91109110], [646798], [104115119],
> [100104114], [76120124], [8186113], [81105120],
> [8794121], [8693122], [646572], [118123124],
> [99102105], [8599101], [88117126], [77102121],
> [727597], [9196123], [72108119], [96102108],
> [101107110], [7579111], [656880], [656681],
> [676982], [112125126], [103113125], [6793106],
> [98103118], [70110115], [90105111], [8085112],
> [8287112], [80100123], [82115120], [100106111],
> [114116121], [8592122], [687374], [697495],
> [687077], [697196], [95113114], [97117124],
> [717992], [64109116], [78119122], [9597101],
> [747890], [6694107], [738384], [758487],
> [737689], [848691], [839899], [8388104],
> [101853], [183031], [53157], [103235],
> [304648], [324749], [13748], [54952],
> [182426], [465860], [464756], [242959],
> [21360], [32348], [45456], [12952],
> [303941], [141531], [324042], [586263],
> [585961], [213945], [141761], [164059],
> [52263], [6760], [83856], [92561], [24552],
> [31735], [41657], [475055], [252749],
> [245155], [103662], [202162], [124143], [212855],
> [202327], [13436], [111263], [152038],
> [63543], [62857], [72627], [8953], [92837],
> [293843], [333940], [143450], [124450],
> [113742], [24453], [32251], [41936],
> [112654], [131542], [162344], [174554],
> [192541], [131951], [73334], [82233]];;
gap> digraph := Digraph(out);
<immutable digraph with 126 vertices, 378 edges>
gap> DigraphDiameter(digraph);
6
gap> DistanceDigraph(digraph, 4);
<immutable digraph with 126 vertices, 3024 edges>
gap> DistanceDigraph(digraph, [135]);
<immutable digraph with 126 vertices, 7938 edges>
gap> gr := DistanceDigraph(digraph, 0);
<immutable digraph with 126 vertices, 126 edges>
gap> OutNeighbours(gr) = List([1 .. 126], x -> [x]);
true

#  DistanceDigraph with known automorphisms
gap> gr := Digraph([[12], [], [23]]);;
gap> DigraphGroup(gr) = Group((13));
true
gap> OutNeighbours(DistanceDigraph(gr, 0));
[ [ 1 ], [ 2 ], [ 3 ] ]
gap> OutNeighbours(DistanceDigraph(gr, 1));
[ [ 2 ], [  ], [ 2 ] ]
gap> OutNeighbours(DistanceDigraph(gr, 2));
[ [  ], [  ], [  ] ]

#  DistanceDigraph: bad input
gap> gr := Digraph([[12], [23], [4], [1]]);;
gap> DistanceDigraph(gr, -2);
Error, the 2nd argument <distance> must be a non-negative integer,

#  LineDigraph
gap> gr := LineUndirectedDigraph(CompleteDigraph(3));
<immutable digraph with 3 vertices, 6 edges>
gap> gr = CompleteDigraph(3);
true
gap> gr := LineDigraph(CompleteDigraph(3));
<immutable digraph with 6 vertices, 12 edges>
gap> OutNeighbours(gr);
[ [ 34 ], [ 56 ], [ 12 ], [ 65 ], [ 21 ], [ 43 ] ]
gap> gr := LineUndirectedDigraph(CompleteDigraph(4));;
gap> OutNeighbours(gr);
[ [ 2453 ], [ 3641 ], [ 5126 ], [ 5621 ], 
  [ 1364 ], [ 2354 ] ]
gap> gr := Digraph([[24], [134], [24], [123]]);
<immutable digraph with 4 vertices, 10 edges>
gap> gr2 := LineUndirectedDigraph(gr);
<immutable digraph with 5 vertices, 16 edges>
gap> OutNeighbours(gr2);
[ [ 234 ], [ 145 ], [ 145 ], [ 1235 ], [ 234 ] ]
gap> gr := Digraph([[24], [3], [124], [3]]);
<immutable digraph with 4 vertices, 7 edges>
gap> gr2 := LineDigraph(gr);
<immutable digraph with 7 vertices, 12 edges>
gap> OutNeighbours(gr2);
[ [ 3 ], [ 7 ], [ 456 ], [ 12 ], [ 3 ], [ 7 ], [ 456 ] ]
gap> gr := CompleteDigraph(6);;
gap> gr2 := LineUndirectedDigraph(gr);
<immutable digraph with 15 vertices, 120 edges>
gap> DigraphGroup(gr) = SymmetricGroup(6);
true
gap> gr3 := LineUndirectedDigraph(gr);
<immutable digraph with 15 vertices, 120 edges>
gap> gr2 = gr3;
true
gap> gr := CycleDigraph(8);
<immutable cycle digraph with 8 vertices>
gap> gr2 := LineDigraph(gr);
<immutable digraph with 8 vertices, 8 edges>
gap> DigraphGroup(gr);
Group([ (1,2,3,4,5,6,7,8) ])
gap> gr3 := LineDigraph(gr);
<immutable digraph with 8 vertices, 8 edges>
gap> gr2 = gr3;
true
gap> gr := ChainDigraph(4);
<immutable chain digraph with 4 vertices>
gap> LineUndirectedDigraph(gr);
Error, the argument <D> must be a symmetric digraph,

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

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