passagemath-graphs 10.6.1rc1__cp310-cp310-musllinux_1_2_aarch64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- passagemath_graphs-10.6.1rc1.dist-info/METADATA +292 -0
- passagemath_graphs-10.6.1rc1.dist-info/RECORD +260 -0
- passagemath_graphs-10.6.1rc1.dist-info/WHEEL +5 -0
- passagemath_graphs-10.6.1rc1.dist-info/top_level.txt +2 -0
- passagemath_graphs.libs/libgcc_s-69c45f16.so.1 +0 -0
- passagemath_graphs.libs/libgmp-8e78bd9b.so.10.5.0 +0 -0
- passagemath_graphs.libs/libstdc++-1f1a71be.so.6.0.33 +0 -0
- sage/all__sagemath_graphs.py +39 -0
- sage/combinat/abstract_tree.py +2723 -0
- sage/combinat/all__sagemath_graphs.py +34 -0
- sage/combinat/binary_tree.py +5306 -0
- sage/combinat/cluster_algebra_quiver/all.py +22 -0
- sage/combinat/cluster_algebra_quiver/cluster_seed.py +5208 -0
- sage/combinat/cluster_algebra_quiver/interact.py +124 -0
- sage/combinat/cluster_algebra_quiver/mutation_class.py +625 -0
- sage/combinat/cluster_algebra_quiver/mutation_type.py +1555 -0
- sage/combinat/cluster_algebra_quiver/quiver.py +2290 -0
- sage/combinat/cluster_algebra_quiver/quiver_mutation_type.py +2468 -0
- sage/combinat/designs/MOLS_handbook_data.py +570 -0
- sage/combinat/designs/all.py +58 -0
- sage/combinat/designs/bibd.py +1655 -0
- sage/combinat/designs/block_design.py +1071 -0
- sage/combinat/designs/covering_array.py +269 -0
- sage/combinat/designs/covering_design.py +530 -0
- sage/combinat/designs/database.py +5615 -0
- sage/combinat/designs/design_catalog.py +122 -0
- sage/combinat/designs/designs_pyx.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/combinat/designs/designs_pyx.pxd +21 -0
- sage/combinat/designs/designs_pyx.pyx +993 -0
- sage/combinat/designs/difference_family.py +3951 -0
- sage/combinat/designs/difference_matrices.py +279 -0
- sage/combinat/designs/evenly_distributed_sets.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/combinat/designs/evenly_distributed_sets.pyx +661 -0
- sage/combinat/designs/ext_rep.py +1064 -0
- sage/combinat/designs/gen_quadrangles_with_spread.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/combinat/designs/gen_quadrangles_with_spread.pyx +339 -0
- sage/combinat/designs/group_divisible_designs.py +361 -0
- sage/combinat/designs/incidence_structures.py +2357 -0
- sage/combinat/designs/latin_squares.py +581 -0
- sage/combinat/designs/orthogonal_arrays.py +2244 -0
- sage/combinat/designs/orthogonal_arrays_build_recursive.py +1780 -0
- sage/combinat/designs/orthogonal_arrays_find_recursive.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/combinat/designs/orthogonal_arrays_find_recursive.pyx +967 -0
- sage/combinat/designs/resolvable_bibd.py +815 -0
- sage/combinat/designs/steiner_quadruple_systems.py +1306 -0
- sage/combinat/designs/subhypergraph_search.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/combinat/designs/subhypergraph_search.pyx +530 -0
- sage/combinat/designs/twographs.py +306 -0
- sage/combinat/finite_state_machine.py +14874 -0
- sage/combinat/finite_state_machine_generators.py +2006 -0
- sage/combinat/graph_path.py +448 -0
- sage/combinat/interval_posets.py +3908 -0
- sage/combinat/nu_tamari_lattice.py +269 -0
- sage/combinat/ordered_tree.py +1446 -0
- sage/combinat/posets/all.py +46 -0
- sage/combinat/posets/bubble_shuffle.py +247 -0
- sage/combinat/posets/cartesian_product.py +493 -0
- sage/combinat/posets/d_complete.py +182 -0
- sage/combinat/posets/elements.py +273 -0
- sage/combinat/posets/forest.py +30 -0
- sage/combinat/posets/hasse_cython.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/combinat/posets/hasse_cython.pyx +174 -0
- sage/combinat/posets/hasse_diagram.py +3672 -0
- sage/combinat/posets/hochschild_lattice.py +158 -0
- sage/combinat/posets/incidence_algebras.py +794 -0
- sage/combinat/posets/lattices.py +5117 -0
- sage/combinat/posets/linear_extension_iterator.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/combinat/posets/linear_extension_iterator.pyx +292 -0
- sage/combinat/posets/linear_extensions.py +1037 -0
- sage/combinat/posets/mobile.py +275 -0
- sage/combinat/posets/moebius_algebra.py +776 -0
- sage/combinat/posets/poset_examples.py +2178 -0
- sage/combinat/posets/posets.py +9360 -0
- sage/combinat/rooted_tree.py +1070 -0
- sage/combinat/shard_order.py +239 -0
- sage/combinat/tamari_lattices.py +384 -0
- sage/combinat/yang_baxter_graph.py +923 -0
- sage/databases/all__sagemath_graphs.py +1 -0
- sage/databases/knotinfo_db.py +1231 -0
- sage/ext_data/all__sagemath_graphs.py +1 -0
- sage/ext_data/graphs/graph_plot_js.html +330 -0
- sage/ext_data/kenzo/CP2.txt +45 -0
- sage/ext_data/kenzo/CP3.txt +349 -0
- sage/ext_data/kenzo/CP4.txt +4774 -0
- sage/ext_data/kenzo/README.txt +49 -0
- sage/ext_data/kenzo/S4.txt +20 -0
- sage/graphs/all.py +42 -0
- sage/graphs/asteroidal_triples.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/asteroidal_triples.pyx +320 -0
- sage/graphs/base/all.py +1 -0
- sage/graphs/base/boost_graph.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/base/boost_graph.pxd +106 -0
- sage/graphs/base/boost_graph.pyx +3045 -0
- sage/graphs/base/c_graph.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/base/c_graph.pxd +106 -0
- sage/graphs/base/c_graph.pyx +5096 -0
- sage/graphs/base/dense_graph.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/base/dense_graph.pxd +28 -0
- sage/graphs/base/dense_graph.pyx +801 -0
- sage/graphs/base/graph_backends.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/base/graph_backends.pxd +5 -0
- sage/graphs/base/graph_backends.pyx +797 -0
- sage/graphs/base/overview.py +85 -0
- sage/graphs/base/sparse_graph.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/base/sparse_graph.pxd +90 -0
- sage/graphs/base/sparse_graph.pyx +1653 -0
- sage/graphs/base/static_dense_graph.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/base/static_dense_graph.pxd +5 -0
- sage/graphs/base/static_dense_graph.pyx +1032 -0
- sage/graphs/base/static_sparse_backend.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/base/static_sparse_backend.pxd +27 -0
- sage/graphs/base/static_sparse_backend.pyx +1583 -0
- sage/graphs/base/static_sparse_graph.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/base/static_sparse_graph.pxd +37 -0
- sage/graphs/base/static_sparse_graph.pyx +1375 -0
- sage/graphs/bipartite_graph.py +2732 -0
- sage/graphs/centrality.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/centrality.pyx +1038 -0
- sage/graphs/cographs.py +519 -0
- sage/graphs/comparability.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/comparability.pyx +851 -0
- sage/graphs/connectivity.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/connectivity.pxd +157 -0
- sage/graphs/connectivity.pyx +4813 -0
- sage/graphs/convexity_properties.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/convexity_properties.pxd +16 -0
- sage/graphs/convexity_properties.pyx +870 -0
- sage/graphs/digraph.py +4754 -0
- sage/graphs/digraph_generators.py +1993 -0
- sage/graphs/distances_all_pairs.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/distances_all_pairs.pxd +12 -0
- sage/graphs/distances_all_pairs.pyx +2938 -0
- sage/graphs/domination.py +1363 -0
- sage/graphs/dot2tex_utils.py +100 -0
- sage/graphs/edge_connectivity.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/edge_connectivity.pyx +1215 -0
- sage/graphs/generators/all.py +1 -0
- sage/graphs/generators/basic.py +1769 -0
- sage/graphs/generators/chessboard.py +538 -0
- sage/graphs/generators/classical_geometries.py +1611 -0
- sage/graphs/generators/degree_sequence.py +235 -0
- sage/graphs/generators/distance_regular.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/generators/distance_regular.pyx +2846 -0
- sage/graphs/generators/families.py +4759 -0
- sage/graphs/generators/intersection.py +565 -0
- sage/graphs/generators/platonic_solids.py +262 -0
- sage/graphs/generators/random.py +2623 -0
- sage/graphs/generators/smallgraphs.py +5741 -0
- sage/graphs/generators/world_map.py +724 -0
- sage/graphs/generic_graph.py +26867 -0
- sage/graphs/generic_graph_pyx.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/generic_graph_pyx.pxd +34 -0
- sage/graphs/generic_graph_pyx.pyx +1673 -0
- sage/graphs/genus.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/genus.pyx +622 -0
- sage/graphs/graph.py +9645 -0
- sage/graphs/graph_coloring.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/graph_coloring.pyx +2284 -0
- sage/graphs/graph_database.py +1177 -0
- sage/graphs/graph_decompositions/all.py +1 -0
- sage/graphs/graph_decompositions/bandwidth.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/graph_decompositions/bandwidth.pyx +428 -0
- sage/graphs/graph_decompositions/clique_separators.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/graph_decompositions/clique_separators.pyx +616 -0
- sage/graphs/graph_decompositions/cutwidth.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/graph_decompositions/cutwidth.pyx +753 -0
- sage/graphs/graph_decompositions/fast_digraph.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/graph_decompositions/fast_digraph.pxd +13 -0
- sage/graphs/graph_decompositions/fast_digraph.pyx +212 -0
- sage/graphs/graph_decompositions/graph_products.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/graph_decompositions/graph_products.pyx +508 -0
- sage/graphs/graph_decompositions/modular_decomposition.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/graph_decompositions/modular_decomposition.pxd +27 -0
- sage/graphs/graph_decompositions/modular_decomposition.pyx +1536 -0
- sage/graphs/graph_decompositions/slice_decomposition.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/graph_decompositions/slice_decomposition.pxd +18 -0
- sage/graphs/graph_decompositions/slice_decomposition.pyx +1106 -0
- sage/graphs/graph_decompositions/tree_decomposition.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/graph_decompositions/tree_decomposition.pxd +17 -0
- sage/graphs/graph_decompositions/tree_decomposition.pyx +1996 -0
- sage/graphs/graph_decompositions/vertex_separation.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/graph_decompositions/vertex_separation.pxd +5 -0
- sage/graphs/graph_decompositions/vertex_separation.pyx +1963 -0
- sage/graphs/graph_editor.py +82 -0
- sage/graphs/graph_generators.py +3314 -0
- sage/graphs/graph_generators_pyx.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/graph_generators_pyx.pyx +95 -0
- sage/graphs/graph_input.py +812 -0
- sage/graphs/graph_latex.py +2064 -0
- sage/graphs/graph_list.py +410 -0
- sage/graphs/graph_plot.py +1756 -0
- sage/graphs/graph_plot_js.py +338 -0
- sage/graphs/hyperbolicity.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/hyperbolicity.pyx +1704 -0
- sage/graphs/hypergraph_generators.py +364 -0
- sage/graphs/independent_sets.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/independent_sets.pxd +13 -0
- sage/graphs/independent_sets.pyx +402 -0
- sage/graphs/isgci.py +1033 -0
- sage/graphs/isoperimetric_inequalities.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/isoperimetric_inequalities.pyx +489 -0
- sage/graphs/line_graph.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/line_graph.pyx +743 -0
- sage/graphs/lovasz_theta.py +77 -0
- sage/graphs/matching.py +1633 -0
- sage/graphs/matching_covered_graph.py +3590 -0
- sage/graphs/orientations.py +1489 -0
- sage/graphs/partial_cube.py +459 -0
- sage/graphs/path_enumeration.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/path_enumeration.pyx +2040 -0
- sage/graphs/pq_trees.py +1129 -0
- sage/graphs/print_graphs.py +201 -0
- sage/graphs/schnyder.py +865 -0
- sage/graphs/spanning_tree.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/spanning_tree.pyx +1457 -0
- sage/graphs/strongly_regular_db.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/strongly_regular_db.pyx +3340 -0
- sage/graphs/traversals.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/traversals.pxd +9 -0
- sage/graphs/traversals.pyx +1872 -0
- sage/graphs/trees.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/trees.pxd +15 -0
- sage/graphs/trees.pyx +310 -0
- sage/graphs/tutte_polynomial.py +713 -0
- sage/graphs/views.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/views.pyx +794 -0
- sage/graphs/weakly_chordal.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/graphs/weakly_chordal.pyx +604 -0
- sage/groups/all__sagemath_graphs.py +1 -0
- sage/groups/perm_gps/all__sagemath_graphs.py +1 -0
- sage/groups/perm_gps/partn_ref/all__sagemath_graphs.py +1 -0
- sage/groups/perm_gps/partn_ref/refinement_graphs.cpython-310-aarch64-linux-gnu.so +0 -0
- sage/groups/perm_gps/partn_ref/refinement_graphs.pxd +38 -0
- sage/groups/perm_gps/partn_ref/refinement_graphs.pyx +1666 -0
- sage/knots/all.py +6 -0
- sage/knots/free_knotinfo_monoid.py +507 -0
- sage/knots/gauss_code.py +291 -0
- sage/knots/knot.py +682 -0
- sage/knots/knot_table.py +284 -0
- sage/knots/knotinfo.py +2900 -0
- sage/knots/link.py +4715 -0
- sage/sandpiles/all.py +13 -0
- sage/sandpiles/examples.py +225 -0
- sage/sandpiles/sandpile.py +6365 -0
- sage/topology/all.py +22 -0
- sage/topology/cell_complex.py +1214 -0
- sage/topology/cubical_complex.py +1976 -0
- sage/topology/delta_complex.py +1806 -0
- sage/topology/filtered_simplicial_complex.py +744 -0
- sage/topology/moment_angle_complex.py +823 -0
- sage/topology/simplicial_complex.py +5160 -0
- sage/topology/simplicial_complex_catalog.py +92 -0
- sage/topology/simplicial_complex_examples.py +1680 -0
- sage/topology/simplicial_complex_homset.py +205 -0
- sage/topology/simplicial_complex_morphism.py +836 -0
- sage/topology/simplicial_set.py +4102 -0
- sage/topology/simplicial_set_catalog.py +55 -0
- sage/topology/simplicial_set_constructions.py +2954 -0
- sage/topology/simplicial_set_examples.py +865 -0
- sage/topology/simplicial_set_morphism.py +1464 -0
@@ -0,0 +1,1611 @@
|
|
1
|
+
# sage_setup: distribution = sagemath-graphs
|
2
|
+
# sage.doctest: needs sage.modules
|
3
|
+
r"""
|
4
|
+
Families of graphs derived from classical geometries over finite fields
|
5
|
+
|
6
|
+
These include graphs of polar spaces, affine polar graphs, graphs
|
7
|
+
related to Hermitean unitals, graphs on nonisotropic points, etc.
|
8
|
+
|
9
|
+
The methods defined here appear in :mod:`sage.graphs.graph_generators`.
|
10
|
+
"""
|
11
|
+
|
12
|
+
# ****************************************************************************
|
13
|
+
# Copyright (C) 2015 Sagemath project
|
14
|
+
#
|
15
|
+
# This program is free software: you can redistribute it and/or modify
|
16
|
+
# it under the terms of the GNU General Public License as published by
|
17
|
+
# the Free Software Foundation, either version 2 of the License, or
|
18
|
+
# (at your option) any later version.
|
19
|
+
# https://www.gnu.org/licenses/
|
20
|
+
# ****************************************************************************
|
21
|
+
|
22
|
+
from sage.graphs.graph import Graph
|
23
|
+
from sage.arith.misc import is_prime_power
|
24
|
+
from sage.rings.finite_rings.finite_field_constructor import FiniteField
|
25
|
+
|
26
|
+
|
27
|
+
def SymplecticPolarGraph(d, q, algorithm=None):
|
28
|
+
r"""
|
29
|
+
Return the Symplectic Polar Graph `Sp(d,q)`.
|
30
|
+
|
31
|
+
The Symplectic Polar Graph `Sp(d,q)` is built from a projective space of
|
32
|
+
dimension `d-1` over a field `F_q`, and a symplectic form `f`. Two vertices
|
33
|
+
`u,v` are made adjacent if `f(u,v)=0`.
|
34
|
+
|
35
|
+
See the page `on symplectic graphs on Andries Brouwer's website
|
36
|
+
<https://www.win.tue.nl/~aeb/graphs/Sp.html>`_.
|
37
|
+
|
38
|
+
INPUT:
|
39
|
+
|
40
|
+
- ``d``, ``q`` -- integers; note that only even values of `d` are accepted
|
41
|
+
by the function
|
42
|
+
|
43
|
+
- ``algorithm`` -- string (default: ``None``); if set to ``'gap'``, then the
|
44
|
+
computation is carried via GAP library interface, computing totally
|
45
|
+
singular subspaces, which is faster for `q>3`. Otherwise it is done
|
46
|
+
directly.
|
47
|
+
|
48
|
+
EXAMPLES:
|
49
|
+
|
50
|
+
Computation of the spectrum of `Sp(6,2)`::
|
51
|
+
|
52
|
+
sage: g = graphs.SymplecticPolarGraph(6, 2)
|
53
|
+
sage: g.is_strongly_regular(parameters=True)
|
54
|
+
(63, 30, 13, 15)
|
55
|
+
sage: set(g.spectrum()) == {-5, 3, 30} # needs sage.rings.number_field
|
56
|
+
True
|
57
|
+
|
58
|
+
The parameters of `Sp(4,q)` are the same as of `O(5,q)`, but they are
|
59
|
+
not isomorphic if `q` is odd::
|
60
|
+
|
61
|
+
sage: G = graphs.SymplecticPolarGraph(4, 3)
|
62
|
+
sage: G.is_strongly_regular(parameters=True)
|
63
|
+
(40, 12, 2, 4)
|
64
|
+
|
65
|
+
sage: # needs sage.libs.gap
|
66
|
+
sage: O = graphs.OrthogonalPolarGraph(5, 3)
|
67
|
+
sage: O.is_strongly_regular(parameters=True)
|
68
|
+
(40, 12, 2, 4)
|
69
|
+
sage: O.is_isomorphic(G)
|
70
|
+
False
|
71
|
+
sage: S = graphs.SymplecticPolarGraph(6, 4, algorithm='gap') # not tested (long time)
|
72
|
+
sage: S.is_strongly_regular(parameters=True) # not tested (long time)
|
73
|
+
(1365, 340, 83, 85)
|
74
|
+
|
75
|
+
TESTS::
|
76
|
+
|
77
|
+
sage: graphs.SymplecticPolarGraph(4,4,algorithm='gap').is_strongly_regular(parameters=True) # needs sage.libs.gap
|
78
|
+
(85, 20, 3, 5)
|
79
|
+
sage: graphs.SymplecticPolarGraph(4,4).is_strongly_regular(parameters=True) # needs sage.libs.pari
|
80
|
+
(85, 20, 3, 5)
|
81
|
+
sage: graphs.SymplecticPolarGraph(4,4,algorithm='blah')
|
82
|
+
Traceback (most recent call last):
|
83
|
+
...
|
84
|
+
ValueError: unknown algorithm!
|
85
|
+
"""
|
86
|
+
if d < 1 or d % 2:
|
87
|
+
raise ValueError("d must be even and greater than 2")
|
88
|
+
|
89
|
+
if algorithm == "gap": # faster for larger (q>3) fields
|
90
|
+
from sage.libs.gap.libgap import libgap
|
91
|
+
G = _polar_graph(d, q, libgap.SymplecticGroup(d, q))
|
92
|
+
|
93
|
+
elif algorithm is None: # faster for small (q<4) fields
|
94
|
+
from sage.modules.free_module import VectorSpace
|
95
|
+
from sage.schemes.projective.projective_space import ProjectiveSpace
|
96
|
+
from sage.matrix.constructor import identity_matrix, block_matrix, zero_matrix
|
97
|
+
|
98
|
+
F = FiniteField(q, "x")
|
99
|
+
M = block_matrix(F, 2, 2,
|
100
|
+
[zero_matrix(F, d/2),
|
101
|
+
identity_matrix(F, d/2),
|
102
|
+
-identity_matrix(F, d/2),
|
103
|
+
zero_matrix(F, d/2)])
|
104
|
+
|
105
|
+
V = VectorSpace(F, d)
|
106
|
+
PV = list(ProjectiveSpace(d - 1, F))
|
107
|
+
G = Graph([[tuple(_) for _ in PV], lambda x, y: V(x)*(M*V(y)) == 0], loops=False)
|
108
|
+
|
109
|
+
else:
|
110
|
+
raise ValueError("unknown algorithm!")
|
111
|
+
|
112
|
+
G.name("Symplectic Polar Graph Sp({},{})".format(d, q))
|
113
|
+
G.relabel()
|
114
|
+
return G
|
115
|
+
|
116
|
+
|
117
|
+
def AffineOrthogonalPolarGraph(d, q, sign='+'):
|
118
|
+
r"""
|
119
|
+
Return the affine polar graph `VO^+(d,q),VO^-(d,q)` or `VO(d,q)`.
|
120
|
+
|
121
|
+
Affine Polar graphs are built from a `d`-dimensional vector space over
|
122
|
+
`F_q`, and a quadratic form which is hyperbolic, elliptic or parabolic
|
123
|
+
according to the value of ``sign``.
|
124
|
+
|
125
|
+
Note that `VO^+(d,q),VO^-(d,q)` are strongly regular graphs, while `VO(d,q)`
|
126
|
+
is not.
|
127
|
+
|
128
|
+
For more information on Affine Polar graphs, see `Affine Polar Graphs page
|
129
|
+
of Andries Brouwer's website <https://www.win.tue.nl/~aeb/graphs/VO.html>`_.
|
130
|
+
|
131
|
+
INPUT:
|
132
|
+
|
133
|
+
- ``d`` -- integer; ``d`` must be even if ``sign is not None``, and odd
|
134
|
+
otherwise
|
135
|
+
|
136
|
+
- ``q`` -- integer; a power of a prime number, as `F_q` must exist
|
137
|
+
|
138
|
+
- ``sign`` -- string (default: ``'+'``); must be equal to ``'+'``, ``'-'``,
|
139
|
+
or ``None`` to compute (respectively) `VO^+(d,q),VO^-(d,q)` or
|
140
|
+
`VO(d,q)`
|
141
|
+
|
142
|
+
.. NOTE::
|
143
|
+
|
144
|
+
The graph `VO^\epsilon(d,q)` is the graph induced by the
|
145
|
+
non-neighbors of a vertex in an :meth:`Orthogonal Polar Graph
|
146
|
+
<OrthogonalPolarGraph>` `O^\epsilon(d+2,q)`.
|
147
|
+
|
148
|
+
EXAMPLES:
|
149
|
+
|
150
|
+
The :meth:`Brouwer-Haemers graph <BrouwerHaemersGraph>` is isomorphic to
|
151
|
+
`VO^-(4,3)`::
|
152
|
+
|
153
|
+
sage: g = graphs.AffineOrthogonalPolarGraph(4,3,"-") # needs sage.libs.gap
|
154
|
+
sage: g.is_isomorphic(graphs.BrouwerHaemersGraph()) # needs sage.libs.gap
|
155
|
+
True
|
156
|
+
|
157
|
+
Some examples from `Brouwer's table or strongly regular graphs
|
158
|
+
<https://www.win.tue.nl/~aeb/graphs/srg/srgtab.html>`_::
|
159
|
+
|
160
|
+
sage: # needs sage.libs.gap
|
161
|
+
sage: g = graphs.AffineOrthogonalPolarGraph(6,2,"-"); g
|
162
|
+
Affine Polar Graph VO^-(6,2): Graph on 64 vertices
|
163
|
+
sage: g.is_strongly_regular(parameters=True)
|
164
|
+
(64, 27, 10, 12)
|
165
|
+
sage: g = graphs.AffineOrthogonalPolarGraph(6,2,"+"); g
|
166
|
+
Affine Polar Graph VO^+(6,2): Graph on 64 vertices
|
167
|
+
sage: g.is_strongly_regular(parameters=True)
|
168
|
+
(64, 35, 18, 20)
|
169
|
+
|
170
|
+
When ``sign is None``::
|
171
|
+
|
172
|
+
sage: # needs sage.libs.gap
|
173
|
+
sage: g = graphs.AffineOrthogonalPolarGraph(5,2,None); g
|
174
|
+
Affine Polar Graph VO^-(5,2): Graph on 32 vertices
|
175
|
+
sage: g.is_strongly_regular(parameters=True)
|
176
|
+
False
|
177
|
+
sage: g.is_regular()
|
178
|
+
True
|
179
|
+
sage: g.is_vertex_transitive()
|
180
|
+
True
|
181
|
+
"""
|
182
|
+
if sign in ["+", "-"]:
|
183
|
+
s = 1 if sign == "+" else -1
|
184
|
+
if d % 2:
|
185
|
+
raise ValueError("d must be even when sign is not None")
|
186
|
+
else:
|
187
|
+
if not d % 2:
|
188
|
+
raise ValueError("d must be odd when sign is None")
|
189
|
+
s = 0
|
190
|
+
|
191
|
+
from sage.modules.free_module import VectorSpace
|
192
|
+
from sage.matrix.constructor import Matrix
|
193
|
+
from sage.libs.gap.libgap import libgap
|
194
|
+
from itertools import combinations
|
195
|
+
|
196
|
+
M = Matrix(libgap.InvariantQuadraticForm(libgap.GeneralOrthogonalGroup(s, d, q))['matrix'])
|
197
|
+
F = libgap.GF(q).sage()
|
198
|
+
V = list(VectorSpace(F, d))
|
199
|
+
|
200
|
+
G = Graph()
|
201
|
+
G.add_vertices([tuple(_) for _ in V])
|
202
|
+
for x, y in combinations(V, 2):
|
203
|
+
if not (x - y)*M*(x - y):
|
204
|
+
G.add_edge(tuple(x), tuple(y))
|
205
|
+
|
206
|
+
G.name("Affine Polar Graph VO^" + str('+' if s == 1 else '-') + "(" + str(d) + "," + str(q) + ")")
|
207
|
+
G.relabel()
|
208
|
+
return G
|
209
|
+
|
210
|
+
|
211
|
+
def _orthogonal_polar_graph(m, q, sign='+', point_type=[0]):
|
212
|
+
r"""
|
213
|
+
A helper function to build ``OrthogonalPolarGraph`` and ``NO2,3,5`` graphs.
|
214
|
+
|
215
|
+
See the `page of
|
216
|
+
Andries Brouwer's website <https://www.win.tue.nl/~aeb/graphs/srghub.html>`_.
|
217
|
+
|
218
|
+
INPUT:
|
219
|
+
|
220
|
+
- ``m``, ``q`` -- integers; `q` must be a prime power
|
221
|
+
|
222
|
+
- ``sign`` -- string (default: ``'+'``); must be ``'+'`` or ``'-'`` if `m`
|
223
|
+
is even, ``'+'`` (default) otherwise
|
224
|
+
|
225
|
+
- ``point_type`` -- list of elements from `F_q`
|
226
|
+
|
227
|
+
EXAMPLES:
|
228
|
+
|
229
|
+
Petersen graph::
|
230
|
+
|
231
|
+
sage: from sage.graphs.generators.classical_geometries import _orthogonal_polar_graph
|
232
|
+
sage: g = _orthogonal_polar_graph(3,5,point_type=[2,3]) # needs sage.libs.gap
|
233
|
+
sage: g.is_strongly_regular(parameters=True) # needs sage.libs.gap
|
234
|
+
(10, 3, 0, 1)
|
235
|
+
|
236
|
+
A locally Petersen graph (a.k.a. Doro graph, a.k.a. Hall graph)::
|
237
|
+
|
238
|
+
sage: g = _orthogonal_polar_graph(4,5,'-',point_type=[2,3]) # needs sage.libs.gap
|
239
|
+
sage: g.is_distance_regular(parameters=True) # needs sage.libs.gap
|
240
|
+
([10, 6, 4, None], [None, 1, 2, 5])
|
241
|
+
|
242
|
+
Various big and slow to build graphs:
|
243
|
+
|
244
|
+
`NO^+(7,3)`::
|
245
|
+
|
246
|
+
sage: g = _orthogonal_polar_graph(7,3,point_type=[1]) # not tested (long time)
|
247
|
+
sage: g.is_strongly_regular(parameters=True) # not tested (long time)
|
248
|
+
(378, 117, 36, 36)
|
249
|
+
|
250
|
+
`NO^-(7,3)`::
|
251
|
+
|
252
|
+
sage: g = _orthogonal_polar_graph(7,3,point_type=[-1]) # not tested (long time)
|
253
|
+
sage: g.is_strongly_regular(parameters=True) # not tested (long time)
|
254
|
+
(351, 126, 45, 45)
|
255
|
+
|
256
|
+
`NO^+(6,3)`::
|
257
|
+
|
258
|
+
sage: g = _orthogonal_polar_graph(6,3,point_type=[1]) # needs sage.libs.gap
|
259
|
+
sage: g.is_strongly_regular(parameters=True) # needs sage.libs.gap
|
260
|
+
(117, 36, 15, 9)
|
261
|
+
|
262
|
+
`NO^-(6,3)`::
|
263
|
+
|
264
|
+
sage: g = _orthogonal_polar_graph(6,3,'-',point_type=[1]) # needs sage.libs.gap
|
265
|
+
sage: g.is_strongly_regular(parameters=True) # needs sage.libs.gap
|
266
|
+
(126, 45, 12, 18)
|
267
|
+
|
268
|
+
`NO^{-,\perp}(5,5)`::
|
269
|
+
|
270
|
+
sage: g = _orthogonal_polar_graph(5,5,point_type=[2,3]) # long time, needs sage.libs.gap
|
271
|
+
sage: g.is_strongly_regular(parameters=True) # long time, needs sage.libs.gap
|
272
|
+
(300, 65, 10, 15)
|
273
|
+
|
274
|
+
`NO^{+,\perp}(5,5)`::
|
275
|
+
|
276
|
+
sage: g = _orthogonal_polar_graph(5,5,point_type=[1,-1]) # not tested (long time)
|
277
|
+
sage: g.is_strongly_regular(parameters=True) # not tested (long time)
|
278
|
+
(325, 60, 15, 10)
|
279
|
+
|
280
|
+
TESTS::
|
281
|
+
|
282
|
+
sage: # needs sage.libs.gap
|
283
|
+
sage: g = _orthogonal_polar_graph(5,3,point_type=[-1])
|
284
|
+
sage: g.is_strongly_regular(parameters=True)
|
285
|
+
(45, 12, 3, 3)
|
286
|
+
sage: g = _orthogonal_polar_graph(5,3,point_type=[1])
|
287
|
+
sage: g.is_strongly_regular(parameters=True)
|
288
|
+
(36, 15, 6, 6)
|
289
|
+
"""
|
290
|
+
from sage.schemes.projective.projective_space import ProjectiveSpace
|
291
|
+
from sage.modules.free_module_element import free_module_element as vector
|
292
|
+
from sage.matrix.constructor import Matrix
|
293
|
+
from sage.libs.gap.libgap import libgap
|
294
|
+
|
295
|
+
if not m % 2:
|
296
|
+
if sign != "+" and sign != "-":
|
297
|
+
raise ValueError("sign must be equal to either '-' or '+' when "
|
298
|
+
"m is even")
|
299
|
+
else:
|
300
|
+
if sign != "" and sign != "+":
|
301
|
+
raise ValueError("sign must be equal to either '' or '+' when "
|
302
|
+
"m is odd")
|
303
|
+
sign = ""
|
304
|
+
|
305
|
+
e = {'+': 1,
|
306
|
+
'-': -1,
|
307
|
+
'': 0}[sign]
|
308
|
+
|
309
|
+
M = Matrix(libgap.InvariantQuadraticForm(libgap.GeneralOrthogonalGroup(e, m, q))['matrix'])
|
310
|
+
Fq = libgap.GF(q).sage()
|
311
|
+
PG = [vector(s) for s in ProjectiveSpace(m - 1, Fq)]
|
312
|
+
|
313
|
+
for v in PG:
|
314
|
+
v.set_immutable()
|
315
|
+
|
316
|
+
def F(x):
|
317
|
+
return x*M*x
|
318
|
+
|
319
|
+
if not q % 2:
|
320
|
+
def P(x, y):
|
321
|
+
return F(x - y)
|
322
|
+
else:
|
323
|
+
def P(x, y):
|
324
|
+
return x*M*y + y*M*x
|
325
|
+
|
326
|
+
V = [x for x in PG if F(x) in point_type]
|
327
|
+
|
328
|
+
G = Graph([V, lambda x, y: P(x, y) == 0], loops=False)
|
329
|
+
|
330
|
+
G.relabel()
|
331
|
+
return G
|
332
|
+
|
333
|
+
|
334
|
+
def OrthogonalPolarGraph(m, q, sign='+'):
|
335
|
+
r"""
|
336
|
+
Return the Orthogonal Polar Graph `O^{\epsilon}(m,q)`.
|
337
|
+
|
338
|
+
For more information on Orthogonal Polar graphs, see the `page of Andries
|
339
|
+
Brouwer's website <https://www.win.tue.nl/~aeb/graphs/srghub.html>`_.
|
340
|
+
|
341
|
+
INPUT:
|
342
|
+
|
343
|
+
- ``m``, ``q`` -- integers; `q` must be a prime power
|
344
|
+
|
345
|
+
- ``sign`` -- string (default: ``'+'``); must be ``'+'`` or ``'-'`` if `m`
|
346
|
+
is even, ``'+'`` (default) otherwise
|
347
|
+
|
348
|
+
EXAMPLES::
|
349
|
+
|
350
|
+
sage: # needs sage.libs.gap
|
351
|
+
sage: G = graphs.OrthogonalPolarGraph(6,3,"+"); G
|
352
|
+
Orthogonal Polar Graph O^+(6, 3): Graph on 130 vertices
|
353
|
+
sage: G.is_strongly_regular(parameters=True)
|
354
|
+
(130, 48, 20, 16)
|
355
|
+
sage: G = graphs.OrthogonalPolarGraph(6,3,"-"); G
|
356
|
+
Orthogonal Polar Graph O^-(6, 3): Graph on 112 vertices
|
357
|
+
sage: G.is_strongly_regular(parameters=True)
|
358
|
+
(112, 30, 2, 10)
|
359
|
+
sage: G = graphs.OrthogonalPolarGraph(5,3); G
|
360
|
+
Orthogonal Polar Graph O(5, 3): Graph on 40 vertices
|
361
|
+
sage: G.is_strongly_regular(parameters=True)
|
362
|
+
(40, 12, 2, 4)
|
363
|
+
sage: G = graphs.OrthogonalPolarGraph(8,2,"+"); G
|
364
|
+
Orthogonal Polar Graph O^+(8, 2): Graph on 135 vertices
|
365
|
+
sage: G.is_strongly_regular(parameters=True)
|
366
|
+
(135, 70, 37, 35)
|
367
|
+
sage: G = graphs.OrthogonalPolarGraph(8,2,"-"); G
|
368
|
+
Orthogonal Polar Graph O^-(8, 2): Graph on 119 vertices
|
369
|
+
sage: G.is_strongly_regular(parameters=True)
|
370
|
+
(119, 54, 21, 27)
|
371
|
+
|
372
|
+
TESTS::
|
373
|
+
|
374
|
+
sage: G = graphs.OrthogonalPolarGraph(4,3,"") # needs sage.libs.gap
|
375
|
+
Traceback (most recent call last):
|
376
|
+
...
|
377
|
+
ValueError: sign must be equal to either '-' or '+' when m is even
|
378
|
+
sage: G = graphs.OrthogonalPolarGraph(5,3,"-") # needs sage.libs.gap
|
379
|
+
Traceback (most recent call last):
|
380
|
+
...
|
381
|
+
ValueError: sign must be equal to either '' or '+' when m is odd
|
382
|
+
"""
|
383
|
+
G = _orthogonal_polar_graph(m, q, sign=sign)
|
384
|
+
if m % 2:
|
385
|
+
sign = ""
|
386
|
+
G.name("Orthogonal Polar Graph O" + ("^" + sign if sign else "") + str((m, q)))
|
387
|
+
return G
|
388
|
+
|
389
|
+
|
390
|
+
def NonisotropicOrthogonalPolarGraph(m, q, sign='+', perp=None):
|
391
|
+
r"""
|
392
|
+
Return the Graph `NO^{\epsilon,\perp}_{m}(q)`.
|
393
|
+
|
394
|
+
Let the vectorspace of dimension `m` over `F_q` be endowed with a
|
395
|
+
nondegenerate quadratic form `F`, of type ``sign`` for `m` even.
|
396
|
+
|
397
|
+
* `m` even: assume further that `q=2` or `3`. Returns the graph of the
|
398
|
+
points (in the underlying projective space) `x` satisfying `F(x)=1`, with
|
399
|
+
adjacency given by orthogonality w.r.t. `F`. Parameter ``perp`` is
|
400
|
+
ignored.
|
401
|
+
|
402
|
+
* `m` odd: if ``perp`` is not ``None``, then we assume that `q=5` and return
|
403
|
+
the graph of the points `x` satisfying `F(x)=\pm 1` if ``sign="+"``,
|
404
|
+
respectively `F(x) \in \{2,3\}` if ``sign="-"``, with adjacency given by
|
405
|
+
orthogonality w.r.t. `F` (cf. Sect 7.D of [BL1984]_). Otherwise return
|
406
|
+
the graph of nongenerate hyperplanes of type ``sign``, adjacent whenever
|
407
|
+
the intersection is degenerate (cf. Sect. 7.C of [BL1984]_).
|
408
|
+
Note that for `q=2` one will get a complete graph.
|
409
|
+
|
410
|
+
For more information, see Sect. 9.9 of [BH2012]_ and [BL1984]_. Note that
|
411
|
+
the `page of Andries Brouwer's website
|
412
|
+
<https://www.win.tue.nl/~aeb/graphs/srghub.html>`_ uses different notation.
|
413
|
+
|
414
|
+
INPUT:
|
415
|
+
|
416
|
+
- ``m`` -- integer; half the dimension of the underlying vectorspace
|
417
|
+
|
418
|
+
- ``q`` -- a power of a prime number, the size of the underlying field
|
419
|
+
|
420
|
+
- ``sign`` -- string (default: ``'+'``); must be either ``'+'`` or ``'-'``
|
421
|
+
|
422
|
+
EXAMPLES:
|
423
|
+
|
424
|
+
`NO^-(4,2)` is isomorphic to Petersen graph::
|
425
|
+
|
426
|
+
sage: g = graphs.NonisotropicOrthogonalPolarGraph(4,2,'-'); g # needs sage.libs.gap
|
427
|
+
NO^-(4, 2): Graph on 10 vertices
|
428
|
+
sage: g.is_strongly_regular(parameters=True) # needs sage.libs.gap
|
429
|
+
(10, 3, 0, 1)
|
430
|
+
|
431
|
+
`NO^-(6,2)` and `NO^+(6,2)`::
|
432
|
+
|
433
|
+
sage: # needs sage.libs.gap
|
434
|
+
sage: g = graphs.NonisotropicOrthogonalPolarGraph(6,2,'-')
|
435
|
+
sage: g.is_strongly_regular(parameters=True)
|
436
|
+
(36, 15, 6, 6)
|
437
|
+
sage: g = graphs.NonisotropicOrthogonalPolarGraph(6,2,'+'); g
|
438
|
+
NO^+(6, 2): Graph on 28 vertices
|
439
|
+
sage: g.is_strongly_regular(parameters=True)
|
440
|
+
(28, 15, 6, 10)
|
441
|
+
|
442
|
+
`NO^+(8,2)`::
|
443
|
+
|
444
|
+
sage: g = graphs.NonisotropicOrthogonalPolarGraph(8,2,'+') # needs sage.libs.gap
|
445
|
+
sage: g.is_strongly_regular(parameters=True) # needs sage.libs.gap
|
446
|
+
(120, 63, 30, 36)
|
447
|
+
|
448
|
+
Wilbrink's graphs for `q=5`::
|
449
|
+
|
450
|
+
sage: # needs sage.libs.gap
|
451
|
+
sage: g = graphs.NonisotropicOrthogonalPolarGraph(5,5,perp=1)
|
452
|
+
sage: g.is_strongly_regular(parameters=True) # long time
|
453
|
+
(325, 60, 15, 10)
|
454
|
+
sage: g = graphs.NonisotropicOrthogonalPolarGraph(5,5,'-',perp=1)
|
455
|
+
sage: g.is_strongly_regular(parameters=True) # long time
|
456
|
+
(300, 65, 10, 15)
|
457
|
+
|
458
|
+
Wilbrink's graphs::
|
459
|
+
|
460
|
+
sage: # needs sage.libs.gap
|
461
|
+
sage: g = graphs.NonisotropicOrthogonalPolarGraph(5,4,'+')
|
462
|
+
sage: g.is_strongly_regular(parameters=True)
|
463
|
+
(136, 75, 42, 40)
|
464
|
+
sage: g = graphs.NonisotropicOrthogonalPolarGraph(5,4,'-')
|
465
|
+
sage: g.is_strongly_regular(parameters=True)
|
466
|
+
(120, 51, 18, 24)
|
467
|
+
sage: g = graphs.NonisotropicOrthogonalPolarGraph(7,4,'+'); g # not tested (long time)
|
468
|
+
NO^+(7, 4): Graph on 2080 vertices
|
469
|
+
sage: g.is_strongly_regular(parameters=True) # not tested (long time)
|
470
|
+
(2080, 1071, 558, 544)
|
471
|
+
|
472
|
+
TESTS::
|
473
|
+
|
474
|
+
sage: # needs sage.libs.gap
|
475
|
+
sage: g = graphs.NonisotropicOrthogonalPolarGraph(4,2); g
|
476
|
+
NO^+(4, 2): Graph on 6 vertices
|
477
|
+
sage: g = graphs.NonisotropicOrthogonalPolarGraph(4,3,'-')
|
478
|
+
sage: g.is_strongly_regular(parameters=True)
|
479
|
+
(15, 6, 1, 3)
|
480
|
+
sage: g = graphs.NonisotropicOrthogonalPolarGraph(3,5,'-',perp=1); g
|
481
|
+
NO^-,perp(3, 5): Graph on 10 vertices
|
482
|
+
sage: g.is_strongly_regular(parameters=True)
|
483
|
+
(10, 3, 0, 1)
|
484
|
+
|
485
|
+
sage: # long time, needs sage.libs.gap
|
486
|
+
sage: g = graphs.NonisotropicOrthogonalPolarGraph(6,3,'+')
|
487
|
+
sage: g.is_strongly_regular(parameters=True)
|
488
|
+
(117, 36, 15, 9)
|
489
|
+
sage: g = graphs.NonisotropicOrthogonalPolarGraph(6,3,'-'); g
|
490
|
+
NO^-(6, 3): Graph on 126 vertices
|
491
|
+
sage: g.is_strongly_regular(parameters=True)
|
492
|
+
(126, 45, 12, 18)
|
493
|
+
sage: g = graphs.NonisotropicOrthogonalPolarGraph(5,5,'-')
|
494
|
+
sage: g.is_strongly_regular(parameters=True)
|
495
|
+
(300, 104, 28, 40)
|
496
|
+
sage: g = graphs.NonisotropicOrthogonalPolarGraph(5,5,'+')
|
497
|
+
sage: g.is_strongly_regular(parameters=True)
|
498
|
+
(325, 144, 68, 60)
|
499
|
+
|
500
|
+
sage: g = graphs.NonisotropicOrthogonalPolarGraph(6,4,'+')
|
501
|
+
Traceback (most recent call last):
|
502
|
+
...
|
503
|
+
ValueError: for m even q must be 2 or 3
|
504
|
+
"""
|
505
|
+
p, k = is_prime_power(q, get_data=True)
|
506
|
+
if not k:
|
507
|
+
raise ValueError('q must be a prime power')
|
508
|
+
dec = ''
|
509
|
+
if not m % 2:
|
510
|
+
if q in [2, 3]:
|
511
|
+
G = _orthogonal_polar_graph(m, q, sign=sign, point_type=[1])
|
512
|
+
else:
|
513
|
+
raise ValueError("for m even q must be 2 or 3")
|
514
|
+
elif perp is not None:
|
515
|
+
if q == 5:
|
516
|
+
pt = [-1, 1] if sign == '+' else [2, 3] if sign == '-' else []
|
517
|
+
G = _orthogonal_polar_graph(m, q, point_type=pt)
|
518
|
+
dec = ",perp"
|
519
|
+
else:
|
520
|
+
raise ValueError("for perp not None q must be 5")
|
521
|
+
else:
|
522
|
+
if sign not in ['+', '-']:
|
523
|
+
raise ValueError("sign must be '+' or '-'")
|
524
|
+
from sage.libs.gap.libgap import libgap
|
525
|
+
g0 = libgap.GeneralOrthogonalGroup(m, q)
|
526
|
+
g = libgap.Group(libgap.List(g0.GeneratorsOfGroup(), libgap.TransposedMat))
|
527
|
+
F = libgap.GF(q) # F_q
|
528
|
+
W = libgap.FullRowSpace(F, m) # F_q^m
|
529
|
+
e = 1 if sign == '+' else -1
|
530
|
+
n = (m - 1)/2
|
531
|
+
# we build (q^n(q^n+e)/2, (q^n-e)(q^(n-1)+e), 2(q^(2n-2)-1)+eq^(n-1)(q-1),
|
532
|
+
# 2q^(n-1)(q^(n-1)+e))-srg
|
533
|
+
# **use** v and k to select appropriate orbit and orbital
|
534
|
+
nvert = (q**n)*(q**n + e)/2 # v
|
535
|
+
deg = (q**n - e)*(q**(n - 1) + e) # k
|
536
|
+
S = [libgap.Elements(libgap.Basis(x))[0]
|
537
|
+
for x in libgap.Elements(libgap.Subspaces(W, 1))]
|
538
|
+
(V,) = (x for x in libgap.Orbits(g, S, libgap.OnLines)
|
539
|
+
if len(x) == nvert)
|
540
|
+
gp = libgap.Action(g, V, libgap.OnLines) # make a permutation group
|
541
|
+
h = libgap.Stabilizer(gp, 1)
|
542
|
+
(Vh,) = (x for x in libgap.Orbits(h, libgap.Orbit(gp, 1))
|
543
|
+
if len(x) == deg)
|
544
|
+
Vh = Vh[0]
|
545
|
+
L = libgap.Orbit(gp, [1, Vh], libgap.OnSets)
|
546
|
+
G = Graph()
|
547
|
+
G.add_edges(L)
|
548
|
+
G.name("NO^" + sign + dec + str((m, q)))
|
549
|
+
return G
|
550
|
+
|
551
|
+
|
552
|
+
def _polar_graph(m, q, g, intersection_size=None):
|
553
|
+
r"""
|
554
|
+
The helper function to build graphs `(D)U(m,q)` and `(D)Sp(m,q)`.
|
555
|
+
|
556
|
+
Building a graph on an orbit of a group `g` of `m\times m` matrices over
|
557
|
+
`GF(q)` on the points (or subspaces of dimension ``m//2``) isotropic
|
558
|
+
w.r.t. the form `F` left invariant by the group `g`.
|
559
|
+
|
560
|
+
The only constraint is that the first ``m//2`` elements of the standard
|
561
|
+
basis must generate a totally isotropic w.r.t. `F` subspace; this is the
|
562
|
+
case with these groups coming from GAP; namely, `F` has the anti-diagonal
|
563
|
+
all-1 matrix.
|
564
|
+
|
565
|
+
INPUT:
|
566
|
+
|
567
|
+
- ``m`` -- the dimension of the underlying vector space
|
568
|
+
|
569
|
+
- ``q`` -- the size of the field
|
570
|
+
|
571
|
+
- ``g`` -- the group acting
|
572
|
+
|
573
|
+
- ``intersection_size`` -- (default: ``None``) if ``None``, build the graph
|
574
|
+
on the isotropic points, with adjacency being orthogonality w.r.t. `F`.
|
575
|
+
Otherwise, build the graph on the maximal totally isotropic subspaces,
|
576
|
+
with adjacency specified by ``intersection_size`` being as given.
|
577
|
+
|
578
|
+
TESTS::
|
579
|
+
|
580
|
+
sage: from sage.graphs.generators.classical_geometries import _polar_graph
|
581
|
+
sage: _polar_graph(4, 4, libgap.GeneralUnitaryGroup(4, 2)) # needs sage.libs.gap
|
582
|
+
Graph on 45 vertices
|
583
|
+
sage: _polar_graph(4, 4, libgap.GeneralUnitaryGroup(4, 2), intersection_size=1) # needs sage.libs.gap
|
584
|
+
Graph on 27 vertices
|
585
|
+
"""
|
586
|
+
from sage.libs.gap.libgap import libgap
|
587
|
+
from itertools import combinations
|
588
|
+
W = libgap.FullRowSpace(libgap.GF(q), m) # F_q^m
|
589
|
+
B = libgap.Elements(libgap.Basis(W)) # the standard basis of W
|
590
|
+
V = libgap.Orbit(g, B[0], libgap.OnLines) # orbit on isotropic points
|
591
|
+
gp = libgap.Action(g, V, libgap.OnLines) # make a permutation group
|
592
|
+
s = libgap.Subspace(W, [B[i] for i in range(m//2)]) # a totally isotropic subspace
|
593
|
+
# and the points there
|
594
|
+
sp = [libgap.Elements(libgap.Basis(x))[0] for x in libgap.Elements(s.Subspaces(1))]
|
595
|
+
h = libgap.Set([libgap.Position(V, x) for x in sp]) # indices of the points in s
|
596
|
+
L = libgap.Orbit(gp, h, libgap.OnSets) # orbit on these subspaces
|
597
|
+
if intersection_size is None:
|
598
|
+
G = Graph()
|
599
|
+
for x in L: # every pair of points in the subspace is adjacent to each other in G
|
600
|
+
G.add_edges(combinations(x, 2))
|
601
|
+
return G
|
602
|
+
else:
|
603
|
+
return Graph([L, lambda i, j: libgap.Size(libgap.Intersection(i, j)) == intersection_size],
|
604
|
+
loops=False)
|
605
|
+
|
606
|
+
|
607
|
+
def UnitaryPolarGraph(m, q, algorithm='gap'):
|
608
|
+
r"""
|
609
|
+
Return the Unitary Polar Graph `U(m,q)`.
|
610
|
+
|
611
|
+
For more information on Unitary Polar graphs, see the `page of Andries
|
612
|
+
Brouwer's website <https://www.win.tue.nl/~aeb/graphs/srghub.html>`_.
|
613
|
+
|
614
|
+
INPUT:
|
615
|
+
|
616
|
+
- ``m``, ``q`` -- integers; `q` must be a prime power
|
617
|
+
|
618
|
+
- ``algorithm`` -- string (default: ``'gap'``); if set to ``'gap'`` then the
|
619
|
+
computation is carried via GAP library interface, computing totally
|
620
|
+
singular subspaces, which is faster for large examples (especially with
|
621
|
+
`q>2`). Otherwise it is done directly.
|
622
|
+
|
623
|
+
EXAMPLES::
|
624
|
+
|
625
|
+
sage: # needs sage.libs.gap
|
626
|
+
sage: G = graphs.UnitaryPolarGraph(4,2); G
|
627
|
+
Unitary Polar Graph U(4, 2); GQ(4, 2): Graph on 45 vertices
|
628
|
+
sage: G.is_strongly_regular(parameters=True)
|
629
|
+
(45, 12, 3, 3)
|
630
|
+
sage: graphs.UnitaryPolarGraph(5,2).is_strongly_regular(parameters=True)
|
631
|
+
(165, 36, 3, 9)
|
632
|
+
sage: graphs.UnitaryPolarGraph(6,2) # not tested (long time)
|
633
|
+
Unitary Polar Graph U(6, 2): Graph on 693 vertices
|
634
|
+
|
635
|
+
TESTS::
|
636
|
+
|
637
|
+
sage: graphs.UnitaryPolarGraph(4,3, algorithm='gap').is_strongly_regular(parameters=True) # needs sage.libs.gap
|
638
|
+
(280, 36, 8, 4)
|
639
|
+
sage: graphs.UnitaryPolarGraph(4,3).is_strongly_regular(parameters=True) # needs sage.libs.gap
|
640
|
+
(280, 36, 8, 4)
|
641
|
+
sage: graphs.UnitaryPolarGraph(4,3, algorithm='foo')
|
642
|
+
Traceback (most recent call last):
|
643
|
+
...
|
644
|
+
ValueError: unknown algorithm!
|
645
|
+
"""
|
646
|
+
if algorithm == "gap":
|
647
|
+
from sage.libs.gap.libgap import libgap
|
648
|
+
G = _polar_graph(m, q**2, libgap.GeneralUnitaryGroup(m, q))
|
649
|
+
|
650
|
+
elif algorithm is None: # slow on large examples
|
651
|
+
from sage.schemes.projective.projective_space import ProjectiveSpace
|
652
|
+
from sage.modules.free_module_element import free_module_element as vector
|
653
|
+
Fq = FiniteField(q**2, 'a')
|
654
|
+
PG = map(vector, ProjectiveSpace(m - 1, Fq))
|
655
|
+
|
656
|
+
for v in PG:
|
657
|
+
v.set_immutable()
|
658
|
+
|
659
|
+
def P(x, y):
|
660
|
+
return sum(x[j] * y[m - 1 - j] ** q for j in range(m)) == 0
|
661
|
+
|
662
|
+
V = [x for x in PG if P(x, x)]
|
663
|
+
# bottleneck is here, of course
|
664
|
+
G = Graph([V, lambda x, y: P(x, y)], loops=False)
|
665
|
+
else:
|
666
|
+
raise ValueError("unknown algorithm!")
|
667
|
+
|
668
|
+
G.relabel()
|
669
|
+
G.name("Unitary Polar Graph U" + str((m, q)))
|
670
|
+
if m == 4:
|
671
|
+
G.name(G.name() + '; GQ' + str((q**2, q)))
|
672
|
+
if m == 5:
|
673
|
+
G.name(G.name() + '; GQ' + str((q**2, q**3)))
|
674
|
+
return G
|
675
|
+
|
676
|
+
|
677
|
+
def NonisotropicUnitaryPolarGraph(m, q):
|
678
|
+
r"""
|
679
|
+
Return the Graph `NU(m,q)`.
|
680
|
+
|
681
|
+
This returns the graph on nonisotropic, with respect to a nondegenerate
|
682
|
+
Hermitean form, points of the `(m-1)`-dimensional projective space over
|
683
|
+
`F_q`, with points adjacent whenever they lie on a tangent (to the set of
|
684
|
+
isotropic points) line. For more information, see Sect. 9.9 of [BH2012]_
|
685
|
+
and series C14 in [Hub1975]_.
|
686
|
+
|
687
|
+
INPUT:
|
688
|
+
|
689
|
+
- ``m``, ``q`` -- integers; `q` must be a prime power
|
690
|
+
|
691
|
+
EXAMPLES::
|
692
|
+
|
693
|
+
sage: g = graphs.NonisotropicUnitaryPolarGraph(5,2); g # needs sage.libs.gap
|
694
|
+
NU(5, 2): Graph on 176 vertices
|
695
|
+
sage: g.is_strongly_regular(parameters=True) # needs sage.libs.gap
|
696
|
+
(176, 135, 102, 108)
|
697
|
+
|
698
|
+
TESTS::
|
699
|
+
|
700
|
+
sage: graphs.NonisotropicUnitaryPolarGraph(4,2).is_strongly_regular(parameters=True) # needs sage.libs.gap
|
701
|
+
(40, 27, 18, 18)
|
702
|
+
sage: graphs.NonisotropicUnitaryPolarGraph(4,3).is_strongly_regular(parameters=True) # long time, needs sage.libs.gap
|
703
|
+
(540, 224, 88, 96)
|
704
|
+
sage: graphs.NonisotropicUnitaryPolarGraph(6,6)
|
705
|
+
Traceback (most recent call last):
|
706
|
+
...
|
707
|
+
ValueError: q must be a prime power
|
708
|
+
"""
|
709
|
+
p, k = is_prime_power(q, get_data=True)
|
710
|
+
if not k:
|
711
|
+
raise ValueError('q must be a prime power')
|
712
|
+
from sage.libs.gap.libgap import libgap
|
713
|
+
from itertools import combinations
|
714
|
+
F = libgap.GF(q**2) # F_{q^2}
|
715
|
+
W = libgap.FullRowSpace(F, m) # F_{q^2}^m
|
716
|
+
B = libgap.Elements(libgap.Basis(W)) # the standard basis of W
|
717
|
+
if m % 2:
|
718
|
+
point = B[(m - 1)/2]
|
719
|
+
else:
|
720
|
+
if p == 2:
|
721
|
+
point = B[m/2] + F.PrimitiveRoot()*B[(m - 2)/2]
|
722
|
+
else:
|
723
|
+
point = B[(m - 2)/2] + B[m/2]
|
724
|
+
g = libgap.GeneralUnitaryGroup(m, q)
|
725
|
+
V = libgap.Orbit(g, point, libgap.OnLines) # orbit on nonisotropic points
|
726
|
+
gp = libgap.Action(g, V, libgap.OnLines) # make a permutation group
|
727
|
+
|
728
|
+
s = libgap.Subspace(W, [point, point + B[0]]) # a tangent line on point
|
729
|
+
|
730
|
+
# and the points there
|
731
|
+
sp = [libgap.Elements(libgap.Basis(x))[0] for x in libgap.Elements(s.Subspaces(1))]
|
732
|
+
h = libgap.Set([libgap.Position(V, x)
|
733
|
+
for x in libgap.Intersection(V, sp)]) # indices
|
734
|
+
L = libgap.Orbit(gp, h, libgap.OnSets) # orbit on the tangent lines
|
735
|
+
G = Graph()
|
736
|
+
for x in L: # every pair of points in the subspace is adjacent to each other in G
|
737
|
+
G.add_edges(combinations(x, 2))
|
738
|
+
G.relabel()
|
739
|
+
G.name("NU" + str((m, q)))
|
740
|
+
return G
|
741
|
+
|
742
|
+
|
743
|
+
def UnitaryDualPolarGraph(m, q):
|
744
|
+
r"""
|
745
|
+
Return the Dual Unitary Polar Graph `U(m,q)`.
|
746
|
+
|
747
|
+
For more information on Unitary Dual Polar graphs, see [BCN1989]_ and
|
748
|
+
Sect. 2.3.1 of [Coh1981]_.
|
749
|
+
|
750
|
+
INPUT:
|
751
|
+
|
752
|
+
- ``m``, ``q`` -- integers; `q` must be a prime power
|
753
|
+
|
754
|
+
EXAMPLES:
|
755
|
+
|
756
|
+
The point graph of a generalized quadrangle (see
|
757
|
+
:wikipedia:`Generalized_quadrangle`, [PT2009]_) of order (8,4)::
|
758
|
+
|
759
|
+
sage: G = graphs.UnitaryDualPolarGraph(5,2); G # long time # needs sage.libs.gap
|
760
|
+
Unitary Dual Polar Graph DU(5, 2); GQ(8, 4): Graph on 297 vertices
|
761
|
+
sage: G.is_strongly_regular(parameters=True) # long time # needs sage.libs.gap
|
762
|
+
(297, 40, 7, 5)
|
763
|
+
|
764
|
+
Another way to get the generalized quadrangle of order (2,4)::
|
765
|
+
|
766
|
+
sage: G = graphs.UnitaryDualPolarGraph(4,2); G # needs sage.libs.gap
|
767
|
+
Unitary Dual Polar Graph DU(4, 2); GQ(2, 4): Graph on 27 vertices
|
768
|
+
sage: G.is_isomorphic(graphs.OrthogonalPolarGraph(6,2,'-')) # needs sage.libs.gap
|
769
|
+
True
|
770
|
+
|
771
|
+
A bigger graph::
|
772
|
+
|
773
|
+
sage: G = graphs.UnitaryDualPolarGraph(6,2); G # not tested (long time)
|
774
|
+
Unitary Dual Polar Graph DU(6, 2): Graph on 891 vertices
|
775
|
+
sage: G.is_distance_regular(parameters=True) # not tested (long time)
|
776
|
+
([42, 40, 32, None], [None, 1, 5, 21])
|
777
|
+
|
778
|
+
TESTS::
|
779
|
+
|
780
|
+
sage: graphs.UnitaryDualPolarGraph(6,6) # needs sage.libs.gap
|
781
|
+
Traceback (most recent call last):
|
782
|
+
...
|
783
|
+
GAPError: Error, <subfield> must be a prime or a finite field
|
784
|
+
"""
|
785
|
+
from sage.libs.gap.libgap import libgap
|
786
|
+
G = _polar_graph(m, q**2, libgap.GeneralUnitaryGroup(m, q),
|
787
|
+
intersection_size=int((q**(2*(m//2 - 1)) - 1)/(q**2 - 1)))
|
788
|
+
G.relabel()
|
789
|
+
G.name("Unitary Dual Polar Graph DU" + str((m, q)))
|
790
|
+
if m == 4:
|
791
|
+
G.name(G.name() + '; GQ' + str((q, q**2)))
|
792
|
+
if m == 5:
|
793
|
+
G.name(G.name() + '; GQ' + str((q**3, q**2)))
|
794
|
+
return G
|
795
|
+
|
796
|
+
|
797
|
+
def SymplecticDualPolarGraph(m, q):
|
798
|
+
r"""
|
799
|
+
Return the Symplectic Dual Polar Graph `DSp(m,q)`.
|
800
|
+
|
801
|
+
For more information on Symplectic Dual Polar graphs, see [BCN1989]_ and
|
802
|
+
Sect. 2.3.1 of [Coh1981]_.
|
803
|
+
|
804
|
+
INPUT:
|
805
|
+
|
806
|
+
- ``m``, ``q`` -- integers; `q` must be a prime power, and `m` must be even
|
807
|
+
|
808
|
+
EXAMPLES::
|
809
|
+
|
810
|
+
sage: G = graphs.SymplecticDualPolarGraph(6,3); G # not tested (long time)
|
811
|
+
Symplectic Dual Polar Graph DSp(6, 3): Graph on 1120 vertices
|
812
|
+
sage: G.is_distance_regular(parameters=True) # not tested (long time)
|
813
|
+
([39, 36, 27, None], [None, 1, 4, 13])
|
814
|
+
|
815
|
+
TESTS::
|
816
|
+
|
817
|
+
sage: G = graphs.SymplecticDualPolarGraph(6,2); G # needs sage.libs.gap
|
818
|
+
Symplectic Dual Polar Graph DSp(6, 2): Graph on 135 vertices
|
819
|
+
sage: G.is_distance_regular(parameters=True) # needs sage.libs.gap
|
820
|
+
([14, 12, 8, None], [None, 1, 3, 7])
|
821
|
+
sage: graphs.SymplecticDualPolarGraph(6,6) # needs sage.libs.gap
|
822
|
+
Traceback (most recent call last):
|
823
|
+
...
|
824
|
+
GAPError: Error, <subfield> must be a prime or a finite field
|
825
|
+
"""
|
826
|
+
from sage.libs.gap.libgap import libgap
|
827
|
+
G = _polar_graph(m, q, libgap.SymplecticGroup(m, q),
|
828
|
+
intersection_size=int((q**(m/2 - 1) - 1)/(q - 1)))
|
829
|
+
|
830
|
+
G.relabel()
|
831
|
+
G.name("Symplectic Dual Polar Graph DSp" + str((m, q)))
|
832
|
+
if m == 4:
|
833
|
+
G.name(G.name() + '; GQ' + str((q, q)))
|
834
|
+
return G
|
835
|
+
|
836
|
+
|
837
|
+
def TaylorTwographDescendantSRG(q, clique_partition=False):
|
838
|
+
r"""
|
839
|
+
Return the descendant graph of the Taylor's two-graph for `U_3(q)`, `q` odd.
|
840
|
+
|
841
|
+
This is a strongly regular graph with parameters
|
842
|
+
`(v,k,\lambda,\mu)=(q^3, (q^2+1)(q-1)/2, (q-1)^3/4-1, (q^2+1)(q-1)/4)`
|
843
|
+
obtained as a two-graph descendant of the
|
844
|
+
:func:`Taylor's two-graph <sage.combinat.designs.twographs.taylor_twograph>` `T`.
|
845
|
+
This graph admits a partition into cliques of size `q`, which are useful in
|
846
|
+
:func:`~sage.graphs.graph_generators.GraphGenerators.TaylorTwographSRG`,
|
847
|
+
a strongly regular graph on `q^3+1` vertices in the
|
848
|
+
Seidel switching class of `T`, for which we need `(q^2+1)/2` cliques.
|
849
|
+
The cliques are the `q^2` lines on `v_0` of the projective plane containing
|
850
|
+
the unital for `U_3(q)`, and intersecting the unital (i.e. the vertices of
|
851
|
+
the graph and the point we remove) in `q+1` points. This is all taken from
|
852
|
+
§7E of [BL1984]_.
|
853
|
+
|
854
|
+
INPUT:
|
855
|
+
|
856
|
+
- ``q`` -- a power of an odd prime number
|
857
|
+
|
858
|
+
- ``clique_partition`` -- boolean (default: ``False``); when set to
|
859
|
+
``True``, return `q^2-1` cliques of size `q` with empty pairwise
|
860
|
+
intersection. (Removing all of them leaves a clique, too), and the point
|
861
|
+
removed from the unital.
|
862
|
+
|
863
|
+
EXAMPLES::
|
864
|
+
|
865
|
+
sage: # needs sage.rings.finite_rings
|
866
|
+
sage: g = graphs.TaylorTwographDescendantSRG(3); g
|
867
|
+
Taylor two-graph descendant SRG: Graph on 27 vertices
|
868
|
+
sage: g.is_strongly_regular(parameters=True)
|
869
|
+
(27, 10, 1, 5)
|
870
|
+
sage: from sage.combinat.designs.twographs import taylor_twograph
|
871
|
+
sage: T = taylor_twograph(3) # long time
|
872
|
+
sage: g.is_isomorphic(T.descendant(T.ground_set()[1])) # long time
|
873
|
+
True
|
874
|
+
sage: g = graphs.TaylorTwographDescendantSRG(5) # not tested (long time)
|
875
|
+
sage: g.is_strongly_regular(parameters=True) # not tested (long time)
|
876
|
+
(125, 52, 15, 26)
|
877
|
+
|
878
|
+
TESTS::
|
879
|
+
|
880
|
+
sage: # needs sage.rings.finite_rings
|
881
|
+
sage: g,l,_ = graphs.TaylorTwographDescendantSRG(3, clique_partition=True)
|
882
|
+
sage: all(g.is_clique(x) for x in l)
|
883
|
+
True
|
884
|
+
sage: graphs.TaylorTwographDescendantSRG(4)
|
885
|
+
Traceback (most recent call last):
|
886
|
+
...
|
887
|
+
ValueError: q must be an odd prime power
|
888
|
+
sage: graphs.TaylorTwographDescendantSRG(6)
|
889
|
+
Traceback (most recent call last):
|
890
|
+
...
|
891
|
+
ValueError: q must be an odd prime power
|
892
|
+
"""
|
893
|
+
p, k = is_prime_power(q, get_data=True)
|
894
|
+
if not k or p == 2:
|
895
|
+
raise ValueError('q must be an odd prime power')
|
896
|
+
from sage.schemes.projective.projective_space import ProjectiveSpace
|
897
|
+
from sage.rings.finite_rings.integer_mod import mod
|
898
|
+
Fq = FiniteField(q**2, 'a')
|
899
|
+
PG = map(tuple, ProjectiveSpace(2, Fq))
|
900
|
+
|
901
|
+
def S(x, y):
|
902
|
+
return sum(x[j] * y[2 - j] ** q for j in range(3))
|
903
|
+
|
904
|
+
V = [x for x in PG if S(x, x) == 0] # the points of the unital
|
905
|
+
v0 = V[0]
|
906
|
+
V.remove(v0)
|
907
|
+
if mod(q, 4) == 1:
|
908
|
+
G = Graph([V, lambda y, z: not (S(v0, y)*S(y, z)*S(z, v0)).is_square()], loops=False)
|
909
|
+
else:
|
910
|
+
G = Graph([V, lambda y, z: (S(v0, y)*S(y, z)*S(z, v0)).is_square()], loops=False)
|
911
|
+
G.name("Taylor two-graph descendant SRG")
|
912
|
+
if clique_partition:
|
913
|
+
lines = [[t for t in V if t[0] + z * t[1] == 0]
|
914
|
+
for z in Fq if z]
|
915
|
+
return (G, lines, v0)
|
916
|
+
else:
|
917
|
+
return G
|
918
|
+
|
919
|
+
|
920
|
+
def TaylorTwographSRG(q):
|
921
|
+
r"""
|
922
|
+
Return a strongly regular graph from the Taylor's two-graph for `U_3(q)`,
|
923
|
+
`q` odd
|
924
|
+
|
925
|
+
This is a strongly regular graph with parameters
|
926
|
+
`(v,k,\lambda,\mu)=(q^3+1, q(q^2+1)/2, (q^2+3)(q-1)/4, (q^2+1)(q+1)/4)`
|
927
|
+
in the Seidel switching class of
|
928
|
+
:func:`Taylor two-graph <sage.combinat.designs.twographs.taylor_twograph>`.
|
929
|
+
Details are in §7E of [BL1984]_.
|
930
|
+
|
931
|
+
INPUT:
|
932
|
+
|
933
|
+
- ``q`` -- a power of an odd prime number
|
934
|
+
|
935
|
+
.. SEEALSO::
|
936
|
+
|
937
|
+
* :meth:`~sage.graphs.graph_generators.GraphGenerators.TaylorTwographDescendantSRG`
|
938
|
+
|
939
|
+
EXAMPLES::
|
940
|
+
|
941
|
+
sage: t = graphs.TaylorTwographSRG(3); t # needs sage.rings.finite_rings
|
942
|
+
Taylor two-graph SRG: Graph on 28 vertices
|
943
|
+
sage: t.is_strongly_regular(parameters=True) # needs sage.rings.finite_rings
|
944
|
+
(28, 15, 6, 10)
|
945
|
+
"""
|
946
|
+
G, l, v0 = TaylorTwographDescendantSRG(q, clique_partition=True)
|
947
|
+
G.add_vertex(v0)
|
948
|
+
G.seidel_switching(sum(l[:(q**2 + 1)/2], []))
|
949
|
+
G.name("Taylor two-graph SRG")
|
950
|
+
return G
|
951
|
+
|
952
|
+
|
953
|
+
def AhrensSzekeresGeneralizedQuadrangleGraph(q, dual=False):
|
954
|
+
r"""
|
955
|
+
Return the collinearity graph of the generalized quadrangle `AS(q)`, or of
|
956
|
+
its dual
|
957
|
+
|
958
|
+
Let `q` be an odd prime power. `AS(q)` is a generalized quadrangle
|
959
|
+
(:wikipedia:`Generalized_quadrangle`) of
|
960
|
+
order `(q-1,q+1)`, see 3.1.5 in [PT2009]_. Its points are elements
|
961
|
+
of `F_q^3`, and lines are sets of size `q` of the form
|
962
|
+
|
963
|
+
* `\{ (\sigma, a, b) \mid \sigma\in F_q \}`
|
964
|
+
* `\{ (a, \sigma, b) \mid \sigma\in F_q \}`
|
965
|
+
* `\{ (c \sigma^2 - b \sigma + a, -2 c \sigma + b, \sigma) \mid \sigma\in F_q \}`,
|
966
|
+
|
967
|
+
where `a`, `b`, `c` are arbitrary elements of `F_q`.
|
968
|
+
|
969
|
+
INPUT:
|
970
|
+
|
971
|
+
- ``q`` -- a power of an odd prime number
|
972
|
+
|
973
|
+
- ``dual`` -- boolean (default: ``False``); whether to return the
|
974
|
+
collinearity graph of `AS(q)` or of the dual `AS(q)` (when ``True``)
|
975
|
+
|
976
|
+
EXAMPLES::
|
977
|
+
|
978
|
+
sage: g = graphs.AhrensSzekeresGeneralizedQuadrangleGraph(5); g
|
979
|
+
AS(5); GQ(4, 6): Graph on 125 vertices
|
980
|
+
sage: g.is_strongly_regular(parameters=True)
|
981
|
+
(125, 28, 3, 7)
|
982
|
+
sage: g = graphs.AhrensSzekeresGeneralizedQuadrangleGraph(5, dual=True); g
|
983
|
+
AS(5)*; GQ(6, 4): Graph on 175 vertices
|
984
|
+
sage: g.is_strongly_regular(parameters=True)
|
985
|
+
(175, 30, 5, 5)
|
986
|
+
"""
|
987
|
+
from sage.combinat.designs.incidence_structures import IncidenceStructure
|
988
|
+
p, k = is_prime_power(q, get_data=True)
|
989
|
+
if not k or p == 2:
|
990
|
+
raise ValueError('q must be an odd prime power')
|
991
|
+
F = FiniteField(q, 'a')
|
992
|
+
L = []
|
993
|
+
for a in F:
|
994
|
+
for b in F:
|
995
|
+
L.append(tuple((s, a, b) for s in F))
|
996
|
+
L.append(tuple((a, s, b) for s in F))
|
997
|
+
for c in F:
|
998
|
+
L.append(tuple((c*s**2 - b*s + a, -2*c*s + b, s) for s in F))
|
999
|
+
if dual:
|
1000
|
+
G = IncidenceStructure(L).intersection_graph()
|
1001
|
+
G.name('AS(' + str(q) + ')*; GQ' + str((q + 1, q - 1)))
|
1002
|
+
else:
|
1003
|
+
G = IncidenceStructure(L).dual().intersection_graph()
|
1004
|
+
G.name('AS(' + str(q) + '); GQ' + str((q - 1, q + 1)))
|
1005
|
+
return G
|
1006
|
+
|
1007
|
+
|
1008
|
+
def T2starGeneralizedQuadrangleGraph(q, dual=False, hyperoval=None, field=None, check_hyperoval=True):
|
1009
|
+
r"""
|
1010
|
+
Return the collinearity graph of the generalized quadrangle `T_2^*(q)`, or
|
1011
|
+
of its dual
|
1012
|
+
|
1013
|
+
Let `q=2^k` and `\Theta=PG(3,q)`. `T_2^*(q)` is a generalized quadrangle
|
1014
|
+
(:wikipedia:`Generalized_quadrangle`)
|
1015
|
+
of order `(q-1,q+1)`, see 3.1.3 in [PT2009]_. Fix a plane `\Pi \subset
|
1016
|
+
\Theta` and a
|
1017
|
+
`hyperoval <http://en.wikipedia.org/wiki/Oval_(projective_plane)#Even_q>`__
|
1018
|
+
`O \subset \Pi`. The points of `T_2^*(q):=T_2^*(O)` are the points of
|
1019
|
+
`\Theta` outside `\Pi`, and the lines are the lines of `\Theta` outside
|
1020
|
+
`\Pi` that meet `\Pi` in a point of `O`.
|
1021
|
+
|
1022
|
+
INPUT:
|
1023
|
+
|
1024
|
+
- ``q`` -- a power of two
|
1025
|
+
|
1026
|
+
- ``dual`` -- boolean (default: ``False``); whether to return the graph of
|
1027
|
+
`T_2^*(O)` or of the dual `T_2^*(O)` (when ``True``)
|
1028
|
+
|
1029
|
+
- ``hyperoval`` -- a hyperoval (i.e. a complete 2-arc; a set of points in
|
1030
|
+
the plane meeting every line in 0 or 2 points) in the plane of points with
|
1031
|
+
0th coordinate 0 in `PG(3,q)` over the field ``field``. Each point of
|
1032
|
+
``hyperoval`` must be a length 4 vector over ``field`` with 1st non-0
|
1033
|
+
coordinate equal to 1. By default, ``hyperoval`` and ``field`` are not
|
1034
|
+
specified, and constructed on the fly. In particular, ``hyperoval`` we
|
1035
|
+
build is the classical one, i.e. a conic with the point of intersection of
|
1036
|
+
its tangent lines.
|
1037
|
+
|
1038
|
+
- ``field`` -- an instance of a finite field of order `q`, must be provided
|
1039
|
+
if ``hyperoval`` is provided
|
1040
|
+
|
1041
|
+
- ``check_hyperoval`` -- boolean (default: ``True``); whether to check
|
1042
|
+
``hyperoval`` for correctness or not
|
1043
|
+
|
1044
|
+
EXAMPLES:
|
1045
|
+
|
1046
|
+
using the built-in construction::
|
1047
|
+
|
1048
|
+
sage: # needs sage.combinat sage.rings.finite_rings
|
1049
|
+
sage: g = graphs.T2starGeneralizedQuadrangleGraph(4); g
|
1050
|
+
T2*(O,4); GQ(3, 5): Graph on 64 vertices
|
1051
|
+
sage: g.is_strongly_regular(parameters=True)
|
1052
|
+
(64, 18, 2, 6)
|
1053
|
+
sage: g = graphs.T2starGeneralizedQuadrangleGraph(4, dual=True); g
|
1054
|
+
T2*(O,4)*; GQ(5, 3): Graph on 96 vertices
|
1055
|
+
sage: g.is_strongly_regular(parameters=True)
|
1056
|
+
(96, 20, 4, 4)
|
1057
|
+
|
1058
|
+
supplying your own hyperoval::
|
1059
|
+
|
1060
|
+
sage: # needs sage.combinat sage.rings.finite_rings
|
1061
|
+
sage: F = GF(4,'b')
|
1062
|
+
sage: O = [vector(F,(0,0,0,1)),vector(F,(0,0,1,0))] + [vector(F, (0,1,x^2,x))
|
1063
|
+
....: for x in F]
|
1064
|
+
sage: g = graphs.T2starGeneralizedQuadrangleGraph(4, hyperoval=O, field=F); g
|
1065
|
+
T2*(O,4); GQ(3, 5): Graph on 64 vertices
|
1066
|
+
sage: g.is_strongly_regular(parameters=True)
|
1067
|
+
(64, 18, 2, 6)
|
1068
|
+
|
1069
|
+
TESTS::
|
1070
|
+
|
1071
|
+
sage: # needs sage.combinat sage.rings.finite_rings
|
1072
|
+
sage: F = GF(4,'b') # repeating a point...
|
1073
|
+
sage: O = [vector(F,(0,1,0,0)),vector(F,(0,0,1,0))]+[vector(F, (0,1,x^2,x)) for x in F]
|
1074
|
+
sage: graphs.T2starGeneralizedQuadrangleGraph(4, hyperoval=O, field=F)
|
1075
|
+
Traceback (most recent call last):
|
1076
|
+
...
|
1077
|
+
RuntimeError: incorrect hyperoval size
|
1078
|
+
sage: O = [vector(F,(0,1,1,0)),vector(F,(0,0,1,0))]+[vector(F, (0,1,x^2,x)) for x in F]
|
1079
|
+
sage: graphs.T2starGeneralizedQuadrangleGraph(4, hyperoval=O, field=F)
|
1080
|
+
Traceback (most recent call last):
|
1081
|
+
...
|
1082
|
+
RuntimeError: incorrect hyperoval
|
1083
|
+
"""
|
1084
|
+
from sage.combinat.designs.incidence_structures import IncidenceStructure
|
1085
|
+
from sage.combinat.designs.block_design import ProjectiveGeometryDesign as PG
|
1086
|
+
|
1087
|
+
p, k = is_prime_power(q, get_data=True)
|
1088
|
+
if not k or p != 2:
|
1089
|
+
raise ValueError('q must be a power of 2')
|
1090
|
+
if field is None:
|
1091
|
+
F = FiniteField(q, 'a')
|
1092
|
+
else:
|
1093
|
+
F = field
|
1094
|
+
|
1095
|
+
Theta = PG(3, 1, F, point_coordinates=1)
|
1096
|
+
Pi = set(x for x in Theta.ground_set() if x[0] == F.zero())
|
1097
|
+
if hyperoval is None:
|
1098
|
+
HO = set(x for x in Pi
|
1099
|
+
if (x[1] + x[2] * x[3] == 0) or
|
1100
|
+
(x[1] == 1 and x[2] == x[3] == 0))
|
1101
|
+
else:
|
1102
|
+
for v in hyperoval:
|
1103
|
+
v.set_immutable()
|
1104
|
+
|
1105
|
+
HO = set(hyperoval)
|
1106
|
+
if check_hyperoval:
|
1107
|
+
if len(HO) != q + 2:
|
1108
|
+
raise RuntimeError("incorrect hyperoval size")
|
1109
|
+
for L in Theta.blocks():
|
1110
|
+
if set(L).issubset(Pi):
|
1111
|
+
if len(HO.intersection(L)) not in [0, 2]:
|
1112
|
+
raise RuntimeError("incorrect hyperoval")
|
1113
|
+
|
1114
|
+
L = [[y for y in z if y not in HO]
|
1115
|
+
for z in [x for x in Theta.blocks() if len(HO.intersection(x)) == 1]]
|
1116
|
+
|
1117
|
+
if dual:
|
1118
|
+
G = IncidenceStructure(L).intersection_graph()
|
1119
|
+
G.name('T2*(O,' + str(q) + ')*; GQ' + str((q + 1, q - 1)))
|
1120
|
+
else:
|
1121
|
+
G = IncidenceStructure(L).dual().intersection_graph()
|
1122
|
+
G.name('T2*(O,' + str(q) + '); GQ' + str((q - 1, q + 1)))
|
1123
|
+
return G
|
1124
|
+
|
1125
|
+
|
1126
|
+
def HaemersGraph(q, hyperoval=None, hyperoval_matching=None, field=None, check_hyperoval=True):
|
1127
|
+
r"""
|
1128
|
+
Return the Haemers graph obtained from `T_2^*(q)^*`.
|
1129
|
+
|
1130
|
+
Let `q` be a power of 2. In Sect. 8.A of [BL1984]_ one finds a construction
|
1131
|
+
of a strongly regular graph with parameters `(q^2(q+2),q^2+q-1,q-2,q)` from
|
1132
|
+
the graph of `T_2^*(q)^*`, constructed by
|
1133
|
+
:func:`~sage.graphs.graph_generators.GraphGenerators.T2starGeneralizedQuadrangleGraph`,
|
1134
|
+
by redefining adjacencies in the way specified by an arbitrary
|
1135
|
+
``hyperoval_matching`` of the points (i.e. partitioning into size two parts)
|
1136
|
+
of ``hyperoval`` defining `T_2^*(q)^*`.
|
1137
|
+
|
1138
|
+
While [BL1984]_ gives the construction in geometric terms, it can be
|
1139
|
+
formulated, and is implemented, in graph-theoretic ones, of re-adjusting the
|
1140
|
+
edges. Namely, `G=T_2^*(q)^*` has a partition into `q+2` independent sets
|
1141
|
+
`I_k` of size `q^2` each. Each vertex in `I_j` is adjacent to `q` vertices
|
1142
|
+
from `I_k`. Each `I_k` is paired to some `I_{k'}`, according to
|
1143
|
+
``hyperoval_matching``. One adds edges `(s,t)` for `s,t \in I_k` whenever
|
1144
|
+
`s` and `t` are adjacent to some `u \in I_{k'}`, and removes all the edges
|
1145
|
+
between `I_k` and `I_{k'}`.
|
1146
|
+
|
1147
|
+
INPUT:
|
1148
|
+
|
1149
|
+
- ``q`` -- a power of two
|
1150
|
+
|
1151
|
+
- ``hyperoval_matching`` -- if ``None`` (default), pair each `i`-th point of
|
1152
|
+
``hyperoval`` with `(i+1)`-th. Otherwise, specifies the pairing
|
1153
|
+
in the format `((i_1,i'_1),(i_2,i'_2),...)`.
|
1154
|
+
|
1155
|
+
- ``hyperoval`` -- a hyperoval defining `T_2^*(q)^*`. If ``None`` (default),
|
1156
|
+
the classical hyperoval obtained from a conic is used. See the
|
1157
|
+
documentation of
|
1158
|
+
:func:`~sage.graphs.graph_generators.GraphGenerators.T2starGeneralizedQuadrangleGraph`,
|
1159
|
+
for more information.
|
1160
|
+
|
1161
|
+
- ``field`` -- an instance of a finite field of order `q`, must be provided
|
1162
|
+
if ``hyperoval`` is provided
|
1163
|
+
|
1164
|
+
- ``check_hyperoval`` -- boolean (default: ``True``); whether to check
|
1165
|
+
``hyperoval`` for correctness or not
|
1166
|
+
|
1167
|
+
EXAMPLES:
|
1168
|
+
|
1169
|
+
using the built-in constructions::
|
1170
|
+
|
1171
|
+
sage: # needs sage.combinat sage.rings.finite_rings
|
1172
|
+
sage: g = graphs.HaemersGraph(4); g
|
1173
|
+
Haemers(4): Graph on 96 vertices
|
1174
|
+
sage: g.is_strongly_regular(parameters=True)
|
1175
|
+
(96, 19, 2, 4)
|
1176
|
+
|
1177
|
+
supplying your own hyperoval_matching::
|
1178
|
+
|
1179
|
+
sage: # needs sage.combinat sage.rings.finite_rings
|
1180
|
+
sage: g = graphs.HaemersGraph(4, hyperoval_matching=((0,5),(1,4),(2,3))); g
|
1181
|
+
Haemers(4): Graph on 96 vertices
|
1182
|
+
sage: g.is_strongly_regular(parameters=True)
|
1183
|
+
(96, 19, 2, 4)
|
1184
|
+
|
1185
|
+
TESTS::
|
1186
|
+
|
1187
|
+
sage: # needs sage.combinat sage.rings.finite_rings
|
1188
|
+
sage: F = GF(4,'b') # repeating a point...
|
1189
|
+
sage: O = [vector(F,(0,1,0,0)),vector(F,(0,0,1,0))]+[vector(F, (0,1,x^2,x)) for x in F]
|
1190
|
+
sage: graphs.HaemersGraph(4, hyperoval=O, field=F)
|
1191
|
+
Traceback (most recent call last):
|
1192
|
+
...
|
1193
|
+
RuntimeError: incorrect hyperoval size
|
1194
|
+
sage: O = [vector(F,(0,1,1,0)),vector(F,(0,0,1,0))]+[vector(F, (0,1,x^2,x)) for x in F]
|
1195
|
+
sage: graphs.HaemersGraph(4, hyperoval=O, field=F)
|
1196
|
+
Traceback (most recent call last):
|
1197
|
+
...
|
1198
|
+
RuntimeError: incorrect hyperoval
|
1199
|
+
|
1200
|
+
sage: g = graphs.HaemersGraph(8); g # not tested (long time) # needs sage.rings.finite_rings
|
1201
|
+
Haemers(8): Graph on 640 vertices
|
1202
|
+
sage: g.is_strongly_regular(parameters=True) # not tested (long time) # needs sage.rings.finite_rings
|
1203
|
+
(640, 71, 6, 8)
|
1204
|
+
"""
|
1205
|
+
from sage.modules.free_module_element import free_module_element as vector
|
1206
|
+
from sage.rings.finite_rings.finite_field_constructor import GF
|
1207
|
+
from itertools import combinations
|
1208
|
+
|
1209
|
+
p, k = is_prime_power(q, get_data=True)
|
1210
|
+
if not k or p != 2:
|
1211
|
+
raise ValueError('q must be a power of 2')
|
1212
|
+
|
1213
|
+
if hyperoval_matching is None:
|
1214
|
+
hyperoval_matching = [(2 * K + 1, 2 * K) for K in range(1 + q // 2)]
|
1215
|
+
if field is None:
|
1216
|
+
F = GF(q, 'a')
|
1217
|
+
else:
|
1218
|
+
F = field
|
1219
|
+
|
1220
|
+
# for q=8, 95% of CPU time taken by this function is spent in the following call
|
1221
|
+
G = T2starGeneralizedQuadrangleGraph(q, field=F, dual=True,
|
1222
|
+
hyperoval=hyperoval,
|
1223
|
+
check_hyperoval=check_hyperoval)
|
1224
|
+
|
1225
|
+
def normalize(v): # make sure the 1st non-0 coordinate is 1.
|
1226
|
+
d = next(x for x in v if x != F.zero())
|
1227
|
+
return vector([x / d for x in v])
|
1228
|
+
|
1229
|
+
# build the partition into independent sets
|
1230
|
+
P = [tuple(normalize(v[0] - v[1])) for v in G.vertices(sort=True)]
|
1231
|
+
Pi_to_int = {Pi: i for i, Pi in enumerate(set(P))}
|
1232
|
+
I_ks = {x: [] for x in range(q + 2)} # the partition into I_k's
|
1233
|
+
for i, Pi in enumerate(P):
|
1234
|
+
I_ks[Pi_to_int[tuple(Pi)]].append(i)
|
1235
|
+
|
1236
|
+
# perform the adjustment of the edges, as described.
|
1237
|
+
G.relabel(range(G.order()))
|
1238
|
+
cliques = []
|
1239
|
+
for i, j in hyperoval_matching:
|
1240
|
+
Pij = set(I_ks[i] + I_ks[j])
|
1241
|
+
for v in Pij:
|
1242
|
+
cliques.append(Pij.intersection(G.neighbors(v)))
|
1243
|
+
G.delete_edges(G.edge_boundary(I_ks[i], I_ks[j])) # edges on (I_i,I_j)
|
1244
|
+
G.add_edges(e for c in cliques for e in combinations(c, 2))
|
1245
|
+
G.name('Haemers(' + str(q) + ')')
|
1246
|
+
return G
|
1247
|
+
|
1248
|
+
|
1249
|
+
def CossidentePenttilaGraph(q):
|
1250
|
+
r"""
|
1251
|
+
Return the Cossidente-Penttila
|
1252
|
+
`((q^3+1)(q+1)/2,(q^2+1)(q-1)/2,(q-3)/2,(q-1)^2/2)`-strongly regular graph
|
1253
|
+
|
1254
|
+
For each odd prime power `q`, one can partition the points of the
|
1255
|
+
`O_6^-(q)`-generalized quadrangle `GQ(q,q^2)` into two parts, so that on any
|
1256
|
+
of them the induced subgraph of the point graph of the GQ has parameters as
|
1257
|
+
above [CP2005]_.
|
1258
|
+
|
1259
|
+
Directly following the construction in [CP2005]_ is not efficient, as one
|
1260
|
+
then needs to construct the dual `GQ(q^2,q)`. Thus we describe here a more
|
1261
|
+
efficient approach that we came up with, following a suggestion by
|
1262
|
+
T.Penttila. Namely, this partition is invariant under the subgroup
|
1263
|
+
`H=\Omega_3(q^2)<O_6^-(q)`. We build the appropriate `H`, which leaves the
|
1264
|
+
form `B(X,Y,Z)=XY+Z^2` invariant, and pick up two orbits of `H` on the
|
1265
|
+
`F_q`-points. One them is `B`-isotropic, and we take the representative
|
1266
|
+
`(1:0:0)`. The other one corresponds to the points of `PG(2,q^2)` that have
|
1267
|
+
all the lines on them either missing the conic specified by `B`, or
|
1268
|
+
intersecting the conic in two points. We take `(1:1:e)` as the
|
1269
|
+
representative. It suffices to pick `e` so that `e^2+1` is not a square in
|
1270
|
+
`F_{q^2}`. Indeed, The conic can be viewed as the union of `\{(0:1:0)\}` and
|
1271
|
+
`\{(1:-t^2:t) | t \in F_{q^2}\}`. The coefficients of a generic line on
|
1272
|
+
`(1:1:e)` are `[1:-1-eb:b]`, for `-1\neq eb`. Thus, to make sure the
|
1273
|
+
intersection with the conic is always even, we need that the discriminant of
|
1274
|
+
`1+(1+eb)t^2+tb=0` never vanishes, and this is if and only if `e^2+1` is not
|
1275
|
+
a square. Further, we need to adjust `B`, by multiplying it by appropriately
|
1276
|
+
chosen `\nu`, so that `(1:1:e)` becomes isotropic under the relative trace
|
1277
|
+
norm `\nu B(X,Y,Z)+(\nu B(X,Y,Z))^q`. The latter is used then to define the
|
1278
|
+
graph.
|
1279
|
+
|
1280
|
+
INPUT:
|
1281
|
+
|
1282
|
+
- ``q`` -- an odd prime power
|
1283
|
+
|
1284
|
+
EXAMPLES:
|
1285
|
+
|
1286
|
+
For `q=3` one gets Sims-Gewirtz graph. ::
|
1287
|
+
|
1288
|
+
sage: G = graphs.CossidentePenttilaGraph(3) # optional - gap_package_grape
|
1289
|
+
sage: G.is_strongly_regular(parameters=True) # optional - gap_package_grape
|
1290
|
+
(56, 10, 0, 2)
|
1291
|
+
|
1292
|
+
For `q>3` one gets new graphs. ::
|
1293
|
+
|
1294
|
+
sage: G = graphs.CossidentePenttilaGraph(5) # optional - gap_package_grape
|
1295
|
+
sage: G.is_strongly_regular(parameters=True) # optional - gap_package_grape
|
1296
|
+
(378, 52, 1, 8)
|
1297
|
+
|
1298
|
+
TESTS::
|
1299
|
+
|
1300
|
+
sage: G = graphs.CossidentePenttilaGraph(7) # optional - gap_package_grape, long time
|
1301
|
+
sage: G.is_strongly_regular(parameters=True) # optional - gap_package_grape, long time
|
1302
|
+
(1376, 150, 2, 18)
|
1303
|
+
sage: graphs.CossidentePenttilaGraph(2)
|
1304
|
+
Traceback (most recent call last):
|
1305
|
+
...
|
1306
|
+
ValueError: q(=2) must be an odd prime power
|
1307
|
+
"""
|
1308
|
+
p, k = is_prime_power(q, get_data=True)
|
1309
|
+
if not k or p == 2:
|
1310
|
+
raise ValueError('q(={}) must be an odd prime power'.format(q))
|
1311
|
+
|
1312
|
+
from sage.features.gap import GapPackage
|
1313
|
+
GapPackage("grape", spkg='gap_packages').require()
|
1314
|
+
|
1315
|
+
from sage.libs.gap.libgap import libgap
|
1316
|
+
adj_list = libgap.function_factory("""function(q)
|
1317
|
+
local z, e, so, G, nu, G1, G0, B, T, s, O1, O2, x, sqo;
|
1318
|
+
LoadPackage("grape");
|
1319
|
+
G0:=SO(3,q^2);
|
1320
|
+
so:=GeneratorsOfGroup(G0);
|
1321
|
+
G1:=Group(Comm(so[1],so[2]),Comm(so[1],so[3]),Comm(so[2],so[3]));
|
1322
|
+
B:=InvariantBilinearForm(G0).matrix;
|
1323
|
+
z:=Z(q^2); e:=z; sqo:=(q^2-1)/2;
|
1324
|
+
if IsInt(sqo/Order(e^2+z^0)) then
|
1325
|
+
e:=z^First([2..q^2-2], x-> not IsInt(sqo/Order(z^(2*x)+z^0)));
|
1326
|
+
fi;
|
1327
|
+
nu:=z^First([0..q^2-2], x->z^x*(e^2+z^0)+(z^x*(e^2+z^0))^q=0*z);
|
1328
|
+
T:=function(x)
|
1329
|
+
local r;
|
1330
|
+
r:=nu*x*B*x;
|
1331
|
+
return r+r^q;
|
1332
|
+
end;
|
1333
|
+
s:=Group([Z(q)*IdentityMat(3,GF(q))]);
|
1334
|
+
O1:=Orbit(G1, Set(Orbit(s,z^0*[1,0,0])), OnSets);
|
1335
|
+
O2:=Orbit(G1, Set(Orbit(s,z^0*[1,1,e])), OnSets);
|
1336
|
+
G:=Graph(G1,Concatenation(O1,O2),OnSets,
|
1337
|
+
function(x,y) return x<>y and 0*z=T(x[1]+y[1]); end);
|
1338
|
+
return List([1..OrderGraph(G)],x->Adjacency(G,x));
|
1339
|
+
end;""")
|
1340
|
+
|
1341
|
+
adj = adj_list(q) # for each vertex, we get the list of vertices it is adjacent to
|
1342
|
+
G = Graph(((i, int(j - 1))
|
1343
|
+
for i, ni in enumerate(adj) for j in ni),
|
1344
|
+
format='list_of_edges', multiedges=False)
|
1345
|
+
G.name('CossidentePenttila(' + str(q) + ')')
|
1346
|
+
return G
|
1347
|
+
|
1348
|
+
|
1349
|
+
def Nowhere0WordsTwoWeightCodeGraph(q, hyperoval=None, field=None, check_hyperoval=True):
|
1350
|
+
r"""
|
1351
|
+
Return the subgraph of nowhere 0 words from two-weight code of projective
|
1352
|
+
plane hyperoval.
|
1353
|
+
|
1354
|
+
Let `q=2^k` and `\Pi=PG(2,q)`. Fix a
|
1355
|
+
`hyperoval <http://en.wikipedia.org/wiki/Oval_(projective_plane)#Even_q>`__
|
1356
|
+
`O \subset \Pi`. Let `V=F_q^3` and `C` the two-weight 3-dimensional linear
|
1357
|
+
code over `F_q` with words `c(v)` obtained from `v\in V` by computing
|
1358
|
+
|
1359
|
+
.. MATH::
|
1360
|
+
|
1361
|
+
c(v)=(\langle v,o_1 \rangle,...,\langle v,o_{q+2} \rangle), o_j \in O.
|
1362
|
+
|
1363
|
+
`C` contains `q(q-1)^2/2` words without 0 entries. The subgraph of the
|
1364
|
+
strongly regular graph of `C` induced on the latter words is also strongly
|
1365
|
+
regular, assuming `q>4`. This is a construction due to A.E.Brouwer
|
1366
|
+
[Bro2016]_, and leads to graphs with parameters also given by a construction
|
1367
|
+
in [HHL2009]_. According to [Bro2016]_, these two constructions are likely
|
1368
|
+
to produce isomorphic graphs.
|
1369
|
+
|
1370
|
+
INPUT:
|
1371
|
+
|
1372
|
+
- ``q`` -- a power of two
|
1373
|
+
|
1374
|
+
- ``hyperoval`` -- a hyperoval (i.e. a complete 2-arc; a set of points in
|
1375
|
+
the plane meeting every line in 0 or 2 points) in `PG(2,q)` over the field
|
1376
|
+
``field``. Each point of ``hyperoval`` must be a length 3 vector over
|
1377
|
+
``field`` with 1st non-0 coordinate equal to 1. By default, ``hyperoval``
|
1378
|
+
and ``field`` are not specified, and constructed on the fly. In
|
1379
|
+
particular, ``hyperoval`` we build is the classical one, i.e. a conic with
|
1380
|
+
the point of intersection of its tangent lines.
|
1381
|
+
|
1382
|
+
- ``field`` -- an instance of a finite field of order `q`; must be provided
|
1383
|
+
if ``hyperoval`` is provided
|
1384
|
+
|
1385
|
+
- ``check_hyperoval`` -- boolean (default: ``True``); whether to check
|
1386
|
+
``hyperoval`` for correctness or not
|
1387
|
+
|
1388
|
+
.. SEEALSO::
|
1389
|
+
|
1390
|
+
- :func:`~sage.graphs.strongly_regular_db.is_nowhere0_twoweight`
|
1391
|
+
|
1392
|
+
EXAMPLES:
|
1393
|
+
|
1394
|
+
using the built-in construction::
|
1395
|
+
|
1396
|
+
sage: # needs sage.combinat sage.rings.finite_rings
|
1397
|
+
sage: g = graphs.Nowhere0WordsTwoWeightCodeGraph(8); g
|
1398
|
+
Nowhere0WordsTwoWeightCodeGraph(8): Graph on 196 vertices
|
1399
|
+
sage: g.is_strongly_regular(parameters=True)
|
1400
|
+
(196, 60, 14, 20)
|
1401
|
+
sage: g = graphs.Nowhere0WordsTwoWeightCodeGraph(16) # not tested (long time)
|
1402
|
+
sage: g.is_strongly_regular(parameters=True) # not tested (long time)
|
1403
|
+
(1800, 728, 268, 312)
|
1404
|
+
|
1405
|
+
supplying your own hyperoval::
|
1406
|
+
|
1407
|
+
sage: # needs sage.combinat sage.rings.finite_rings
|
1408
|
+
sage: F = GF(8)
|
1409
|
+
sage: O = [vector(F,(0,0,1)),vector(F,(0,1,0))] + [vector(F, (1,x^2,x))
|
1410
|
+
....: for x in F]
|
1411
|
+
sage: g = graphs.Nowhere0WordsTwoWeightCodeGraph(8,hyperoval=O,field=F); g
|
1412
|
+
Nowhere0WordsTwoWeightCodeGraph(8): Graph on 196 vertices
|
1413
|
+
sage: g.is_strongly_regular(parameters=True)
|
1414
|
+
(196, 60, 14, 20)
|
1415
|
+
|
1416
|
+
TESTS::
|
1417
|
+
|
1418
|
+
sage: # needs sage.combinat sage.rings.finite_rings
|
1419
|
+
sage: F = GF(8) # repeating a point...
|
1420
|
+
sage: O = [vector(F,(1,0,0)),vector(F,(0,1,0))]+[vector(F, (1,x^2,x)) for x in F]
|
1421
|
+
sage: graphs.Nowhere0WordsTwoWeightCodeGraph(8,hyperoval=O,field=F)
|
1422
|
+
Traceback (most recent call last):
|
1423
|
+
...
|
1424
|
+
RuntimeError: incorrect hyperoval size
|
1425
|
+
sage: O = [vector(F,(1,1,0)),vector(F,(0,1,0))]+[vector(F, (1,x^2,x)) for x in F]
|
1426
|
+
sage: graphs.Nowhere0WordsTwoWeightCodeGraph(8,hyperoval=O,field=F)
|
1427
|
+
Traceback (most recent call last):
|
1428
|
+
...
|
1429
|
+
RuntimeError: incorrect hyperoval
|
1430
|
+
"""
|
1431
|
+
from sage.combinat.designs.block_design import ProjectiveGeometryDesign as PG
|
1432
|
+
from sage.matrix.constructor import matrix
|
1433
|
+
|
1434
|
+
p, k = is_prime_power(q, get_data=True)
|
1435
|
+
if not k or p != 2:
|
1436
|
+
raise ValueError('q must be a power of 2')
|
1437
|
+
if k < 3:
|
1438
|
+
raise ValueError('q must be a at least 8')
|
1439
|
+
if field is None:
|
1440
|
+
F = FiniteField(q, 'a')
|
1441
|
+
else:
|
1442
|
+
F = field
|
1443
|
+
|
1444
|
+
Theta = PG(2, 1, F, point_coordinates=1)
|
1445
|
+
Pi = Theta.ground_set()
|
1446
|
+
if hyperoval is None:
|
1447
|
+
hyperoval = [x for x in Pi
|
1448
|
+
if (x[0] + x[1] * x[2] == 0) or
|
1449
|
+
(x[0] == 1 and x[1] == x[2] == 0)]
|
1450
|
+
else:
|
1451
|
+
for v in hyperoval:
|
1452
|
+
v.set_immutable()
|
1453
|
+
|
1454
|
+
if check_hyperoval:
|
1455
|
+
HO = set(hyperoval)
|
1456
|
+
if len(HO) != q + 2:
|
1457
|
+
raise RuntimeError("incorrect hyperoval size")
|
1458
|
+
for L in Theta.blocks():
|
1459
|
+
if set(L).issubset(Pi):
|
1460
|
+
if len(HO.intersection(L)) not in [0, 2]:
|
1461
|
+
raise RuntimeError("incorrect hyperoval")
|
1462
|
+
M = matrix(hyperoval)
|
1463
|
+
F_0 = F.zero()
|
1464
|
+
C = [p for p in [M*x for x in F**3] if F_0 not in p]
|
1465
|
+
|
1466
|
+
for x in C:
|
1467
|
+
x.set_immutable()
|
1468
|
+
G = Graph([C, lambda x, y: F.zero() not in x + y])
|
1469
|
+
G.name('Nowhere0WordsTwoWeightCodeGraph(' + str(q) + ')')
|
1470
|
+
G.relabel()
|
1471
|
+
return G
|
1472
|
+
|
1473
|
+
|
1474
|
+
def OrthogonalDualPolarGraph(e, d, q):
|
1475
|
+
r"""
|
1476
|
+
Return the dual polar graph on `GO^e(n,q)` of diameter `d`.
|
1477
|
+
|
1478
|
+
The value of `n` is determined by `d` and `e`.
|
1479
|
+
|
1480
|
+
The graph is distance-regular with classical parameters `(d, q, 0, q^e)`.
|
1481
|
+
|
1482
|
+
INPUT:
|
1483
|
+
|
1484
|
+
- ``e`` -- integer; type of the orthogonal polar space to consider;
|
1485
|
+
must be `-1, 0` or `1`
|
1486
|
+
|
1487
|
+
- ``d`` -- integer; diameter of the graph
|
1488
|
+
|
1489
|
+
- ``q`` -- integer; prime power; order of the finite field over which to
|
1490
|
+
build the polar space
|
1491
|
+
|
1492
|
+
EXAMPLES::
|
1493
|
+
|
1494
|
+
sage: # needs sage.libs.gap
|
1495
|
+
sage: G = graphs.OrthogonalDualPolarGraph(1,3,2)
|
1496
|
+
sage: G.is_distance_regular(True)
|
1497
|
+
([7, 6, 4, None], [None, 1, 3, 7])
|
1498
|
+
sage: G = graphs.OrthogonalDualPolarGraph(0,3,3) # long time
|
1499
|
+
sage: G.is_distance_regular(True) # long time
|
1500
|
+
([39, 36, 27, None], [None, 1, 4, 13])
|
1501
|
+
sage: G.order() # long time
|
1502
|
+
1120
|
1503
|
+
|
1504
|
+
REFERENCES:
|
1505
|
+
|
1506
|
+
See [BCN1989]_ pp. 274-279 or [VDKT2016]_ p. 22.
|
1507
|
+
|
1508
|
+
TESTS::
|
1509
|
+
|
1510
|
+
sage: # needs sage.libs.gap
|
1511
|
+
sage: G = graphs.OrthogonalDualPolarGraph(0,3,2)
|
1512
|
+
sage: G.is_distance_regular(True)
|
1513
|
+
([14, 12, 8, None], [None, 1, 3, 7])
|
1514
|
+
sage: G = graphs.OrthogonalDualPolarGraph(-1,3,2) # long time
|
1515
|
+
sage: G.is_distance_regular(True) # long time
|
1516
|
+
([28, 24, 16, None], [None, 1, 3, 7])
|
1517
|
+
sage: G = graphs.OrthogonalDualPolarGraph(1,3,4)
|
1518
|
+
sage: G.is_distance_regular(True)
|
1519
|
+
([21, 20, 16, None], [None, 1, 5, 21])
|
1520
|
+
sage: G = graphs.OrthogonalDualPolarGraph(1,4,2)
|
1521
|
+
sage: G.is_distance_regular(True)
|
1522
|
+
([15, 14, 12, 8, None], [None, 1, 3, 7, 15])
|
1523
|
+
"""
|
1524
|
+
from sage.libs.gap.libgap import libgap
|
1525
|
+
from sage.matrix.constructor import Matrix
|
1526
|
+
from sage.modules.free_module import VectorSpace
|
1527
|
+
from sage.rings.finite_rings.finite_field_constructor import GF
|
1528
|
+
import itertools
|
1529
|
+
|
1530
|
+
def hashable(v):
|
1531
|
+
v.set_immutable()
|
1532
|
+
return v
|
1533
|
+
|
1534
|
+
if e not in {0, 1, -1}:
|
1535
|
+
raise ValueError("e must by 0, +1 or -1")
|
1536
|
+
|
1537
|
+
m = 2*d + 1 - e
|
1538
|
+
|
1539
|
+
group = libgap.GeneralOrthogonalGroup(e, m, q)
|
1540
|
+
M = Matrix(libgap.InvariantQuadraticForm(group)["matrix"])
|
1541
|
+
# Q(x) = xMx is our quadratic form
|
1542
|
+
|
1543
|
+
# we need to find a totally isotropic subspace of dimension d
|
1544
|
+
K = M.kernel()
|
1545
|
+
isotropicBasis = list(K.basis())
|
1546
|
+
|
1547
|
+
# extend K to a maximal isotropic subspace
|
1548
|
+
if K.dimension() < d:
|
1549
|
+
V = VectorSpace(GF(q), m)
|
1550
|
+
|
1551
|
+
# get all projective points not in K
|
1552
|
+
candidates = set(map(hashable, [P.basis()[0] for P in V.subspaces(1)]))
|
1553
|
+
hashableK = map(hashable, [P.basis()[0] for P in K.subspaces(1)])
|
1554
|
+
candidates = candidates.difference(hashableK)
|
1555
|
+
|
1556
|
+
nonZeroScalars = [x for x in GF(q) if not x.is_zero()]
|
1557
|
+
while K.dimension() < d:
|
1558
|
+
found = False
|
1559
|
+
while not found:
|
1560
|
+
v = candidates.pop()
|
1561
|
+
if v*M*v == 0:
|
1562
|
+
# found another isotropic point
|
1563
|
+
# check if we can add it to K
|
1564
|
+
found = True
|
1565
|
+
for w in isotropicBasis:
|
1566
|
+
if w*M*v + v*M*w != 0:
|
1567
|
+
found = False
|
1568
|
+
break
|
1569
|
+
# here we found a valid point
|
1570
|
+
isotropicBasis.append(v)
|
1571
|
+
|
1572
|
+
# remove new points of K
|
1573
|
+
newVectors = map(hashable,
|
1574
|
+
[k + s*v for k in K for s in nonZeroScalars])
|
1575
|
+
candidates.difference(newVectors)
|
1576
|
+
K = V.span(isotropicBasis)
|
1577
|
+
|
1578
|
+
# here K is a totally isotropic subspace of dimension d
|
1579
|
+
isotropicBasis = list(K.basis())
|
1580
|
+
|
1581
|
+
W = libgap.FullRowSpace(libgap.GF(q), m)
|
1582
|
+
isoS = libgap.Subspace(W, isotropicBasis) # gap version of K
|
1583
|
+
|
1584
|
+
allIsoPoints = libgap.Orbit(group, isotropicBasis[0], libgap.OnLines)
|
1585
|
+
permutation = libgap.Action(group, allIsoPoints, libgap.OnLines)
|
1586
|
+
# this is the permutation group generated by GO^e(n,q) acting on
|
1587
|
+
# projective isotropic points
|
1588
|
+
|
1589
|
+
# convert isoS into a list of ints representing the projective points
|
1590
|
+
isoSPoints = [libgap.Elements(libgap.Basis(x))[0]
|
1591
|
+
for x in libgap.Elements(isoS.Subspaces(1))]
|
1592
|
+
isoSPointsInt = libgap.Set([libgap.Position(allIsoPoints, x)
|
1593
|
+
for x in isoSPoints])
|
1594
|
+
|
1595
|
+
# all isotropic subspaces of dimension d
|
1596
|
+
allIsoSubspaces = libgap.Orbit(permutation, isoSPointsInt, libgap.OnSets)
|
1597
|
+
|
1598
|
+
# number of projective points in a (d-1)-subspace
|
1599
|
+
intersection_size = (q**(d-1) - 1) // (q-1)
|
1600
|
+
|
1601
|
+
edges = []
|
1602
|
+
n = len(allIsoSubspaces)
|
1603
|
+
for i, j in itertools.combinations(range(n), 2):
|
1604
|
+
if libgap.Size(libgap.Intersection(allIsoSubspaces[i],
|
1605
|
+
allIsoSubspaces[j])) \
|
1606
|
+
== intersection_size:
|
1607
|
+
edges.append((i, j))
|
1608
|
+
|
1609
|
+
G = Graph(edges, format='list_of_edges')
|
1610
|
+
G.name("Dual Polar Graph on Orthogonal group (%d, %d, %d)" % (e, m, q))
|
1611
|
+
return G
|