Skip to content

Commit e590e07

Browse files
committed
provide aliases n_vertices, n_edges, n_faces
1 parent 5ae07a9 commit e590e07

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/sage/graphs/generic_graph.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4803,8 +4803,8 @@ def order(self):
48034803
"""
48044804
Return the number of vertices.
48054805

4806-
Note that ``len(G)`` and :meth:`num_verts` also return the number of
4807-
vertices in `G`.
4806+
Note that ``len(G)`` and :meth:`n_vertices` also return the
4807+
number of vertices in `G`.
48084808

48094809
EXAMPLES::
48104810

@@ -4817,29 +4817,35 @@ def order(self):
48174817
sage: G = graphs.TetrahedralGraph()
48184818
sage: len(G)
48194819
4
4820+
48204821
"""
48214822
return self._backend.num_verts()
48224823

48234824
__len__ = order
48244825

48254826
num_verts = order
48264827

4828+
n_vertices = order
4829+
48274830
def size(self):
48284831
"""
48294832
Return the number of edges.
48304833

4831-
Note that :meth:`num_edges` also returns the number of edges in `G`.
4834+
Note that :meth:`n_edges` also returns the number of edges in `G`.
48324835

48334836
EXAMPLES::
48344837

48354838
sage: G = graphs.PetersenGraph()
48364839
sage: G.size()
48374840
15
4841+
48384842
"""
48394843
return self._backend.num_edges(self._directed)
48404844

48414845
num_edges = size
48424846

4847+
n_edges = size
4848+
48434849
def eulerian_circuit(self, return_vertices=False, labels=True, path=False):
48444850
r"""
48454851
Return a list of edges forming an Eulerian circuit if one exists.
@@ -6987,7 +6993,7 @@ def faces(self, embedding=None):
69876993
faces.append(path)
69886994
return faces
69896995

6990-
def num_faces(self, embedding=None):
6996+
def n_faces(self, embedding=None):
69916997
"""
69926998
Return the number of faces of an embedded graph.
69936999

@@ -7074,6 +7080,8 @@ def num_faces(self, embedding=None):
70747080
F += g.num_faces(emb) - 1
70757081
return F
70767082

7083+
num_faces = n_faces
7084+
70777085
def planar_dual(self, embedding=None):
70787086
"""
70797087
Return the planar dual of an embedded graph.

0 commit comments

Comments
 (0)