passagemath-graphs 10.5.10__cp39-cp39-macosx_14_0_arm64.whl → 10.5.43__cp39-cp39-macosx_14_0_arm64.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.5.10.dist-info → passagemath_graphs-10.5.43.dist-info}/METADATA +126 -30
- passagemath_graphs-10.5.43.dist-info/RECORD +256 -0
- {passagemath_graphs-10.5.10.dist-info → passagemath_graphs-10.5.43.dist-info}/WHEEL +2 -1
- passagemath_graphs.dylibs/libgmp.10.dylib +0 -0
- sage/all__sagemath_graphs.py +5 -0
- sage/combinat/abstract_tree.py +1 -1
- sage/combinat/binary_tree.py +1 -1
- sage/combinat/cluster_algebra_quiver/all.py +1 -1
- sage/combinat/cluster_algebra_quiver/cluster_seed.py +28 -24
- sage/combinat/cluster_algebra_quiver/interact.py +4 -0
- sage/combinat/designs/MOLS_handbook_data.py +5 -5
- sage/combinat/designs/bibd.py +10 -9
- sage/combinat/designs/covering_array.py +3 -3
- sage/combinat/designs/covering_design.py +2 -1
- sage/combinat/designs/database.py +11 -10
- sage/combinat/designs/designs_pyx.cpython-39-darwin.so +0 -0
- sage/combinat/designs/designs_pyx.pyx +13 -45
- sage/combinat/designs/difference_family.py +6 -6
- sage/combinat/designs/difference_matrices.py +1 -1
- sage/combinat/designs/evenly_distributed_sets.cpython-39-darwin.so +0 -0
- sage/combinat/designs/evenly_distributed_sets.pyx +15 -22
- sage/combinat/designs/ext_rep.py +9 -14
- sage/combinat/designs/gen_quadrangles_with_spread.cpython-39-darwin.so +0 -0
- sage/combinat/designs/gen_quadrangles_with_spread.pyx +1 -1
- sage/combinat/designs/group_divisible_designs.py +1 -1
- sage/combinat/designs/incidence_structures.py +8 -8
- sage/combinat/designs/latin_squares.py +1 -1
- sage/combinat/designs/orthogonal_arrays_build_recursive.py +8 -7
- sage/combinat/designs/orthogonal_arrays_find_recursive.cpython-39-darwin.so +0 -0
- sage/combinat/designs/resolvable_bibd.py +1 -1
- sage/combinat/designs/steiner_quadruple_systems.py +1 -1
- sage/combinat/designs/subhypergraph_search.cpython-39-darwin.so +0 -0
- sage/combinat/designs/subhypergraph_search.pyx +9 -9
- sage/combinat/finite_state_machine_generators.py +2 -2
- sage/combinat/graph_path.py +3 -3
- sage/combinat/interval_posets.py +10 -10
- sage/combinat/ordered_tree.py +1 -1
- sage/combinat/posets/cartesian_product.py +1 -1
- sage/combinat/posets/d_complete.py +1 -1
- sage/combinat/posets/forest.py +1 -1
- sage/combinat/posets/hasse_cython.cpython-39-darwin.so +0 -0
- sage/combinat/posets/hasse_diagram.py +8 -6
- sage/combinat/posets/incidence_algebras.py +8 -8
- sage/combinat/posets/lattices.py +28 -4
- sage/combinat/posets/linear_extension_iterator.cpython-39-darwin.so +0 -0
- sage/combinat/posets/linear_extension_iterator.pyx +2 -0
- sage/combinat/posets/linear_extensions.py +7 -16
- sage/combinat/posets/moebius_algebra.py +1 -1
- sage/combinat/posets/poset_examples.py +1 -1
- sage/combinat/posets/posets.py +54 -56
- sage/combinat/rooted_tree.py +3 -3
- sage/combinat/tamari_lattices.py +1 -1
- 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/asteroidal_triples.cpython-39-darwin.so +0 -0
- sage/graphs/base/boost_graph.cpython-39-darwin.so +0 -0
- sage/graphs/base/boost_graph.pxd +1 -1
- sage/graphs/base/boost_graph.pyx +1 -1
- sage/graphs/base/c_graph.cpython-39-darwin.so +0 -0
- sage/graphs/base/c_graph.pxd +4 -4
- sage/graphs/base/c_graph.pyx +270 -184
- sage/graphs/base/dense_graph.cpython-39-darwin.so +0 -0
- sage/graphs/base/graph_backends.cpython-39-darwin.so +0 -0
- sage/graphs/base/sparse_graph.cpython-39-darwin.so +0 -0
- sage/graphs/base/static_dense_graph.cpython-39-darwin.so +0 -0
- sage/graphs/base/static_sparse_backend.cpython-39-darwin.so +0 -0
- sage/graphs/base/static_sparse_backend.pyx +93 -6
- sage/graphs/base/static_sparse_graph.cpython-39-darwin.so +0 -0
- sage/graphs/base/static_sparse_graph.pyx +1 -1
- sage/graphs/bipartite_graph.py +0 -1
- sage/graphs/centrality.cpython-39-darwin.so +0 -0
- sage/graphs/centrality.pyx +0 -0
- sage/graphs/comparability.cpython-39-darwin.so +0 -0
- sage/graphs/comparability.pyx +172 -138
- sage/graphs/connectivity.cpython-39-darwin.so +0 -0
- sage/graphs/connectivity.pyx +194 -18
- sage/graphs/convexity_properties.cpython-39-darwin.so +0 -0
- sage/graphs/digraph_generators.py +118 -74
- sage/graphs/distances_all_pairs.cpython-39-darwin.so +0 -0
- sage/graphs/distances_all_pairs.pyx +145 -27
- sage/graphs/edge_connectivity.cpython-39-darwin.so +0 -0
- sage/graphs/generators/basic.py +471 -130
- sage/graphs/generators/distance_regular.cpython-39-darwin.so +0 -0
- sage/graphs/generators/distance_regular.pyx +12 -12
- sage/graphs/generators/families.py +2 -2
- sage/graphs/generators/random.py +8 -13
- sage/graphs/generators/smallgraphs.py +12 -11
- sage/graphs/generic_graph.py +687 -265
- sage/graphs/generic_graph_pyx.cpython-39-darwin.so +0 -0
- sage/graphs/genus.cpython-39-darwin.so +0 -0
- sage/graphs/graph.py +12 -46
- sage/graphs/graph_coloring.cpython-39-darwin.so +0 -0
- sage/graphs/graph_database.py +1 -1
- sage/graphs/graph_decompositions/bandwidth.cpython-39-darwin.so +0 -0
- sage/graphs/graph_decompositions/clique_separators.cpython-39-darwin.so +0 -0
- sage/graphs/graph_decompositions/cutwidth.cpython-39-darwin.so +0 -0
- sage/graphs/graph_decompositions/fast_digraph.cpython-39-darwin.so +0 -0
- sage/graphs/graph_decompositions/graph_products.cpython-39-darwin.so +0 -0
- sage/graphs/graph_decompositions/modular_decomposition.cpython-39-darwin.so +0 -0
- sage/graphs/graph_decompositions/slice_decomposition.cpython-39-darwin.so +0 -0
- sage/graphs/graph_decompositions/tree_decomposition.cpython-39-darwin.so +0 -0
- sage/graphs/graph_decompositions/vertex_separation.cpython-39-darwin.so +0 -0
- sage/graphs/graph_generators.py +110 -55
- sage/graphs/graph_generators_pyx.cpython-39-darwin.so +0 -0
- sage/graphs/graph_latex.py +1 -1
- sage/graphs/graph_list.py +2 -3
- sage/graphs/graph_plot.py +225 -30
- sage/graphs/hyperbolicity.cpython-39-darwin.so +0 -0
- sage/graphs/independent_sets.cpython-39-darwin.so +0 -0
- sage/graphs/isgci.py +3 -8
- sage/graphs/isoperimetric_inequalities.cpython-39-darwin.so +0 -0
- sage/graphs/line_graph.cpython-39-darwin.so +0 -0
- sage/graphs/matching.py +14 -25
- sage/graphs/matching_covered_graph.py +871 -60
- sage/graphs/orientations.py +190 -134
- sage/graphs/path_enumeration.cpython-39-darwin.so +0 -0
- sage/graphs/path_enumeration.pyx +25 -25
- sage/graphs/spanning_tree.cpython-39-darwin.so +0 -0
- sage/graphs/strongly_regular_db.cpython-39-darwin.so +0 -0
- sage/graphs/strongly_regular_db.pyx +54 -52
- sage/graphs/traversals.cpython-39-darwin.so +0 -0
- sage/graphs/traversals.pyx +114 -46
- sage/graphs/trees.cpython-39-darwin.so +0 -0
- sage/graphs/views.cpython-39-darwin.so +0 -0
- sage/graphs/weakly_chordal.cpython-39-darwin.so +0 -0
- sage/groups/perm_gps/partn_ref/refinement_graphs.cpython-39-darwin.so +0 -0
- sage/knots/free_knotinfo_monoid.py +2 -3
- sage/knots/knot.py +1 -1
- sage/knots/knotinfo.py +4 -4
- sage/knots/link.py +58 -57
- sage/sandpiles/sandpile.py +2 -3
- sage/topology/cell_complex.py +1 -1
- sage/topology/cubical_complex.py +7 -7
- sage/topology/delta_complex.py +4 -4
- sage/topology/simplicial_complex.py +7 -22
- passagemath_graphs-10.5.10.dist-info/RECORD +0 -251
- {passagemath_graphs-10.5.10.dist-info → passagemath_graphs-10.5.43.dist-info}/top_level.txt +0 -0
sage/knots/link.py
CHANGED
@@ -516,9 +516,9 @@ class Link(SageObject):
|
|
516
516
|
F = FreeGroup(len(arcs))
|
517
517
|
rels = []
|
518
518
|
for crossing, orientation in zip(self.pd_code(), self.orientation()):
|
519
|
-
a =
|
520
|
-
b =
|
521
|
-
c =
|
519
|
+
a = next(idx for idx, i in enumerate(arcs) if crossing[0] in i)
|
520
|
+
b = next(idx for idx, i in enumerate(arcs) if crossing[3] in i)
|
521
|
+
c = next(idx for idx, i in enumerate(arcs) if crossing[2] in i)
|
522
522
|
ela = F.gen(a)
|
523
523
|
elb = F.gen(b)
|
524
524
|
if orientation < 0:
|
@@ -527,7 +527,7 @@ class Link(SageObject):
|
|
527
527
|
rels.append(ela * elb / elc / elb)
|
528
528
|
return F.quotient(rels)
|
529
529
|
|
530
|
-
def _repr_(self):
|
530
|
+
def _repr_(self) -> str:
|
531
531
|
r"""
|
532
532
|
Return a string representation.
|
533
533
|
|
@@ -706,9 +706,8 @@ class Link(SageObject):
|
|
706
706
|
"""
|
707
707
|
i = cross.index(edge)
|
708
708
|
if cross.count(edge) > 1:
|
709
|
-
return cross.index(edge, i+1)
|
710
|
-
|
711
|
-
return i
|
709
|
+
return cross.index(edge, i + 1)
|
710
|
+
return i
|
712
711
|
|
713
712
|
seifert_circles = self.seifert_circles()
|
714
713
|
newedge = max(flatten(pd_code)) + 1
|
@@ -741,8 +740,8 @@ class Link(SageObject):
|
|
741
740
|
C1[idx(C1, a)] = newedge + 1
|
742
741
|
C2 = newPD[newPD.index(tails[b])]
|
743
742
|
C2[idx(C2, b)] = newedge + 2
|
744
|
-
newPD.append([newedge + 3, newedge, b, a])
|
745
|
-
newPD.append([newedge + 2, newedge, newedge + 3, newedge + 1])
|
743
|
+
newPD.append([newedge + 3, newedge, b, a]) # D
|
744
|
+
newPD.append([newedge + 2, newedge, newedge + 3, newedge + 1]) # E
|
746
745
|
self._braid = Link(newPD).braid(remove_loops=remove_loops)
|
747
746
|
return self._braid
|
748
747
|
else:
|
@@ -762,21 +761,21 @@ class Link(SageObject):
|
|
762
761
|
C1[idx(C1, -a)] = newedge + 1
|
763
762
|
C2 = newPD[newPD.index(tails[-b])]
|
764
763
|
C2[idx(C2, -b)] = newedge + 2
|
765
|
-
newPD.append([newedge + 2, newedge + 1, newedge + 3, newedge])
|
766
|
-
newPD.append([newedge + 3, -a, -b, newedge])
|
764
|
+
newPD.append([newedge + 2, newedge + 1, newedge + 3, newedge]) # D
|
765
|
+
newPD.append([newedge + 3, -a, -b, newedge]) # E
|
767
766
|
self._braid = Link(newPD).braid(remove_loops=remove_loops)
|
768
767
|
return self._braid
|
769
768
|
|
770
769
|
# We are in the case where no Vogel moves are necessary.
|
771
770
|
G = DiGraph()
|
772
771
|
G.add_vertices([tuple(c) for c in seifert_circles])
|
773
|
-
for i,c in enumerate(pd_code):
|
772
|
+
for i, c in enumerate(pd_code):
|
774
773
|
if self.orientation()[i] == 1:
|
775
|
-
a =
|
776
|
-
b =
|
774
|
+
a = next(x for x in seifert_circles if c[3] in x)
|
775
|
+
b = next(x for x in seifert_circles if c[0] in x)
|
777
776
|
else:
|
778
|
-
a =
|
779
|
-
b =
|
777
|
+
a = next(x for x in seifert_circles if c[0] in x)
|
778
|
+
b = next(x for x in seifert_circles if c[1] in x)
|
780
779
|
G.add_edge(tuple(a), tuple(b))
|
781
780
|
|
782
781
|
# Get a simple path from a source to a sink in the digraph
|
@@ -786,7 +785,7 @@ class Link(SageObject):
|
|
786
785
|
B = BraidGroup(len(ordered_cycles))
|
787
786
|
available_crossings = copy(pd_code)
|
788
787
|
oc_set = set(ordered_cycles[0])
|
789
|
-
for i,x in enumerate(pd_code):
|
788
|
+
for i, x in enumerate(pd_code):
|
790
789
|
if any(elt in oc_set for elt in x):
|
791
790
|
crossing = x
|
792
791
|
crossing_index = i
|
@@ -904,7 +903,7 @@ class Link(SageObject):
|
|
904
903
|
heads[a] = next_crossing[0]
|
905
904
|
tails[a] = D
|
906
905
|
D = next_crossing[0]
|
907
|
-
a = D[(D.index(a)+2) % 4]
|
906
|
+
a = D[(D.index(a) + 2) % 4]
|
908
907
|
|
909
908
|
unassigned = set(flatten(pd_code)).difference(set(tails))
|
910
909
|
while unassigned:
|
@@ -921,7 +920,7 @@ class Link(SageObject):
|
|
921
920
|
break
|
922
921
|
heads[a] = next_crossing
|
923
922
|
D = next_crossing
|
924
|
-
a = D[(D.index(a)+2) % 4]
|
923
|
+
a = D[(D.index(a) + 2) % 4]
|
925
924
|
if a in unassigned:
|
926
925
|
unassigned.remove(a)
|
927
926
|
return tails, heads
|
@@ -1111,7 +1110,7 @@ class Link(SageObject):
|
|
1111
1110
|
nmax = max(flatten(crossings)) + 1
|
1112
1111
|
for i in range(2 ** ncross):
|
1113
1112
|
v = Integer(i).bits()
|
1114
|
-
v = v + (ncross - len(v))*[0]
|
1113
|
+
v = v + (ncross - len(v)) * [0]
|
1115
1114
|
G = Graph()
|
1116
1115
|
for j, cr in enumerate(crossings):
|
1117
1116
|
n = nmax + j
|
@@ -1135,7 +1134,7 @@ class Link(SageObject):
|
|
1135
1134
|
smoothings.append((tuple(v), sm, iindex, jmin, jmax))
|
1136
1135
|
states = [] # we got all the smoothings, now find all the states
|
1137
1136
|
for sm in smoothings:
|
1138
|
-
for k in range(len(sm[1])+1):
|
1137
|
+
for k in range(len(sm[1]) + 1):
|
1139
1138
|
for circpos in combinations(sorted(sm[1]), k): # Add each state
|
1140
1139
|
circneg = sm[1].difference(circpos)
|
1141
1140
|
j = writhe + sm[2] + len(circpos) - len(circneg)
|
@@ -1182,28 +1181,29 @@ class Link(SageObject):
|
|
1182
1181
|
for st in states:
|
1183
1182
|
i, j = st[3], st[4]
|
1184
1183
|
if j == height:
|
1185
|
-
if (i,j) in bases:
|
1186
|
-
bases[i,j].append(st)
|
1184
|
+
if (i, j) in bases:
|
1185
|
+
bases[i, j].append(st)
|
1187
1186
|
else:
|
1188
|
-
bases[i,j] = [st]
|
1187
|
+
bases[i, j] = [st]
|
1189
1188
|
complexes = {}
|
1190
|
-
for (i, j) in bases:
|
1191
|
-
if (i+1, j) in bases:
|
1192
|
-
m = matrix(ring, len(
|
1189
|
+
for (i, j), bij in bases.items():
|
1190
|
+
if (i + 1, j) in bases:
|
1191
|
+
m = matrix(ring, len(bij), len(bases[(i + 1, j)]))
|
1193
1192
|
for ii in range(m.nrows()):
|
1194
|
-
V1 =
|
1193
|
+
V1 = bij[ii]
|
1195
1194
|
for jj in range(m.ncols()):
|
1196
|
-
V2 = bases[(i+1, j)][jj]
|
1195
|
+
V2 = bases[(i + 1, j)][jj]
|
1197
1196
|
V20 = V2[0]
|
1198
|
-
difs = [index for index,value in enumerate(V1[0])
|
1197
|
+
difs = [index for index, value in enumerate(V1[0])
|
1198
|
+
if value != V20[index]]
|
1199
1199
|
if len(difs) == 1 and not (V2[2].intersection(V1[1]) or V2[1].intersection(V1[2])):
|
1200
|
-
m[ii,jj] = (-1)**sum(V2[0][x] for x in range(difs[0]+1, ncross))
|
1200
|
+
m[ii, jj] = (-1)**sum(V2[0][x] for x in range(difs[0] + 1, ncross))
|
1201
1201
|
# Here we have the matrix constructed, now we have to put it in the dictionary of complexes
|
1202
1202
|
else:
|
1203
|
-
m = matrix(ring, len(
|
1203
|
+
m = matrix(ring, len(bij), 0)
|
1204
1204
|
complexes[i] = m.transpose()
|
1205
|
-
if (i-1, j) not in bases:
|
1206
|
-
complexes[i-1] = matrix(ring, len(bases[(i,j)]), 0)
|
1205
|
+
if (i - 1, j) not in bases:
|
1206
|
+
complexes[i - 1] = matrix(ring, len(bases[(i, j)]), 0)
|
1207
1207
|
homologies = ChainComplex(complexes).homology()
|
1208
1208
|
return tuple(sorted(homologies.items()))
|
1209
1209
|
|
@@ -1457,7 +1457,7 @@ class Link(SageObject):
|
|
1457
1457
|
for i, j in zip(last_component, first_component):
|
1458
1458
|
d_dic[i][1] = d_dic[j][0]
|
1459
1459
|
crossing_dic = {}
|
1460
|
-
for i,x in enumerate(oriented_gauss_code[1]):
|
1460
|
+
for i, x in enumerate(oriented_gauss_code[1]):
|
1461
1461
|
if x == -1:
|
1462
1462
|
crossing_dic[i + 1] = [d_dic[-(i + 1)][0], d_dic[i + 1][0],
|
1463
1463
|
d_dic[-(i + 1)][1], d_dic[i + 1][1]]
|
@@ -1611,7 +1611,7 @@ class Link(SageObject):
|
|
1611
1611
|
|
1612
1612
|
missing = sorted(missing1)
|
1613
1613
|
x = [[] for i in range(len(missing) + 1)]
|
1614
|
-
for i,a in enumerate(missing):
|
1614
|
+
for i, a in enumerate(missing):
|
1615
1615
|
for j, mlj in enumerate(ml):
|
1616
1616
|
if mlj != 0 and abs(mlj) < a:
|
1617
1617
|
x[i].append(mlj)
|
@@ -2108,7 +2108,7 @@ class Link(SageObject):
|
|
2108
2108
|
gens = [g for g in H.gens() if g.order() == infinity or ch.divides(g.order())]
|
2109
2109
|
l = len(gens)
|
2110
2110
|
if l:
|
2111
|
-
coeff[(h,d)] = l
|
2111
|
+
coeff[(h, d)] = l
|
2112
2112
|
return L(coeff)
|
2113
2113
|
|
2114
2114
|
def determinant(self):
|
@@ -2828,7 +2828,7 @@ class Link(SageObject):
|
|
2828
2828
|
if variab is None:
|
2829
2829
|
variab = 't'
|
2830
2830
|
# We force the result to be in the symbolic ring because of the expand
|
2831
|
-
return jones(SR(variab)**(ZZ(
|
2831
|
+
return jones(SR(variab)**(ZZ.one() / ZZ(4))).expand()
|
2832
2832
|
elif algorithm == 'jonesrep':
|
2833
2833
|
braid = self.braid()
|
2834
2834
|
# Special case for the trivial knot with no crossings
|
@@ -3086,14 +3086,14 @@ class Link(SageObject):
|
|
3086
3086
|
L = LaurentPolynomialRing(ZZ, [var1, var2])
|
3087
3087
|
if len(self._isolated_components()) > 1:
|
3088
3088
|
if normalization == 'lm':
|
3089
|
-
fact = L({(1, -1)
|
3089
|
+
fact = L({(1, -1): -1, (-1, -1): -1})
|
3090
3090
|
elif normalization == 'az':
|
3091
|
-
fact = L({(1, -1):1, (-1, -1)
|
3091
|
+
fact = L({(1, -1): 1, (-1, -1): -1})
|
3092
3092
|
elif normalization == 'vz':
|
3093
|
-
fact = L({(1, -1)
|
3093
|
+
fact = L({(1, -1): -1, (-1, -1): 1})
|
3094
3094
|
else:
|
3095
3095
|
raise ValueError('normalization must be either `lm`, `az` or `vz`')
|
3096
|
-
fact = fact ** (len(self._isolated_components())-1)
|
3096
|
+
fact = fact ** (len(self._isolated_components()) - 1)
|
3097
3097
|
for i in self._isolated_components():
|
3098
3098
|
fact = fact * Link(i).homfly_polynomial(var1, var2, normalization)
|
3099
3099
|
return fact
|
@@ -3104,7 +3104,7 @@ class Link(SageObject):
|
|
3104
3104
|
for comp in ogc[0]:
|
3105
3105
|
s += ' {}'.format(len(comp))
|
3106
3106
|
for cr in comp:
|
3107
|
-
s += ' {} {}'.format(abs(cr)-1, sign(cr))
|
3107
|
+
s += ' {} {}'.format(abs(cr) - 1, sign(cr))
|
3108
3108
|
for i, cr in enumerate(ogc[1]):
|
3109
3109
|
s += ' {} {}'.format(i, cr)
|
3110
3110
|
from sage.libs.homfly import homfly_polynomial_dict
|
@@ -3126,7 +3126,7 @@ class Link(SageObject):
|
|
3126
3126
|
h_az = self.homfly_polynomial(var1=var1, var2=var2, normalization='az')
|
3127
3127
|
a, z = h_az.parent().gens()
|
3128
3128
|
v = ~a
|
3129
|
-
return h_az.subs({a:v})
|
3129
|
+
return h_az.subs({a: v})
|
3130
3130
|
else:
|
3131
3131
|
raise ValueError('normalization must be either `lm`, `az` or `vz`')
|
3132
3132
|
|
@@ -3315,8 +3315,8 @@ class Link(SageObject):
|
|
3315
3315
|
M = self._coloring_matrix(n=n)
|
3316
3316
|
KM = M.right_kernel_matrix()
|
3317
3317
|
F = FreeModule(M.base_ring(), KM.dimensions()[0])
|
3318
|
-
K = [v*KM for v in F]
|
3319
|
-
res = set(
|
3318
|
+
K = [v * KM for v in F]
|
3319
|
+
res = set()
|
3320
3320
|
arcs = self.arcs('pd')
|
3321
3321
|
for coloring in K:
|
3322
3322
|
colors = sorted(set(coloring))
|
@@ -3410,7 +3410,7 @@ class Link(SageObject):
|
|
3410
3410
|
maps = []
|
3411
3411
|
for c in cols:
|
3412
3412
|
t = list(c.values())
|
3413
|
-
ims = [b*a**i for i in t]
|
3413
|
+
ims = [b * a**i for i in t]
|
3414
3414
|
maps.append(gr.hom(ims))
|
3415
3415
|
return maps
|
3416
3416
|
|
@@ -3629,7 +3629,7 @@ class Link(SageObject):
|
|
3629
3629
|
|
3630
3630
|
# Special case for the unknot
|
3631
3631
|
if not pd_code:
|
3632
|
-
return circle((0,0), ZZ(
|
3632
|
+
return circle((0, 0), ZZ.one() / ZZ(2), color=color, **kwargs)
|
3633
3633
|
|
3634
3634
|
# The idea is the same followed in spherogram, but using MLP instead of
|
3635
3635
|
# network flows.
|
@@ -3655,9 +3655,9 @@ class Link(SageObject):
|
|
3655
3655
|
Return the flow variable from the source.
|
3656
3656
|
"""
|
3657
3657
|
if e > 0:
|
3658
|
-
return v[2*edges.index(e)]
|
3658
|
+
return v[2 * edges.index(e)]
|
3659
3659
|
else:
|
3660
|
-
return v[2*edges.index(-e)+1]
|
3660
|
+
return v[2 * edges.index(-e) + 1]
|
3661
3661
|
|
3662
3662
|
def flow_to_sink(e):
|
3663
3663
|
r"""
|
@@ -3682,9 +3682,10 @@ class Link(SageObject):
|
|
3682
3682
|
MLP.solve()
|
3683
3683
|
# we store the result in a vector s packing right bends as negative left ones
|
3684
3684
|
values = MLP.get_values(v, convert=ZZ, tolerance=1e-3)
|
3685
|
-
s = [values[2*i] - values[2*i + 1] for i in range(len(edges))]
|
3685
|
+
s = [values[2 * i] - values[2 * i + 1] for i in range(len(edges))]
|
3686
3686
|
# segments represents the different parts of the previous edges after bending
|
3687
|
-
segments = {e: [(e,i) for i in range(abs(s[edges.index(e)])+1)]
|
3687
|
+
segments = {e: [(e, i) for i in range(abs(s[edges.index(e)]) + 1)]
|
3688
|
+
for e in edges}
|
3688
3689
|
pieces = {tuple(i): [i] for j in segments.values() for i in j}
|
3689
3690
|
nregions = []
|
3690
3691
|
for r in regions[:-1]: # interior regions
|
@@ -3713,7 +3714,7 @@ class Link(SageObject):
|
|
3713
3714
|
c = -1
|
3714
3715
|
b = a
|
3715
3716
|
while c != 2:
|
3716
|
-
if b == len(badregion)-1:
|
3717
|
+
if b == len(badregion) - 1:
|
3717
3718
|
b = 0
|
3718
3719
|
else:
|
3719
3720
|
b += 1
|
@@ -3741,15 +3742,15 @@ class Link(SageObject):
|
|
3741
3742
|
|
3742
3743
|
if a < b:
|
3743
3744
|
r1 = badregion[:a] + [[badregion[a][0], 0], [N1, 1]] + badregion[b:]
|
3744
|
-
r2 = badregion[a + 1:b] + [[N2, 1],[N1, 1]]
|
3745
|
+
r2 = badregion[a + 1:b] + [[N2, 1], [N1, 1]]
|
3745
3746
|
else:
|
3746
3747
|
r1 = badregion[b:a] + [[badregion[a][0], 0], [N1, 1]]
|
3747
|
-
r2 = badregion[:b] + [[N2, 1],[N1, 1]] + badregion[a + 1:]
|
3748
|
+
r2 = badregion[:b] + [[N2, 1], [N1, 1]] + badregion[a + 1:]
|
3748
3749
|
|
3749
3750
|
if otherregion:
|
3750
3751
|
c = [x for x in otherregion if badregion[b][0] == x[0]]
|
3751
3752
|
c = otherregion.index(c[0])
|
3752
|
-
otherregion.insert(c + 1, [N2,otherregion[c][1]])
|
3753
|
+
otherregion.insert(c + 1, [N2, otherregion[c][1]])
|
3753
3754
|
otherregion[c][1] = 0
|
3754
3755
|
nregions.remove(badregion)
|
3755
3756
|
nregions.append(r1)
|
@@ -3807,7 +3808,7 @@ class Link(SageObject):
|
|
3807
3808
|
turn = -1
|
3808
3809
|
else:
|
3809
3810
|
turn = 1
|
3810
|
-
lengthse = [lengths[(e,k)] for k in range(abs(s[edges.index(e)])+1)]
|
3811
|
+
lengthse = [lengths[(e, k)] for k in range(abs(s[edges.index(e)]) + 1)]
|
3811
3812
|
if c.index(e) == 0 or (c.index(e) == 3 and orien == 1) or (c.index(e) == 1 and orien == -1):
|
3812
3813
|
turn = -turn
|
3813
3814
|
lengthse.reverse()
|
sage/sandpiles/sandpile.py
CHANGED
@@ -339,7 +339,6 @@ from sage.graphs.digraph import DiGraph
|
|
339
339
|
from sage.graphs.graph import Graph
|
340
340
|
from sage.misc.functional import det, denominator
|
341
341
|
from sage.misc.lazy_import import lazy_import
|
342
|
-
from sage.misc.misc import exists
|
343
342
|
from sage.misc.misc_c import prod
|
344
343
|
from sage.misc.temporary_file import tmp_filename
|
345
344
|
from sage.rings.integer import Integer
|
@@ -1542,7 +1541,7 @@ class Sandpile(DiGraph):
|
|
1542
1541
|
else:
|
1543
1542
|
rec = list(self.recurrents())
|
1544
1543
|
for r in self.recurrents():
|
1545
|
-
if
|
1544
|
+
if any(r > x for x in rec):
|
1546
1545
|
rec.remove(r)
|
1547
1546
|
self._min_recurrents = rec
|
1548
1547
|
|
@@ -5330,7 +5329,7 @@ class SandpileDivisor(dict):
|
|
5330
5329
|
|
5331
5330
|
sage: S = sandpiles.Cycle(6)
|
5332
5331
|
sage: D = SandpileDivisor(S, [0,0,0,0,0,4]) # optional - 4ti2
|
5333
|
-
sage: D._set_r_of_D() # optional - 4ti2
|
5332
|
+
sage: D._set_r_of_D() # optional - 4ti2, needs sage.geometry.polyhedron
|
5334
5333
|
"""
|
5335
5334
|
eff = self.effective_div()
|
5336
5335
|
n = self._sandpile.num_verts()
|
sage/topology/cell_complex.py
CHANGED
@@ -545,7 +545,7 @@ class GenericCellComplex(SageObject):
|
|
545
545
|
[0,0] x [0,1] x [0,1] - [0,1] x [0,0] x [0,1] + [0,1] x [0,1] x [0,0]
|
546
546
|
- [0,1] x [0,1] x [1,1] + [0,1] x [1,1] x [0,1] - [1,1] x [0,1] x [0,1])]
|
547
547
|
|
548
|
-
Similarly for
|
548
|
+
Similarly for simplicial sets::
|
549
549
|
|
550
550
|
sage: S = simplicial_sets.Sphere(2)
|
551
551
|
sage: S.homology(generators=True) # needs sage.modules
|
sage/topology/cubical_complex.py
CHANGED
@@ -1473,13 +1473,13 @@ class CubicalComplex(GenericCellComplex):
|
|
1473
1473
|
...
|
1474
1474
|
NotImplementedError: suspensions are not implemented for cubical complexes
|
1475
1475
|
"""
|
1476
|
-
#
|
1477
|
-
#
|
1478
|
-
#
|
1479
|
-
#
|
1480
|
-
#
|
1481
|
-
#
|
1482
|
-
#
|
1476
|
+
# if n < 0:
|
1477
|
+
# raise ValueError("n must be nonnegative")
|
1478
|
+
# if n == 0:
|
1479
|
+
# return self
|
1480
|
+
# if n == 1:
|
1481
|
+
# return self.join(cubical_complexes.Sphere(0))
|
1482
|
+
# return self.suspension().suspension(int(n-1))
|
1483
1483
|
raise NotImplementedError("suspensions are not implemented for cubical complexes")
|
1484
1484
|
|
1485
1485
|
def product(self, other):
|
sage/topology/delta_complex.py
CHANGED
@@ -305,7 +305,7 @@ class DeltaComplex(GenericCellComplex):
|
|
305
305
|
# else a dictionary indexed by simplices
|
306
306
|
dimension = max([f.dimension() for f in data])
|
307
307
|
old_data_by_dim = {}
|
308
|
-
for dim in range(
|
308
|
+
for dim in range(dimension + 1):
|
309
309
|
old_data_by_dim[dim] = []
|
310
310
|
new_data[dim] = []
|
311
311
|
for x in data:
|
@@ -467,7 +467,7 @@ class DeltaComplex(GenericCellComplex):
|
|
467
467
|
new_dict[d+1].append(tuple([translate[n] for n in f]))
|
468
468
|
new_dict[d].append(cells[d][x])
|
469
469
|
cells_to_add.update(cells[d][x])
|
470
|
-
new_cells = [new_dict[n] for n in range(
|
470
|
+
new_cells = [new_dict[n] for n in range(max_dim + 1)]
|
471
471
|
sub = DeltaComplex(new_cells)
|
472
472
|
sub._is_subcomplex_of = {self: new_data}
|
473
473
|
return sub
|
@@ -565,7 +565,7 @@ class DeltaComplex(GenericCellComplex):
|
|
565
565
|
raise ValueError("this is not a subcomplex of self")
|
566
566
|
else:
|
567
567
|
subcomplex_cells = subcomplex._is_subcomplex_of[self]
|
568
|
-
for d in range(
|
568
|
+
for d in range(max(subcomplex_cells.keys()) + 1):
|
569
569
|
L = list(cells[d])
|
570
570
|
for c in subcomplex_cells[d]:
|
571
571
|
L[c] = None
|
@@ -1304,7 +1304,7 @@ class DeltaComplex(GenericCellComplex):
|
|
1304
1304
|
# added_cells: dict indexed by (n-1)-cells, with value the
|
1305
1305
|
# corresponding new n-cell.
|
1306
1306
|
added_cells = {(): len(cells_dict[0])-1}
|
1307
|
-
for n in range(
|
1307
|
+
for n in range(dim):
|
1308
1308
|
new_cells = {}
|
1309
1309
|
# for each n-cell in the standard simplex, add an
|
1310
1310
|
# (n+1)-cell to the subdivided complex.
|
@@ -803,7 +803,7 @@ class Simplex(SageObject):
|
|
803
803
|
"""
|
804
804
|
return hash(self.__set)
|
805
805
|
|
806
|
-
def _repr_(self):
|
806
|
+
def _repr_(self) -> str:
|
807
807
|
"""
|
808
808
|
Print representation.
|
809
809
|
|
@@ -1478,7 +1478,7 @@ class SimplicialComplex(Parent, GenericCellComplex):
|
|
1478
1478
|
d = self.dimension()
|
1479
1479
|
f = self.f_vector() # indexed starting at 0, since it's a Python list
|
1480
1480
|
h = []
|
1481
|
-
for j in range(
|
1481
|
+
for j in range(d + 2):
|
1482
1482
|
s = 0
|
1483
1483
|
for i in range(-1, j):
|
1484
1484
|
s += (-1)**(j-i-1) * binomial(d-i, j-i-1) * f[i+1]
|
@@ -2004,7 +2004,7 @@ class SimplicialComplex(Parent, GenericCellComplex):
|
|
2004
2004
|
rename_vertices=True)
|
2005
2005
|
return self.suspension(1, is_mutable).suspension(int(n-1), is_mutable)
|
2006
2006
|
|
2007
|
-
def disjoint_union(self, right,
|
2007
|
+
def disjoint_union(self, right, is_mutable=True):
|
2008
2008
|
"""
|
2009
2009
|
The disjoint union of this simplicial complex with another one.
|
2010
2010
|
|
@@ -2012,14 +2012,6 @@ class SimplicialComplex(Parent, GenericCellComplex):
|
|
2012
2012
|
|
2013
2013
|
- ``right`` -- the other simplicial complex (the right-hand factor)
|
2014
2014
|
|
2015
|
-
- ``rename_vertices`` -- boolean (default: ``True``); if this is
|
2016
|
-
``True``, the vertices in the disjoint union will be renamed by the
|
2017
|
-
formula: vertex "v" in the left-hand factor --> vertex "Lv" in the
|
2018
|
-
disjoint union, vertex "w" in the right-hand factor --> vertex "Rw"
|
2019
|
-
in the disjoint union. If this is false, this tries to construct the
|
2020
|
-
disjoint union without renaming the vertices; this will cause
|
2021
|
-
problems if the two factors have any vertices with names in common.
|
2022
|
-
|
2023
2015
|
EXAMPLES::
|
2024
2016
|
|
2025
2017
|
sage: S1 = simplicial_complexes.Sphere(1)
|
@@ -2027,15 +2019,8 @@ class SimplicialComplex(Parent, GenericCellComplex):
|
|
2027
2019
|
sage: S1.disjoint_union(S2).homology() # needs sage.modules
|
2028
2020
|
{0: Z, 1: Z, 2: Z}
|
2029
2021
|
"""
|
2030
|
-
|
2031
|
-
|
2032
|
-
deprecation(35907, 'the "rename_vertices" argument is deprecated')
|
2033
|
-
|
2034
|
-
facets = []
|
2035
|
-
for f in self._facets:
|
2036
|
-
facets.append(tuple(["L" + str(v) for v in f]))
|
2037
|
-
for f in right._facets:
|
2038
|
-
facets.append(tuple(["R" + str(v) for v in f]))
|
2022
|
+
facets = [tuple(f"L{v}" for v in f) for f in self._facets]
|
2023
|
+
facets.extend(tuple(f"R{v}" for v in f) for f in right._facets)
|
2039
2024
|
return SimplicialComplex(facets, is_mutable=is_mutable)
|
2040
2025
|
|
2041
2026
|
def wedge(self, right, rename_vertices=True, is_mutable=True):
|
@@ -3466,7 +3451,7 @@ class SimplicialComplex(Parent, GenericCellComplex):
|
|
3466
3451
|
TESTS::
|
3467
3452
|
|
3468
3453
|
sage: SC = SimplicialComplex([(0,1,2),(0,2,3),(2,3,4),(1,2,4), \
|
3469
|
-
|
3454
|
+
....: (1,4,5),(0,3,6),(3,6,7),(4,5,7)])
|
3470
3455
|
|
3471
3456
|
This was taking a long time before :issue:`20078`::
|
3472
3457
|
|
@@ -4517,7 +4502,7 @@ class SimplicialComplex(Parent, GenericCellComplex):
|
|
4517
4502
|
|
4518
4503
|
# this function overrides the standard one for GenericCellComplex,
|
4519
4504
|
# because it lists the maximal faces, not the total number of faces.
|
4520
|
-
def _repr_(self):
|
4505
|
+
def _repr_(self) -> str:
|
4521
4506
|
"""
|
4522
4507
|
Print representation.
|
4523
4508
|
|