@@ -16,7 +16,7 @@ Here is what the module can do:
16
16
17
17
:meth:`is_connected` | Check whether the ( di) graph is connected.
18
18
:meth:`connected_components` | Return the list of connected components
19
- :meth:`connected_components_number ` | Return the number of connected components.
19
+ :meth:`number_of_connected_components ` | Return the number of connected components.
20
20
:meth:`connected_components_subgraphs` | Return a list of connected components as graph objects.
21
21
:meth:`connected_component_containing_vertex` | Return a list of the vertices connected to vertex.
22
22
:meth:`connected_components_sizes` | Return the sizes of the connected components as a list.
@@ -238,7 +238,7 @@ def connected_components(G, sort=False, key=None, forbidden_vertices=None):
238
238
return components
239
239
240
240
241
- def connected_components_number (G , forbidden_vertices = None ):
241
+ def number_of_connected_components (G , forbidden_vertices = None ):
242
242
"""
243
243
Return the number of connected components.
244
244
@@ -251,31 +251,33 @@ def connected_components_number(G, forbidden_vertices=None):
251
251
252
252
EXAMPLES::
253
253
254
- sage: from sage.graphs.connectivity import connected_components_number
254
+ sage: from sage.graphs.connectivity import number_of_connected_components
255
255
sage: G = Graph({0: [1, 3], 1: [2], 2: [3], 4: [5, 6], 5: [6]})
256
- sage: connected_components_number (G)
256
+ sage: number_of_connected_components (G)
257
257
2
258
- sage: G.connected_components_number ()
258
+ sage: G.number_of_connected_components ()
259
259
2
260
260
sage: D = DiGraph({0: [1, 3], 1: [2], 2: [3], 4: [5, 6], 5: [6]})
261
- sage: connected_components_number (D)
261
+ sage: number_of_connected_components (D)
262
262
2
263
- sage: connected_components_number (D, forbidden_vertices=[1, 3])
263
+ sage: number_of_connected_components (D, forbidden_vertices=[1, 3])
264
264
3
265
265
266
266
TESTS:
267
267
268
268
If ``G`` is not a Sage graph, an error is raised::
269
269
270
- sage: from sage.graphs.connectivity import connected_components_number
271
- sage: connected_components_number ('I am not a graph')
270
+ sage: from sage.graphs.connectivity import number_of_connected_components
271
+ sage: number_of_connected_components ('I am not a graph')
272
272
Traceback (most recent call last):
273
273
...
274
274
TypeError: the input must be a Sage graph
275
275
"""
276
276
return len (connected_components(G, sort = False ,
277
277
forbidden_vertices = forbidden_vertices))
278
278
279
+ connected_components_number = number_of_connected_components
280
+
279
281
280
282
def connected_components_subgraphs (G , forbidden_vertices = None ):
281
283
"""
0 commit comments