-
Notifications
You must be signed in to change notification settings - Fork 66
Expand file tree
/
Copy pathexamples.xml
More file actions
1688 lines (1458 loc) · 59.2 KB
/
examples.xml
File metadata and controls
1688 lines (1458 loc) · 59.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#############################################################################
##
#W examples.xml
#Y Copyright (C) 2019-21 Murray T. Whyte
##
## Licensing information can be found in the README file of this package.
##
#############################################################################
##
<#GAPDoc Label="EmptyDigraph">
<ManSection>
<Oper Name="EmptyDigraph" Arg="[filt, ]n"/>
<Oper Name="NullDigraph" Arg="[filt, ]n"/>
<Returns>A digraph.</Returns>
<Description>
If <A>n</A> is a non-negative integer, this function returns the
<E>empty</E> or <E>null</E> digraph with <A>n</A> vertices. An empty
digraph is one with no edges. <P/>
<C>NullDigraph</C> is a synonym for <C>EmptyDigraph</C>. <P/>
&STANDARD_FILT_TEXT;
<Example><![CDATA[
gap> EmptyDigraph(20);
<immutable empty digraph with 20 vertices>
gap> NullDigraph(10);
<immutable empty digraph with 10 vertices>
gap> EmptyDigraph(IsMutableDigraph, 10);
<mutable empty digraph with 10 vertices>]]></Example>
</Description>
</ManSection>
<#/GAPDoc>
<#GAPDoc Label="CompleteBipartiteDigraph">
<ManSection>
<Oper Name="CompleteBipartiteDigraph" Arg="[filt, ]m, n"/>
<Returns>A digraph.</Returns>
<Description>
A complete bipartite digraph is a digraph whose vertices
can be partitioned into two non-empty vertex sets, such there exists
a unique edge with source <C>i</C> and range <C>j</C> if and only if
<C>i</C> and <C>j</C> lie in different vertex sets. <P/>
If <A>m</A> and <A>n</A> are positive integers, this function
returns the complete bipartite digraph with vertex sets of sizes
<A>m</A> (containing the vertices <C>[1 .. m]</C>) and
<A>n</A> (containing the vertices <C>[m + 1 .. m + n]</C>).
<P/>
&STANDARD_FILT_TEXT;
<Example><![CDATA[
gap> CompleteBipartiteDigraph(2, 3);
<immutable complete bipartite digraph with bicomponent sizes 2 and 3>
gap> CompleteBipartiteDigraph(IsMutableDigraph, 3, 2);
<mutable digraph with 5 vertices, 12 edges>
]]></Example>
</Description>
</ManSection>
<#/GAPDoc>
<#GAPDoc Label="CompleteMultipartiteDigraph">
<ManSection>
<Oper Name="CompleteMultipartiteDigraph" Arg = "[filt, ]orders"/>
<Returns>A digraph.</Returns>
<Description>
For a list <A>orders</A> of <C>n</C> positive integers,
this function returns the digraph containing <C>n</C> independent sets
of vertices of orders <C>[<A>l</A>[1] .. <A>l</A>[n]]</C>. Moreover,
each vertex is adjacent to every other not contained in the
same independent set.
<P/>
&STANDARD_FILT_TEXT;
<Example><![CDATA[
gap> CompleteMultipartiteDigraph([5, 4, 2]);
<immutable complete multipartite digraph with 11 vertices, 76 edges>
gap> CompleteMultipartiteDigraph(IsMutableDigraph, [5, 4, 2]);
<mutable digraph with 11 vertices, 76 edges>
]]></Example>
</Description>
</ManSection>
<#/GAPDoc>
<#GAPDoc Label="CompleteDigraph">
<ManSection>
<Oper Name="CompleteDigraph" Arg="[filt, ]n"/>
<Returns>A digraph.</Returns>
<Description>
If <A>n</A> is a non-negative integer, this function returns the complete
digraph with <A>n</A> vertices. See <Ref Prop="IsCompleteDigraph"/>. <P/>
&STANDARD_FILT_TEXT;
<Example><![CDATA[
gap> CompleteDigraph(20);
<immutable complete digraph with 20 vertices>
gap> CompleteDigraph(IsMutableDigraph, 10);
<mutable digraph with 10 vertices, 90 edges>
]]></Example>
</Description>
</ManSection>
<#/GAPDoc>
<#GAPDoc Label="ChainDigraph">
<ManSection>
<Oper Name="ChainDigraph" Arg="[filt, ]n"/>
<Returns>A digraph.</Returns>
<Description>
If <A>n</A> is a positive integer, this function returns a chain
with <A>n</A> vertices and <C><A>n</A> - 1</C> edges.
Specifically,
for each vertex <C>i</C> (with <C>i</C> < <C>n</C>), there is a directed
edge with source <C>i</C> and range <C>i + 1</C>. <P/>
The <Ref Oper="DigraphReflexiveTransitiveClosure"/> of a chain represents a
total order. <P/>
&STANDARD_FILT_TEXT;
<Example><![CDATA[
gap> ChainDigraph(42);
<immutable chain digraph with 42 vertices>
gap> ChainDigraph(IsMutableDigraph, 10);
<mutable digraph with 10 vertices, 9 edges>
]]></Example>
</Description>
</ManSection>
<#/GAPDoc>
<#GAPDoc Label="CycleDigraph">
<ManSection>
<Oper Name="CycleDigraph" Arg="[filt, ]n"/>
<Oper Name="DigraphCycle" Arg="[filt, ]n"/>
<Returns>A digraph.</Returns>
<Description>
If <A>n</A> is a positive integer, then these functions return a <E>cycle
digraph</E> with <A>n</A> vertices and <A>n</A> edges. Specifically,
for each vertex <C>i</C> (with <C>i</C> < <C>n</C>), there is a directed
edge with source <C>i</C> and range <C>i + 1</C>. In addition, there is
an edge with source <C>n</C> and range <C>1</C>. <P/>
&STANDARD_FILT_TEXT;
<Example><![CDATA[
gap> CycleDigraph(1);
<immutable digraph with 1 vertex, 1 edge>
gap> CycleDigraph(123);
<immutable cycle digraph with 123 vertices>
gap> CycleDigraph(IsMutableDigraph, 10);
<mutable digraph with 10 vertices, 10 edges>
gap> DigraphCycle(4) = CycleDigraph(4);
true
]]></Example>
</Description>
</ManSection>
<#/GAPDoc>
<#GAPDoc Label="JohnsonDigraph">
<ManSection>
<Oper Name="JohnsonDigraph" Arg="[filt, ]n, k"/>
<Returns>A digraph.</Returns>
<Description>
If <A>n</A> and <A>k</A> are non-negative integers, then this operation
returns a symmetric digraph which corresponds to the undirected <E>Johnson
graph</E> <M>J(n, k)</M>. <P/>
The <E>Johnson graph</E> <M>J(n, k)</M> has vertices given by all the
<A>k</A>-subsets of the range <C>[1 .. <A>n</A>]</C>, and two vertices are
connected by an edge if and only if their intersection has size
<M><A>k</A> - 1</M>. <P/>
&STANDARD_FILT_TEXT;
<Example><![CDATA[
gap> gr := JohnsonDigraph(3, 1);
<immutable symmetric digraph with 3 vertices, 6 edges>
gap> OutNeighbours(gr);
[ [ 2, 3 ], [ 1, 3 ], [ 1, 2 ] ]
gap> gr := JohnsonDigraph(4, 2);
<immutable symmetric digraph with 6 vertices, 24 edges>
gap> OutNeighbours(gr);
[ [ 2, 3, 4, 5 ], [ 1, 3, 4, 6 ], [ 1, 2, 5, 6 ], [ 1, 2, 5, 6 ],
[ 1, 3, 4, 6 ], [ 2, 3, 4, 5 ] ]
gap> JohnsonDigraph(1, 0);
<immutable empty digraph with 1 vertex>
gap> JohnsonDigraph(IsMutableDigraph, 1, 0);
<mutable empty digraph with 1 vertex>
]]></Example>
</Description>
</ManSection>
<#/GAPDoc>
<#GAPDoc Label="PetersenGraph">
<ManSection>
<Oper Name="PetersenGraph" Arg="[filt]"/>
<Returns>A digraph.</Returns>
<Description>
From <URL>https://en.wikipedia.org/wiki/Petersen_graph</URL>:<P/>
<Q>The Petersen graph is an undirected graph with 10 vertices and 15 edges.
It is a small graph that serves as a useful example and counterexample for
many problems in graph theory. The Petersen graph is named after Julius
Petersen, who in 1898 constructed it to be the smallest bridgeless cubic
graph with no three-edge-coloring.</Q><P/>
See also <Ref Oper="GeneralisedPetersenGraph"/>. <P/>
&STANDARD_FILT_TEXT;
<Example><![CDATA[
gap> ChromaticNumber(PetersenGraph());
3
gap> PetersenGraph(IsMutableDigraph);
<mutable digraph with 10 vertices, 30 edges>
]]></Example>
</Description>
</ManSection>
<#/GAPDoc>
<#GAPDoc Label="GeneralisedPetersenGraph">
<ManSection>
<Oper Name="GeneralisedPetersenGraph" Arg="[filt, ]n, k"/>
<Returns>A digraph.</Returns>
<Description>
If <A>n</A> is a positive integer and <A>k</A> is a non-negative
integer less than <C><A>n</A> / 2</C>, then this operation returns
the <E>generalised Petersen graph</E> <M>GPG(<A>n</A>, k)</M>. <P/>
From
<URL>https://en.wikipedia.org/wiki/Generalized_Petersen_graph</URL>:
<P/>
<Q>The generalized Petersen graphs are a family of cubic
graphs formed by connecting the vertices of a regular polygon to the
corresponding vertices of a star polygon. They include the Petersen graph
and generalize one of the ways of constructing the Petersen graph. The
generalized Petersen graph family was introduced in 1950 by H. S. M.
Coxeter and was given its name in 1969 by Mark Watkins.</Q>
<P/>
See also <Ref Oper="PetersenGraph"/>. <P/>
&STANDARD_FILT_TEXT;
<Example><![CDATA[
gap> GeneralisedPetersenGraph(7, 2);
<immutable symmetric digraph with 14 vertices, 42 edges>
gap> GeneralisedPetersenGraph(40, 1);
<immutable symmetric digraph with 80 vertices, 240 edges>
gap> D := GeneralisedPetersenGraph(5, 2);
<immutable symmetric digraph with 10 vertices, 30 edges>
gap> IsIsomorphicDigraph(D, PetersenGraph());
true
gap> GeneralisedPetersenGraph(IsMutableDigraph, 9, 4);
<mutable digraph with 18 vertices, 54 edges>
]]></Example>
</Description>
</ManSection>
<#/GAPDoc>
<#GAPDoc Label="LollipopGraph">
<ManSection>
<Oper Name="LollipopGraph" Arg="[filt, ]m, n"/>
<Returns>A digraph.</Returns>
<Description>
If <A>m</A> and <A>n</A> are positive integers,
then this operation returns the <E>(<A>m</A>,<A>n</A>)-lollipop graph</E>.
As defined at <URL>https://en.wikipedia.org/wiki/Lollipop_graph</URL>,
this consists of a complete digraph on the vertices <C>[1..<A>m</A>]</C>
(the 'head' of the lollipop),
and the symmetric closure of a chain digraph on the remaining <A>n</A>
vertices (the 'stick'),
connected by a bridge
(the edge <C>[<A>m</A>, <A>m</A>+1]</C> and its reverse). <P/>
&STANDARD_FILT_TEXT;
<Example><![CDATA[
gap> D := LollipopGraph(5, 3);
<immutable connected symmetric digraph with 8 vertices, 26 edges>
gap> CliqueNumber(D);
5
gap> DigraphUndirectedGirth(D);
3
gap> LollipopGraph(IsMutableDigraph, 3, 8);
<mutable digraph with 11 vertices, 22 edges>
]]></Example>
</Description>
</ManSection>
<#/GAPDoc>
<#GAPDoc Label="SquareGridGraph">
<ManSection>
<Oper Name="SquareGridGraph" Arg="[filt, ]n, k"/>
<Oper Name="GridGraph" Arg="[filt, ]n, k"/>
<Returns>A digraph.</Returns>
<Description>
If <A>n</A> and <A>k</A> are positive integers, then this operation returns
a square grid graph of dimension <A>n</A> by <A>k</A>. <P/>
A <E>square grid graph</E> of dimension <A>n</A> by <A>k</A> is the
<Ref Func="DigraphCartesianProduct"
Label="for a positive number of digraphs" /> of the
symmetric closures of the chain digraphs with <A>n</A> and <A>k</A>
vertices; see <Ref Oper="DigraphSymmetricClosure"/> and
<Ref Oper="ChainDigraph"/>. <P/>
In particular, the <C><A>n</A> * <A>k</A></C> vertices can be arranged
into an <A>n</A> by <A>k</A> grid such that two vertices are adjacent in
the digraph if and only if they are orthogonally adjacent in the grid.
The correspondence between vertices and grid positions is given by
<Ref Oper="DigraphVertexLabels"/>. <P/>
See <URL>https://en.wikipedia.org/wiki/Lattice_graph</URL>
for more information. <P/>
&STANDARD_FILT_TEXT;
<Example><![CDATA[
gap> SquareGridGraph(5, 5);
<immutable planar connected bipartite symmetric digraph with bicompone\
nt sizes 13 and 12>
gap> GridGraph(IsMutable, 3, 4);
<mutable digraph with 12 vertices, 34 edges>
]]></Example>
</Description>
</ManSection>
<#/GAPDoc>
<#GAPDoc Label="TriangularGridGraph">
<ManSection>
<Oper Name="TriangularGridGraph" Arg="[filt, ]n, k"/>
<Returns>A digraph.</Returns>
<Description>
If <A>n</A> and <A>k</A> are positive integers, then this operation returns
a triangular grid graph of dimension <A>n</A> by <A>k</A>. <P/>
A <E>triangular grid graph</E> of dimension <A>n</A> by <A>k</A> is a
symmetric digraph constructed from the <Ref Oper="SquareGridGraph"/> of the
same dimensions, where additionally two vertices are adjacent in the digraph
if they are diagonally adjacent in the grid, on a particular one of the
diagonals.
The correspondence between vertices and grid positions is given by <Ref
Oper="DigraphVertexLabels"/>.
More specifically, the particular diagonal is the one such that,
the vertices corresponding to the grid positions <C>[2,1]</C> and
<C>[1,2]</C> are adjacent (if they exist),
but those corresponding to <C>[1,1]</C> and <C>[2,2]</C> are not. <P/>
See <URL>https://en.wikipedia.org/wiki/Lattice_graph#Other_kinds</URL>
for more information. <P/>
&STANDARD_FILT_TEXT;
<Example><![CDATA[
gap> TriangularGridGraph(3, 3);
<immutable planar connected symmetric digraph with 9 vertices, 32 edge\
s>
gap> TriangularGridGraph(IsMutable, 3, 3);
<mutable digraph with 9 vertices, 32 edges>
]]></Example>
</Description>
</ManSection>
<#/GAPDoc>
<#GAPDoc Label="PancakeGraph">
<ManSection>
<Oper Name="PancakeGraph" Arg="[filt, ]n"/>
<Returns>A digraph.</Returns>
<Description>
If <A>n</A> is a positive integer, then this operation returns
the <E>pancake graph</E> with <M>n!</M> vertices and <M>n!(n - 1)</M>
directed edges. The <M>n</M>th pancake graph is the Cayley graph of the
symmetric group acting on <C>[1 .. <A>n</A>]</C> with respect to the
generating set consisting of the <Q>prefix reversals</Q>. This generating
set consists of the permutations <C>p2</C>, <C>p3</C>, ...,
<C>p<A>n</A></C> where <C>ListPerm(pi, <A>n</A>)</C> is the concatenation
of <C>[i, i - 1 .. 1]</C> and <C>[i + 1 .. <A>n</A>]</C>.
<P/>
If the optional first argument <A>filt</A> is not present, then <Ref
Filt="IsImmutableDigraph"/> is used by default.<P/>
See <URL>https://en.wikipedia.org/wiki/Pancake_graph</URL> for further
details.
<Example><![CDATA[
gap> D := PancakeGraph(5);
<immutable Hamiltonian symmetric digraph with 120 vertices, 480 edges>
gap> DigraphUndirectedGirth(D);
6
gap> ChromaticNumber(D);
3
gap> IsHamiltonianDigraph(D);
true
gap> IsCayleyDigraph(D);
true
gap> IsVertexTransitive(D);
true]]></Example>
</Description>
</ManSection>
<#/GAPDoc>
<#GAPDoc Label="BurntPancakeGraph">
<ManSection>
<Oper Name="BurntPancakeGraph" Arg="[filt, ]n"/>
<Returns>A digraph.</Returns>
<Description>
If <A>n</A> is a positive integer, then this operation returns
the <E>burnt pancake graph</E> with <M>n!</M> vertices and <M>n2^{n}n!</M>
directed edges. The <M>n</M>th burnt pancake graph is the Cayley graph of the
hyperoctahedral group acting on <C>[<A>-n</A> .. -1, 1 .. <A>n</A>]</C> with respect to the
generating set consisting of the <Q>prefix reversals</Q>, which are defined in exactly
the same way as in <Ref Oper="PancakeGraph"/>. The hyperoctahedral group consists of
permutations <M>p</M> acting on <C>[<A>-n</A> .. -1, 1 .. <A>n</A>]</C>, where the image
of every point <M>i</M> in <C>[<A>-n</A> .. -1, 1 .. <A>n</A>]</C> is equal to the
negative of the image of <M>-i</M> under <M>p</M>.
GAP only works with permutations of positive integers and so <C>BurntPancakeGraph</C> returns
the Cayley graph of the hyperoctahedral group acting on <C>[1 .. <A>2n</A>]</C> instead of
<C>[<A>-n</A> .. -1, 1 .. <A>n</A>]</C>.
If the optional first argument <A>filt</A> is not present, then <Ref
Filt="IsImmutableDigraph"/> is used by default.<P/>
See <URL>https://en.wikipedia.org/wiki/Pancake_graph</URL> for further
details.
<Example><![CDATA[
gap> BurntPancakeGraph(3);
<immutable symmetric digraph with 48 vertices, 144 edges>
gap> BurntPancakeGraph(4);
<immutable symmetric digraph with 384 vertices, 1536 edges>
gap> BurntPancakeGraph(5);
<immutable symmetric digraph with 3840 vertices, 19200 edges>
gap> BurntPancakeGraph(IsMutableDigraph, 1);
<mutable digraph with 1 vertex, 1 edge>
]]></Example>
</Description>
</ManSection>
<#/GAPDoc>
<#GAPDoc Label="StarGraph">
<ManSection>
<Oper Name="StarGraph" Arg="[filt, ]k"/>
<Returns>A digraph.</Returns>
<Description>
If <A>k</A> is a positive integer, then this operation returns the
<E>star graph</E> with <A>k</A> vertices, which is the
undirected tree in which vertex <C>1</C> is adjacent to all other
vertices. If <A>k</A> is at least <C>2</C>, then this is the complete
bipartite digraph with bicomponents
<C>[1]</C> and <C>[2 .. <A>k</A>]</C>. <P/>
See <Ref Prop="IsUndirectedTree"/>, <Ref Prop="IsCompleteBipartiteDigraph"/>,
and <Ref Attr="DigraphBicomponents"/>. <P/>
&STANDARD_FILT_TEXT;
<Example><![CDATA[
gap> StarGraph(IsMutable, 10);
<mutable digraph with 10 vertices, 18 edges>
gap> StarGraph(5);
<immutable complete bipartite digraph with bicomponent sizes 1 and 4>
gap> IsSymmetricDigraph(StarGraph(3));
true
gap> IsUndirectedTree(StarGraph(3));
true
]]></Example>
</Description>
</ManSection>
<#/GAPDoc>
<#GAPDoc Label="KingsGraph">
<ManSection>
<Oper Name="KingsGraph" Arg="[filt, ]m, n"/>
<Returns>A digraph.</Returns>
<Description>
If <A>m</A> and <A>n</A> are positive integers, then this operation returns
the <E>king's graph</E> of an <A>m</A> by <A>n</A> chessboard,
as a symmetric digraph.
<P/>
The king's graph represents all possible moves of the king chess piece
across a chessboard.
&CHESSBOARD_DEFN;
The king can move only to any orthogonally or diagonally adjacent square.
Thus the <C><A>m</A> * <A>n</A></C> vertices of the king's graph can be
placed onto the <C><A>m</A> * <A>n</A></C> squares of an <A>m</A> by
<A>n</A> chessboard, such that two vertices are adjacent in the digraph if
and only if the corresponding squares are orthogonally or diagonally
adjacent on the chessboard.
<P/>
&CHESSBOARD_LABELS;
See <URL Text="Wikipedia">https://en.wikipedia.org/wiki/King's_graph</URL>
for further information.
See also <Ref Oper="SquareGridGraph"/>, <Ref Oper="TriangularGridGraph"/>,
and <Ref Oper="StrongProduct"/>.
<P/>
&STANDARD_FILT_TEXT;
<Example><![CDATA[
gap> KingsGraph(8, 8);
<immutable connected symmetric digraph with 64 vertices, 420 edges>
gap> D := KingsGraph(IsMutable, 2, 7);
<mutable digraph with 14 vertices, 62 edges>
gap> IsPlanarDigraph(D);
true
gap> D := KingsGraph(3, 3);
<immutable planar connected symmetric digraph with 9 vertices, 40 edge\
s>
gap> OutNeighbors(D);
[ [ 2, 4, 5 ], [ 1, 3, 5, 4, 6 ], [ 2, 6, 5 ], [ 5, 1, 7, 2, 8 ],
[ 4, 6, 2, 8, 3, 7, 1, 9 ], [ 5, 3, 9, 8, 2 ], [ 8, 4, 5 ],
[ 7, 9, 5, 6, 4 ], [ 8, 6, 5 ] ]
gap> IsSubdigraph(QueensGraph(3, 4), KingsGraph(3, 4));
true
]]></Example>
</Description>
</ManSection>
<#/GAPDoc>
<#GAPDoc Label="QueensGraph">
<ManSection>
<Oper Name="QueensGraph" Arg="[filt, ]m, n"/>
<Oper Name="QueenGraph" Arg="[filt, ]m, n"/>
<Returns>A digraph.</Returns>
<Description>
If <A>m</A> and <A>n</A> are positive integers, then this operation returns
the <E>queen's graph</E> of an <A>m</A> by <A>n</A> chessboard,
as a symmetric digraph.
<P/>
The queen's graph represents all possible moves of the queen chess piece
across a chessboard.
&CHESSBOARD_DEFN;
The <C><A>m</A> * <A>n</A></C> vertices of the queen's graph can be placed
onto the <C><A>m</A> * <A>n</A></C> squares of an <A>m</A> by <A>n</A>
chessboard, such that two vertices are adjacent in the digraph if and only
if the queen can move between the corresponding squares in a single turn.
A legal queen's move is defined as one which moves the queen to
an (orthogonally or diagonally) adjacent square, or to a square which can be
reached through a series of such moves, with all of the small moves being
in the same direction.
<P/>
Note that the <Ref Oper="QueensGraph"/> is the
<Ref Func="DigraphEdgeUnion" Label="for a list of digraphs"/>
of the <Ref Oper="RooksGraph"/> and the <Ref Oper="BishopsGraph"/> of the
same dimensions.
<P/>
&CHESSBOARD_LABELS;
&STANDARD_FILT_TEXT;
<Example><![CDATA[
gap> QueensGraph(2, 5);
<immutable connected symmetric digraph with 10 vertices, 66 edges>
gap> D := QueensGraph(4, 3);
<immutable connected symmetric digraph with 12 vertices, 92 edges>
gap> IsRegularDigraph(D);
false
gap> QueensGraph(6, 9) =
> DigraphEdgeUnion(RooksGraph(6, 9), BishopsGraph(6, 9));
true
]]></Example>
</Description>
</ManSection>
<#/GAPDoc>
<#GAPDoc Label="RooksGraph">
<ManSection>
<Oper Name="RooksGraph" Arg="[filt, ]m, n"/>
<Oper Name="RookGraph" Arg="[filt, ]m, n"/>
<Returns>A digraph.</Returns>
<Description>
If <A>m</A> and <A>n</A> are positive integers, then this operation returns
the <E>rook's graph</E> of an <A>m</A> by <A>n</A> chessboard,
as a symmetric digraph.
<P/>
A rook's graph represents all possible moves of the rook chess piece
across a chessboard.
&CHESSBOARD_DEFN;
The <C><A>m</A> * <A>n</A></C> vertices of the rook's graph can be placed
onto the <C><A>m</A> * <A>n</A></C> squares of an <A>m</A> by <A>n</A>
chessboard, such that two vertices are adjacent in the digraph if and only
if a rook can move between the corresponding squares in a single turn.
A legal rook's move is defined as one which moves the rook to
an orthogonally adjacent square, or to a square which can be
reached through a series of such moves, with all of the small moves being
in the same direction.
<P/>
&CHESSBOARD_LABELS;
See <URL Text="Wikipedia">https://en.wikipedia.org/wiki/Rook's_graph</URL>
for further information.
See also
<Ref Func="DigraphCartesianProduct" Label="for a list of digraphs"/> and
<Ref Oper="LineDigraph"/>.
<P/>
&STANDARD_FILT_TEXT;
<Example><![CDATA[
gap> D := RooksGraph(7, 4);
<immutable connected regular symmetric digraph with 28 vertices, 252 e\
dges>
gap> RooksGraph(1, 8);
<immutable connected regular symmetric digraph with 8 vertices, 56 edg\
es>
]]></Example>
</Description>
</ManSection>
<#/GAPDoc>
<#GAPDoc Label="BishopsGraph">
<ManSection>
<Oper Name="BishopsGraph" Arg="[filt, ][color, ]m, n"/>
<Oper Name="BishopGraph" Arg="[filt, ][color, ]m, n"/>
<Returns>A digraph.</Returns>
<Description>
If <A>m</A> and <A>n</A> are positive integers, then this operation returns
the <E>bishop's graph</E> of an <A>m</A> by <A>n</A> chessboard,
as a symmetric digraph.
<P/>
A bishop's graph represents all possible moves of the bishop chess piece
across a chessboard.
&CHESSBOARD_DEFN;
The <C><A>m</A> * <A>n</A></C> vertices of the bishop's graph can be placed
onto the <C><A>m</A> * <A>n</A></C> squares of an <A>m</A> by <A>n</A>
chessboard, such that two vertices are adjacent in the digraph if and only
if a bishop can move between the corresponding squares in a single turn.
A legal bishop's move is defined as any move which moves the bishop piece to
a diagonally adjacent square or to a square which can be reached through a
series of diagonally adjacent squares, with all of these small
moves being in the same direction.<P/>
&CHESSBOARD_LABELS;
If the optional second argument <A>color</A> is present, then this should
be one of the strings <C>"dark"</C>, <C>"light"</C>, or <C>"both"</C>.
The default is <C>"both"</C>.
A bishop on a light square can only move to light squares, and a bishop
on a dark square can only move to dark squares.
This optional argument controls which bishops are represented in the
resulting digraph.
If <A>color</A> is <C>"both"</C>, then the resulting digraph will show all
the vertices of an <A>m</A> by <A>n</A> chessboard, and will be
disconnected (unless <C><A>m</A> = <A>n</A> = 1</C>).
Otherwise, <Ref Oper="BishopsGraph"/> returns the induced subdigraph of this
on the vertices that correspond to either the dark squares or the light
squares, according to the value of <A>color</A>.
<P/>
&STANDARD_FILT_TEXT;
<Example><![CDATA[
gap> BishopsGraph(8, 8);
<immutable symmetric digraph with 64 vertices, 560 edges>
gap> D := BishopsGraph("dark", 3, 5);
<immutable connected symmetric digraph with 8 vertices, 24 edges>
gap> IsConnectedDigraph(D);
true
gap> BishopsGraph("light", 4, 4);
<immutable connected symmetric digraph with 8 vertices, 28 edges>
gap> D := BishopsGraph("both", 1, 5);
<immutable empty digraph with 5 vertices>
]]></Example>
</Description>
</ManSection>
<#/GAPDoc>
<#GAPDoc Label="KnightsGraph">
<ManSection>
<Oper Name="KnightsGraph" Arg="[filt, ]m, n"/>
<Returns>A digraph.</Returns>
<Description>
If <A>m</A> and <A>n</A> are positive integers, then this operation returns
the <E>knight's graph</E> of an <A>m</A> by <A>n</A> chessboard,
as a symmetric digraph.
<P/>
A knight's graph represents all possible moves of the knight chess piece
across a chessboard.
&CHESSBOARD_DEFN;
The <C><A>m</A> * <A>n</A></C> vertices of the knight's graph can be placed
onto the <C><A>m</A> * <A>n</A></C> squares of an <A>m</A> by <A>n</A>
chessboard, such that two vertices are adjacent in the digraph if and only
if a knight can move between the corresponding squares in a single turn.
<P/>
&CHESSBOARD_LABELS;
See <URL Text="Wikipedia">https://en.wikipedia.org/wiki/Knight's_graph</URL>
for further information.
<P/>
&STANDARD_FILT_TEXT;
<Example><![CDATA[
gap> D := KnightsGraph(8, 8);
<immutable connected symmetric digraph with 64 vertices, 336 edges>
gap> IsConnectedDigraph(D);
true
gap> D := KnightsGraph(3, 3);
<immutable symmetric digraph with 9 vertices, 16 edges>
gap> IsConnectedDigraph(D);
false
gap> KnightsGraph(IsMutable, 3, 9);
<mutable digraph with 27 vertices, 88 edges>
]]></Example>
</Description>
</ManSection>
<#/GAPDoc>
<#GAPDoc Label="HaarGraph">
<ManSection>
<Oper Name="HaarGraph" Arg="[filt, ]n"/>
<Returns>A digraph.</Returns>
<Description>
If <A>n</A> is a positive integer then this operation returns
the <E>Haar graph</E> <M>H(<A>n</A>)</M>. <P/>
The number of vertices in the Haar graph <M>H(<A>n</A>)</M> is
equal to twice <M>m</M>, where <M>m</M> is the number of digits
required to represent <A>n</A> in binary.
These vertices are arranged into bicomponents
<C>[1..m]</C> and <C>[m+1..2*m]</C>.
Vertices <M>i</M> and <M>j</M> in different bicomponents are
adjacent by a symmetric pair of edges if and only if
the binary representation of <A>n</A> has a 1 in position
(<M>j-i</M> modulo <M>m</M>) + 1 from the left. <P/>
&STANDARD_FILT_TEXT;
<Example><![CDATA[
gap> HaarGraph(3);
<immutable bipartite vertex-transitive symmetric digraph with bicompon\
ents of size 2>
gap> D := HaarGraph(16);
<immutable bipartite vertex-transitive symmetric digraph with bicompon\
ents of size 5>
]]></Example>
</Description>
</ManSection>
<#/GAPDoc>
<#GAPDoc Label="BananaTree">
<ManSection>
<Oper Name="BananaTree" Arg="[filt, ]n, k"/>
<Returns>A digraph</Returns>
<Description>
If <A>n</A> and <A>k</A> are positive integers
with <A>k</A> greater than <M>1</M>,
then this operation returns the <E>banana tree</E>
with parameters <A>n</A> and <A>k</A>, as defined below. <P/>
From
<URL>https://mathworld.wolfram.com/BananaTree.html</URL>:
<P/>
<Q>An <C>(<A>n</A>,<A>k</A>)</C>-banana tree,
as defined by Chen et al. (1997), is a graph obtained by
connecting one leaf of each of <A>n</A> copies of an <A>k</A>-star graph
with a single root vertex that is distinct from all the stars.</Q>
<P/>
Specifically, in the resulting digraph, vertex <C>1</C> is the 'root',
and for each <C>m</C> in <C>[1 .. <A>k</A>]</C>,
the <C>m</C>th star is on the vertices
<C>[((m - 1) * n) + 2 .. (m * n) + 1]</C>,
with the first of these being the 'centre' of the star,
and the second being the 'leaf' adjacent <C>1</C>. <P/>
See also <Ref Oper="StarGraph"/> and <Ref Prop="IsUndirectedTree"/>. <P/>
&STANDARD_FILT_TEXT;
<Example><![CDATA[
gap> D := BananaTree(2, 4);
<immutable undirected tree with 9 vertices>
gap> D := BananaTree(3, 3);
<immutable undirected tree with 10 vertices>
gap> D := BananaTree(5, 2);
<immutable undirected tree with 11 vertices>
gap> D := BananaTree(3, 4);
<immutable undirected tree with 13 vertices>
]]></Example>
</Description>
</ManSection>
<#/GAPDoc>
<#GAPDoc Label="TadpoleGraph">
<ManSection>
<Oper Name="TadpoleGraph" Arg="[filt, ]m, n"/>
<Returns>A digraph.</Returns>
<Description>
The <E>tadpole graph</E> is the symmetric closure of the disjoint union
of the cycle digraph on <C>[1..<A>m</A>]</C> (the 'head' of the tadpole)
and the chain digraph on <C>[<A>m</A>+1..<A>m</A>+<A>n</A>]</C>
(the 'tail' of the tadpole), along with the additional
edges <C>[1, <A>m</A>+1]</C> and <C>[1, <A>m</A>+1]</C>
which connect the 'head' and the 'tail'. For more details on the tadpole graph
please refer to <URL>https://en.wikipedia.org/wiki/Tadpole_graph</URL>.<P/>
See <Ref Oper="DigraphSymmetricClosure"/>,
<Ref Func="DigraphDisjointUnion" Label="for a list of digraphs"/>,
<Ref Oper="CycleDigraph"/>, and <Ref Oper="ChainDigraph"/>. <P/>
&STANDARD_FILT_TEXT;
<Example><![CDATA[
gap> TadpoleGraph(10, 15);
<immutable symmetric digraph with 25 vertices, 50 edges>
gap> TadpoleGraph(IsMutableDigraph, 5, 6);
<mutable digraph with 11 vertices, 22 edges>
gap> IsSymmetricDigraph(TadpoleGraph(3, 5));
true
]]></Example>
</Description>
</ManSection>
<#/GAPDoc>
<#GAPDoc Label="BookGraph">
<ManSection>
<Oper Name="BookGraph" Arg="[filt, ]m"/>
<Returns>A digraph.</Returns>
<Description>
The <E>book graph</E> is the Cartesian product of a complete digraph with
two vertices (as the "book spine") and the <M><A>m</A>+1</M> star graph (as
the "pages"). For more details on the book graph please refer to
<URL>https://mathworld.wolfram.com/BookGraph.html</URL>.<P/>
See <Ref Func="DigraphCartesianProduct" Label="for a positive number of digraphs"/>,
<Ref Oper="CompleteDigraph"/>, and <Ref Oper="StarGraph"/>. <P/>
&STANDARD_FILT_TEXT;
<Example><![CDATA[
gap> BookGraph(1);
<immutable bipartite symmetric digraph with bicomponents of size 2>
gap> BookGraph(2);
<immutable bipartite symmetric digraph with bicomponents of size 3>
gap> BookGraph(IsMutable, 12);
<mutable digraph with 26 vertices, 74 edges>
gap> BookGraph(7);
<immutable bipartite symmetric digraph with bicomponents of size 8>
gap> IsSymmetricDigraph(BookGraph(24));
true
gap> IsBipartiteDigraph(BookGraph(24));
true
]]></Example>
</Description>
</ManSection>
<#/GAPDoc>
<#GAPDoc Label="StackedBookGraph">
<ManSection>
<Oper Name="StackedBookGraph" Arg="[filt, ]m, n"/>
<Returns>A digraph.</Returns>
<Description>
The <E>stacked book graph</E> is the Cartesian product of the symmetric
closure of the chain digraph with <A>n</A> vertices (as the "book spine")
and the <M><A>m</A>+1</M> star graph (as the "pages").
For more details on the stacked book graph please refer to
<URL>https://mathworld.wolfram.com/StackedBookGraph.html</URL>.<P/>
See <Ref Func="DigraphCartesianProduct" Label="for a positive number of digraphs"/>,
<Ref Oper="DigraphSymmetricClosure"/>, <Ref Oper="ChainDigraph"/>, and
<Ref Oper="StarGraph"/>. <P/>
&STANDARD_FILT_TEXT;
<Example><![CDATA[
gap> StackedBookGraph(1, 1);
<immutable bipartite symmetric digraph with bicomponents of size 1>
gap> StackedBookGraph(1, 2);
<immutable bipartite symmetric digraph with bicomponents of size 2>
gap> StackedBookGraph(3, 4);
<immutable bipartite symmetric digraph with bicomponents of size 8>
gap> StackedBookGraph(IsMutable, 12, 5);
<mutable digraph with 65 vertices, 224 edges>
gap> StackedBookGraph(5, 5);
<immutable bipartite symmetric digraph with bicomponent sizes 13 and 1\
7>
gap> IsSymmetricDigraph(StackedBookGraph(24, 8));
true
gap> IsBipartiteDigraph(StackedBookGraph(24, 8));
true
]]></Example>
</Description>
</ManSection>
<#/GAPDoc>
<#GAPDoc Label="BinaryTree">
<ManSection>
<Oper Name="BinaryTree" Arg="[filt, ]m"/>
<Returns>A digraph.</Returns>
<Description>
This function returns a binary tree of depth <A>m</A> with <C>2 ^ <A>m</A>
- 1</C> vertices. All edges are directed towards the root of the tree,
which is vertex <C>1</C>.
<P/>
Note that <C>BinaryTree(<A>m</A>)</C> is the induced subdigraph of
<C>BinaryTree(<A>m</A>+1)</C> on the vertices <C>[1..2^(<A>m</A>-1)]</C>.
<P/>
&STANDARD_FILT_TEXT;
<Example><![CDATA[
gap> BinaryTree(1);
<immutable empty digraph with 1 vertex>
gap> BinaryTree(8);
<immutable digraph with 255 vertices, 254 edges>
gap> BinaryTree(IsMutableDigraph, 8);
<mutable digraph with 255 vertices, 254 edges>
]]></Example>
</Description>
</ManSection>
<#/GAPDoc>
<#GAPDoc Label="AndrasfaiGraph">
<ManSection>
<Oper Name="AndrasfaiGraph" Arg="[filt, ]n"/>
<Returns>A digraph.</Returns>
<Description>
If <A>n</A> is an integer greater than 0, then this operation returns the
<A>n</A>th <E>Andrasfai graph</E>. The Andrasfai graph is a circulant graph
with <C>3<A>n</A> - 1</C> vertices. The indices of the Andrasfai graph
are given by the numbers between <C>1</C> and <C>3<A>n</A> - 1</C> that are
congruent to <C>1</C> mod <C>3</C> (that is, for each index <M>j</M>, vertex
<M>i</M> is adjacent to the <M>i + j</M>th and <M>i - j</M> vertices). The
graph has <C>6(3<A>n</A> - 1)</C> edges. The graph is triangle free.<P/>
As a circulant graph, the Andrasfai graph is biconnected, cyclic,
Hamiltonian, regular, and vertex transitive.<P/>
See <URL>https://mathworld.wolfram.com/AndrasfaiGraph.html</URL> for further
details.<P/>
&STANDARD_FILT_TEXT;
<Example><![CDATA[
gap> D := AndrasfaiGraph(4);
<immutable Hamiltonian biconnected vertex-transitive symmetric digraph\
with 11 vertices, 44 edges>
gap> IsBiconnectedDigraph(D);
true
gap> IsIsomorphicDigraph(D, CirculantGraph(11, [1, 4, 7, 10]));
true]]></Example>
</Description>
</ManSection>
<#/GAPDoc>
<#GAPDoc Label="BinomialTreeGraph">
<ManSection>
<Oper Name="BinomialTreeGraph" Arg="[filt, ]n"/>
<Returns>A digraph.</Returns>
<Description>
If <A>n</A> is a positive integer then this operation returns the <A>n</A>th
<E>binomial tree graph</E>. The binomial tree graph has <A>n</A> vertices
and <C><A>n</A>-1</C> undirected edges. The vertices of the binomial tree
graph are the numbers from 1 to <A>n</A> in binary representation, with a
vertex <C>v</C> having as a direct parent the vertex with binary
representation the same as <C>v</C> but with the lowest 1-bit cleared. For
example, the vertex <M>011</M> has parent <M>010</M>, and the vertex
<M>010</M> has parent <M>000</M>.<P/>
The binomial tree graph is an undirected tree, and is symmetric as a
digraph.<P/>
See <URL>https://metacpan.org/pod/Graph::Maker::BinomialTree</URL> for
further details.<P/>
&STANDARD_FILT_TEXT;
<Example><![CDATA[
gap> D := BinomialTreeGraph(9);
<immutable undirected tree with 9 vertices>]]></Example>
</Description>
</ManSection>
<#/GAPDoc>
<#GAPDoc Label="BondyGraph">
<ManSection>