Skip to content

Commit 799aa8d

Browse files
committed
PR #35891: fix more issues
1 parent 5f56f5e commit 799aa8d

File tree

9 files changed

+20
-19
lines changed

9 files changed

+20
-19
lines changed

src/sage/algebras/fusion_rings/f_matrix.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1726,11 +1726,11 @@ def _partition_eqns(self, eqns=None, verbose=True):
17261726
if eqns is None:
17271727
eqns = self.ideal_basis
17281728
graph = self.equations_graph(eqns)
1729-
partition = {tuple(c): [] for c in graph.connected_components()}
1729+
partition = {tuple(c): [] for c in graph.connected_components(sort=True)}
17301730
for eq_tup in eqns:
1731-
partition[tuple(graph.connected_component_containing_vertex(variables(eq_tup)[0]))].append(eq_tup)
1731+
partition[tuple(graph.connected_component_containing_vertex(variables(eq_tup)[0], sort=True))].append(eq_tup)
17321732
if verbose:
1733-
print("Partitioned {} equations into {} components of size:".format(len(eqns), len(graph.connected_components())))
1733+
print("Partitioned {} equations into {} components of size:".format(len(eqns), graph.connected_components_number()))
17341734
print(graph.connected_components_sizes())
17351735
return partition
17361736

src/sage/geometry/polyhedron/base_QQ.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1180,7 +1180,7 @@ class functions of the acting group. A character `\rho` is effective if
11801180
True
11811181
sage: Hstar = p3.Hstar_function(S3) # optional - pynormaliz
11821182
sage: Hlin = p3.Hstar_function(S3, # optional - pynormaliz
1183-
....: output='Hstar_as_lin_comb')]
1183+
....: output='Hstar_as_lin_comb')
11841184
sage: p3.is_effective(Hstar, Hlin) # optional - pynormaliz
11851185
True
11861186
@@ -1242,7 +1242,7 @@ class functions of the acting group. A character `\rho` is effective if
12421242
sage: p2 = Polyhedron(vertices=[[0], [1/2]], # optional - pynormaliz
12431243
....: backend='normaliz')
12441244
sage: Hstar = p2.Hstar_function() # optional - pynormaliz
1245-
sage: Hstarlin = p2.Hstar_function(output='Hstar_as_lin_comb')] # optional - pynormaliz
1245+
sage: Hstarlin = p2.Hstar_function(output='Hstar_as_lin_comb') # optional - pynormaliz
12461246
sage: p1._is_effective_normaliz(Hstar, Hstarlin) # optional - pynormaliz
12471247
Traceback (most recent call last):
12481248
...

src/sage/matroids/linear_matroid.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,7 @@ cdef class LinearMatroid(BasisExchangeMatroid):
578578
sage: M.representation(lift_map=lift_map('sru')) # optional - sage.rings.finite_rings
579579
[ 1 0 0 1 0 1 1 1]
580580
[ 0 1 0 -z + 1 1 0 0 1]
581-
[ 0 0 1 0 -z z 1 0]
581+
[ 0 0 1 0 1 -1 z - 1 0]
582582
"""
583583
cdef LeanMatrix A
584584
if order is None:

src/sage/matroids/matroid.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6104,8 +6104,8 @@ cdef class Matroid(SageObject):
61046104
entries = [(e, f, (e, f)) for e in basis for f in self._fundamental_cocircuit(basis, e).difference([e])]
61056105
G = Graph(entries)
61066106
T = set()
6107-
for C in G.connected_components():
6108-
T.update(G.subgraph(C).min_spanning_tree())
6107+
for C in G.connected_components_subgraphs():
6108+
T.update(C.min_spanning_tree())
61096109
for edge in T:
61106110
e,f = edge[2]
61116111
A.set(bdx[e],idx[f], 1)

src/sage/matroids/utilities.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -391,8 +391,8 @@ def spanning_forest(M):
391391
G.add_edge(x + m, y)
392392
T = []
393393
# find spanning tree in each component
394-
for component in G.connected_components():
395-
spanning_tree = kruskal(G.subgraph(component))
394+
for component in G.connected_components_subgraphs():
395+
spanning_tree = kruskal(component)
396396
for (x, y, z) in spanning_tree:
397397
if x < m:
398398
t = x
@@ -543,9 +543,9 @@ def lift_cross_ratios(A, lift_map=None):
543543
[0 6 3 6 0]
544544
sage: Z = lift_cross_ratios(A, to_sixth_root_of_unity) # optional - sage.graphs sage.rings.finite_rings sage.rings.number_field
545545
sage: Z # optional - sage.graphs sage.rings.finite_rings sage.rings.number_field
546-
[ 1 0 1 1 1]
547-
[ 1 1 0 0 z]
548-
[ 0 -1 z 1 0]
546+
[ 1 0 1 1 1]
547+
[-z + 1 1 0 0 1]
548+
[ 0 -1 1 -z + 1 0]
549549
sage: M = LinearMatroid(reduced_matrix=A) # optional - sage.graphs sage.rings.finite_rings
550550
sage: sorted(M.cross_ratios()) # optional - sage.graphs sage.rings.finite_rings
551551
[3, 5]
@@ -568,8 +568,8 @@ def lift_cross_ratios(A, lift_map=None):
568568
G = Graph([((r, 0), (c, 1), (r, c)) for r, c in A.nonzero_positions()])
569569
# write the entries of (a scaled version of) A as products of cross ratios of A
570570
T = set()
571-
for C in G.connected_components():
572-
T.update(G.subgraph(C).min_spanning_tree())
571+
for C in G.connected_components_subgraphs():
572+
T.update(C.min_spanning_tree())
573573
# - fix a tree of the support graph G to units (= empty dict, product of 0 terms)
574574
F = {entry[2]: dict() for entry in T}
575575
W = set(G.edge_iterator()) - set(T)

src/sage/schemes/curves/zariski_vankampen.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -815,8 +815,9 @@ def geometric_basis(G, E, p):
815815
q = EC[-i]
816816
connecting_path = list(reversed(EC[-i:]))
817817
break
818+
I_cc_q = set(I.connected_component_containing_vertex(q, sort=False))
818819
distancequotients = [(E.distance(q, v)**2 / I.distance(q, v), v) for v in E
819-
if v in I.connected_component_containing_vertex(q) and not v == q]
820+
if v in I_cc_q and not v == q]
820821
r = max(distancequotients)[1]
821822
cutpath = I.shortest_path(q, r)
822823
Gcut = copy(G)

src/sage/tests/books/computational-mathematics-with-sagemath/lp_doctest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@
221221
Sage example in ./lp.tex, line 906::
222222
223223
sage: while not h.is_connected():
224-
....: S = h.connected_components()[0]
224+
....: S = h.connected_components(sort=False)[0]
225225
....: p.add_constraint(
226226
....: p.sum( B(u,v) for u,v
227227
....: in g.edge_boundary(S, labels = False))

src/sage/topology/simplicial_complex.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4078,7 +4078,7 @@ def connected_component(self, simplex=None):
40784078
v = self.vertices()[0]
40794079
else:
40804080
v = simplex[0]
4081-
vertices = self.graph().connected_component_containing_vertex(v)
4081+
vertices = self.graph().connected_component_containing_vertex(v, sort=False)
40824082
facets = [f for f in self.facets() if f.is_face(Simplex(vertices))]
40834083
return SimplicialComplex(facets)
40844084

src/sage/topology/simplicial_set_constructions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1497,7 +1497,7 @@ def __init__(self, maps=None, vertex_name=None):
14971497
for x in domain.n_cells(n):
14981498
edges.extend([[(x,-1), (f(x),i)] for (i,f) in enumerate(maps)])
14991499
G = Graph([vertices, edges], format='vertices_and_edges')
1500-
data[n] = [set(_) for _ in G.connected_components()]
1500+
data[n] = [set(_) for _ in G.connected_components(sort=False)]
15011501
# data is now a dictionary indexed by dimension, and data[n]
15021502
# consists of sets of n-simplices of the domain and the
15031503
# codomains, each set an equivalence class of n-simplices

0 commit comments

Comments
 (0)