Commit fe8e0085 authored by Tiago Peixoto's avatar Tiago Peixoto

Fix behaviour of Graph.add_vertex(n) for n == 0

parent 8a44eee1
......@@ -1245,10 +1245,13 @@ class Graph(object):
return libcore.get_edges(weakref.ref(self))
def add_vertex(self, n=1):
"""Add a vertex to the graph, and return it. If ``n > 1``, ``n``
"""Add a vertex to the graph, and return it. If ``n != 1``, ``n``
vertices are inserted and an iterator over the new vertices is returned.
This operation is :math:`O(n)`.
"""
if n == 0:
return (None for i in range(0, 0))
self.__check_perms("add_vertex")
v = libcore.add_vertex(weakref.ref(self), n)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment