You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
gh-40918: switch to n_vertices, n_edges and n_faces for graphs
This provides aliases `n_vertices`, `n_edges` and `n_faces`, and uses
them throughout the docstring `EXAMPLES`.
The old aliases `num_verts`,`num_edges` and `num_faces` are kept. Also,
they are kept in the code base, to avoid touching too many files.
URL: #40918
Reported by: Martin Rubey
Reviewer(s): David Coudert
Copy file name to clipboardExpand all lines: src/sage/graphs/base/static_sparse_backend.pyx
+9-5Lines changed: 9 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -980,19 +980,21 @@ cdef class StaticSparseBackend(CGraphBackend):
980
980
yield x
981
981
return
982
982
983
-
defnum_verts(self):
983
+
defn_vertices(self):
984
984
r"""
985
985
Return the number of vertices.
986
986
987
987
TESTS::
988
988
989
989
sage: from sage.graphs.base.static_sparse_backend import StaticSparseBackend
990
990
sage: g = StaticSparseBackend(graphs.PetersenGraph())
991
-
sage: g.num_verts()
991
+
sage: g.n_vertices()
992
992
10
993
993
"""
994
994
returnself._order
995
995
996
+
num_verts = n_vertices
997
+
996
998
defallows_loops(self, value=None):
997
999
r"""
998
1000
Return whether the graph allows loops.
@@ -1043,7 +1045,7 @@ cdef class StaticSparseBackend(CGraphBackend):
1043
1045
else:
1044
1046
raiseValueError("the graph is immutable and cannot be changed in any way")
1045
1047
1046
-
defnum_edges(self, directed):
1048
+
defn_edges(self, directed):
1047
1049
r"""
1048
1050
Return the number of edges.
1049
1051
@@ -1056,13 +1058,13 @@ cdef class StaticSparseBackend(CGraphBackend):
1056
1058
1057
1059
sage: from sage.graphs.base.static_sparse_backend import StaticSparseBackend
1058
1060
sage: g = StaticSparseBackend(graphs.PetersenGraph())
1059
-
sage: g.num_edges(False)
1061
+
sage: g.n_edges(False)
1060
1062
15
1061
1063
1062
1064
Testing the exception::
1063
1065
1064
1066
sage: g = StaticSparseBackend(digraphs.Circuit(4))
1065
-
sage: g.num_edges(False)
1067
+
sage: g.n_edges(False)
1066
1068
Traceback (most recent call last):
1067
1069
...
1068
1070
NotImplementedError: Sorry, I have no idea what is expected in this situation. I don't think that it is well-defined either, especially for multigraphs.
@@ -1095,6 +1097,8 @@ cdef class StaticSparseBackend(CGraphBackend):
0 commit comments