Skip to content

Commit 6292e29

Browse files
author
Release Manager
committed
gh-40932: use n_vertices, n_edges and n_faces also in the codebase To achieve better consistency, we replace `num_verts`, `num_edges` and `num_faces` with `n_vertices`, `n_edges` and `n_faces` also in the codebase. `num_verts`, `num_edges` and `num_faces` remain aliases for backwards compatibility. dependencies: #40918 URL: #40932 Reported by: Martin Rubey Reviewer(s): David Coudert
2 parents a2050ea + edba108 commit 6292e29

38 files changed

+134
-137
lines changed

src/sage/categories/crystals.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ def is_isomorphism(self) -> bool:
171171

172172
index_set = self._cartan_type.index_set()
173173
G = self.domain().digraph(index_set=index_set)
174-
if self.codomain().cardinality() != G.num_verts():
174+
if self.codomain().cardinality() != G.n_vertices():
175175
return False
176176
H = self.codomain().digraph(index_set=index_set)
177177
return G.is_isomorphic(H, edge_labels=True)

src/sage/combinat/posets/hasse_diagram.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ def is_chain(self) -> bool:
541541
"""
542542
if self.cardinality() == 0:
543543
return True
544-
return (self.num_edges() + 1 == self.num_verts() and # tree
544+
return (self.n_edges() + 1 == self.n_vertices() and # tree
545545
all(d <= 1 for d in self.out_degree()) and
546546
all(d <= 1 for d in self.in_degree()))
547547

@@ -589,7 +589,7 @@ def dual(self):
589589
False
590590
"""
591591
H = self.reverse(immutable=False)
592-
H.relabel(perm=list(range(H.num_verts() - 1, -1, -1)), inplace=True)
592+
H.relabel(perm=list(range(H.n_vertices() - 1, -1, -1)), inplace=True)
593593
return HasseDiagram(H)
594594

595595
def _precompute_intervals(self) -> None:

src/sage/combinat/posets/linear_extension_iterator.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def _linear_extension_prepare(D):
3737
# the preprocessing routine found in Figure 7 of
3838
# "Generating Linear Extensions Fast" by
3939
# Pruesse and Ruskey
40-
while dag_copy.num_verts() != 0:
40+
while dag_copy.n_vertices() != 0:
4141
# find all the minimal elements of dag_copy
4242
minimal_elements = dag_copy.sources()
4343
if not minimal_elements:

src/sage/combinat/posets/posets.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5379,7 +5379,7 @@ def factor(self) -> list:
53795379
dg = self._hasse_diagram
53805380
if not dg.is_connected() or not dg.order():
53815381
raise NotImplementedError('the poset is empty or not connected')
5382-
if Integer(dg.num_verts()).is_prime():
5382+
if Integer(dg.n_vertices()).is_prime():
53835383
return [self]
53845384
if sum(e for _, e in self.degree_polynomial().factor()) == 1:
53855385
return [self]

src/sage/combinat/root_system/cartan_matrix.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1173,7 +1173,7 @@ def find_cartan_type_from_matrix(CM):
11731173
relabel = []
11741174
for S in CM.dynkin_diagram().connected_components_subgraphs():
11751175
S = DiGraph(S) # We need a simple digraph here
1176-
n = S.num_verts()
1176+
n = S.n_vertices()
11771177
# Build the list to test based upon rank
11781178
if n == 1:
11791179
relabel.append({1: S.vertices()[0]})

src/sage/combinat/root_system/coxeter_matrix.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1114,7 +1114,7 @@ def recognize_coxeter_type_from_matrix(coxeter_matrix, index_set):
11141114

11151115
types = []
11161116
for S in G.connected_components_subgraphs():
1117-
r = S.num_verts()
1117+
r = S.n_vertices()
11181118
# Handle the special cases first
11191119
if r == 1:
11201120
types.append(CoxeterType(['A', 1]).relabel({1: S.vertices(sort=True)[0]}))

src/sage/combinat/root_system/dynkin_diagram.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ def rank(self):
459459
sage: DynkinDiagram("A2","B2","F4").rank()
460460
8
461461
"""
462-
return self.num_verts()
462+
return self.n_vertices()
463463

464464
def dynkin_diagram(self):
465465
"""

src/sage/combinat/species/species.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -801,7 +801,7 @@ def algebraic_equation_system(self):
801801
Qz = QQ['z'].fraction_field()
802802

803803
# Generate the variable names and the corresponding polynomial rings
804-
var_names = ["node%s" % i for i in range(d.num_verts())]
804+
var_names = ["node%s" % i for i in range(d.n_vertices())]
805805
R = Qz[", ".join(var_names)]
806806
R_gens_dict = R.gens_dict()
807807

src/sage/combinat/symmetric_group_representations.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -677,9 +677,9 @@ def representation_matrix_for_simple_transposition(self, i):
677677
digraph = copy(Y._digraph)
678678
digraph.delete_edges((u, v) for (u, v, (j, beta)) in digraph.edges(sort=True)
679679
if j != i)
680-
M = matrix(self._ring, digraph.num_verts())
680+
M = matrix(self._ring, digraph.n_vertices())
681681
for g in digraph.connected_components_subgraphs():
682-
if g.num_verts() == 1:
682+
if g.n_vertices() == 1:
683683
v, = g.vertices(sort=True)
684684
w = self._word_dict[v]
685685
trivial = None
@@ -726,7 +726,7 @@ def _representation_matrix_uncached(self, permutation):
726726
[-1/2 3/2]
727727
[ 1/2 1/2]
728728
"""
729-
m = self._yang_baxter_graph._digraph.num_verts()
729+
m = self._yang_baxter_graph._digraph.n_vertices()
730730
M = matrix(self._ring, m, m, 1)
731731
for i in Permutation(permutation).reduced_word():
732732
M *= self.representation_matrix_for_simple_transposition(i)

src/sage/combinat/words/finite_word.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1674,7 +1674,7 @@ def reduced_rauzy_graph(self, n):
16741674
g = copy(self.rauzy_graph(n))
16751675
# Otherwise it changes the rauzy_graph function.
16761676
l = [v for v in g if g.in_degree(v) == 1 == g.out_degree(v)]
1677-
if g.num_verts() != 0 and len(l) == g.num_verts():
1677+
if len(l) == g.n_vertices() != 0:
16781678
# In this case, the Rauzy graph is simply a cycle.
16791679
g = DiGraph()
16801680
g.allow_loops(True)

0 commit comments

Comments
 (0)