(self, n, attributes=None)
return result
Adds some vertices to the graph.

        Note that if C{n} is a sequence of strings, indicating the names of the
        new vertices, and attributes has a key C{name}, the two conflict. In
        that case the attribute will be applied.

        @param n: the number of vertices to be added, or the name of a single
          vertex to be added, or a sequence of strings, each corresponding to the
          name of a vertex to be added. Names will be assigned to the C{name}
          vertex attribute.
        @param attributes: dict of sequences, all of length equal to the
          number of vertices to be added, containing the attributes of the new
          vertices. If n is a string (so a single vertex is added), then the
          values of this dict are the attributes themselves, but if n=1 then
          they have to be lists of length 1.
Adds some vertices to the graph.
Adds some vertices to the graph .
def add_vertices(self, n, attributes=None):
        """Adds some vertices to the graph.

        Note that if C{n} is a sequence of strings, indicating the names of the
        new vertices, and attributes has a key C{name}, the two conflict. In
        that case the attribute will be applied.

        @param n: the number of vertices to be added, or the name of a single
          vertex to be added, or a sequence of strings, each corresponding to the
          name of a vertex to be added. Names will be assigned to the C{name}
          vertex attribute.
        @param attributes: dict of sequences, all of length equal to the
          number of vertices to be added, containing the attributes of the new
          vertices. If n is a string (so a single vertex is added), then the
          values of this dict are the attributes themselves, but if n=1 then
          they have to be lists of length 1.
        """
        if isinstance(n, str):
            # Adding a single vertex with a name
            m = self.vcount()
            result = GraphBase.add_vertices(self, 1)
            self.vs[m]["name"] = n
            if attributes is not None:
                for key, val in list(attributes.items()):
                    self.vs[m][key] = val
        elif hasattr(n, "__iter__"):
            m = self.vcount()
            if not hasattr(n, "__len__"):
                names = list(n)
            else:
                names = n
            result = GraphBase.add_vertices(self, len(names))
            if len(names) > 0:
                self.vs[m:]["name"] = names
                if attributes is not None:
                    for key, val in list(attributes.items()):
                        self.vs[m:][key] = val
        else:
            result = GraphBase.add_vertices(self, n)
            if (attributes is not None) and (n > 0):
                m = self.vcount() - n
                for key, val in list(attributes.items()):
                    self.vs[m:][key] = val
        return result
def add_vertices ( self , n , attributes = None ) : if isinstance ( n , str ) : # Adding a single vertex with a name m = self . vcount ( ) result = GraphBase . add_vertices ( self , 1 ) self . vs [ m ] [ "name" ] = n if attributes is not None : for key , val in list ( attributes . items ( ) ) : self . vs [ m ] [ key ] = val elif hasattr ( n , "__iter__" ) : m = self . vcount ( ) if not hasattr ( n , "__len__" ) : names = list ( n ) else : names = n result = GraphBase . add_vertices ( self , len ( names ) ) if len ( names ) > 0 : self . vs [ m : ] [ "name" ] = names if attributes is not None : for key , val in list ( attributes . items ( ) ) : self . vs [ m : ] [ key ] = val else : result = GraphBase . add_vertices ( self , n ) if ( attributes is not None ) and ( n > 0 ) : m = self . vcount ( ) - n for key , val in list ( attributes . items ( ) ) : self . vs [ m : ] [ key ] = val return result