|
7 | 7 |
|
8 | 8 | The methods defined here appear in :mod:`sage.graphs.graph_generators`. |
9 | 9 | """ |
10 | | - |
11 | 10 | # **************************************************************************** |
12 | 11 | # Copyright (C) 2015 Sagemath project |
13 | 12 | # |
|
17 | 16 | # (at your option) any later version. |
18 | 17 | # https://www.gnu.org/licenses/ |
19 | 18 | # **************************************************************************** |
| 19 | +from itertools import combinations |
20 | 20 |
|
21 | 21 | from sage.graphs.graph import Graph |
22 | 22 | from sage.arith.misc import is_prime_power |
@@ -190,7 +190,6 @@ def AffineOrthogonalPolarGraph(d, q, sign='+'): |
190 | 190 | from sage.modules.free_module import VectorSpace |
191 | 191 | from sage.matrix.constructor import Matrix |
192 | 192 | from sage.libs.gap.libgap import libgap |
193 | | - from itertools import combinations |
194 | 193 |
|
195 | 194 | M = Matrix(libgap.InvariantQuadraticForm(libgap.GeneralOrthogonalGroup(s, d, q))['matrix']) |
196 | 195 | F = libgap.GF(q).sage() |
@@ -583,7 +582,6 @@ def _polar_graph(m, q, g, intersection_size=None): |
583 | 582 | Graph on 27 vertices |
584 | 583 | """ |
585 | 584 | from sage.libs.gap.libgap import libgap |
586 | | - from itertools import combinations |
587 | 585 | W = libgap.FullRowSpace(libgap.GF(q), m) # F_q^m |
588 | 586 | B = libgap.Elements(libgap.Basis(W)) # the standard basis of W |
589 | 587 | V = libgap.Orbit(g, B[0], libgap.OnLines) # orbit on isotropic points |
@@ -709,7 +707,6 @@ def NonisotropicUnitaryPolarGraph(m, q): |
709 | 707 | if not k: |
710 | 708 | raise ValueError('q must be a prime power') |
711 | 709 | from sage.libs.gap.libgap import libgap |
712 | | - from itertools import combinations |
713 | 710 | F = libgap.GF(q**2) # F_{q^2} |
714 | 711 | W = libgap.FullRowSpace(F, m) # F_{q^2}^m |
715 | 712 | B = libgap.Elements(libgap.Basis(W)) # the standard basis of W |
@@ -1111,7 +1108,7 @@ def T2starGeneralizedQuadrangleGraph(q, dual=False, hyperoval=None, field=None, |
1111 | 1108 | raise RuntimeError("incorrect hyperoval") |
1112 | 1109 |
|
1113 | 1110 | L = [[y for y in z if y not in HO] |
1114 | | - for z in [x for x in Theta.blocks() if len(HO.intersection(x)) == 1]] |
| 1111 | + for z in Theta.blocks() if len(HO.intersection(z)) == 1] |
1115 | 1112 |
|
1116 | 1113 | if dual: |
1117 | 1114 | G = IncidenceStructure(L).intersection_graph() |
@@ -1203,7 +1200,6 @@ def HaemersGraph(q, hyperoval=None, hyperoval_matching=None, field=None, check_h |
1203 | 1200 | """ |
1204 | 1201 | from sage.modules.free_module_element import free_module_element as vector |
1205 | 1202 | from sage.rings.finite_rings.finite_field_constructor import GF |
1206 | | - from itertools import combinations |
1207 | 1203 |
|
1208 | 1204 | p, k = is_prime_power(q, get_data=True) |
1209 | 1205 | if not k or p != 2: |
@@ -1524,7 +1520,6 @@ def OrthogonalDualPolarGraph(e, d, q): |
1524 | 1520 | from sage.matrix.constructor import Matrix |
1525 | 1521 | from sage.modules.free_module import VectorSpace |
1526 | 1522 | from sage.rings.finite_rings.finite_field_constructor import GF |
1527 | | - import itertools |
1528 | 1523 |
|
1529 | 1524 | def hashable(v): |
1530 | 1525 | v.set_immutable() |
@@ -1595,15 +1590,13 @@ def hashable(v): |
1595 | 1590 | allIsoSubspaces = libgap.Orbit(permutation, isoSPointsInt, libgap.OnSets) |
1596 | 1591 |
|
1597 | 1592 | # number of projective points in a (d-1)-subspace |
1598 | | - intersection_size = (q**(d-1) - 1) // (q-1) |
| 1593 | + intersection_size = (q**(d - 1) - 1) // (q - 1) |
1599 | 1594 |
|
1600 | | - edges = [] |
1601 | 1595 | n = len(allIsoSubspaces) |
1602 | | - for i, j in itertools.combinations(range(n), 2): |
1603 | | - if libgap.Size(libgap.Intersection(allIsoSubspaces[i], |
1604 | | - allIsoSubspaces[j])) \ |
1605 | | - == intersection_size: |
1606 | | - edges.append((i, j)) |
| 1596 | + edges = [(i, j) for i, j in combinations(range(n), 2) |
| 1597 | + if libgap.Size(libgap.Intersection(allIsoSubspaces[i], |
| 1598 | + allIsoSubspaces[j])) |
| 1599 | + == intersection_size] |
1607 | 1600 |
|
1608 | 1601 | G = Graph(edges, format='list_of_edges') |
1609 | 1602 | G.name("Dual Polar Graph on Orthogonal group (%d, %d, %d)" % (e, m, q)) |
|
0 commit comments