Beispiel #1
0
 def addVertices(self, list_vertices=[]):
     """
         Add new vertices in the Graph if names are not used
         
         Optional parameters:
         list_vertices : a list of names for new vertices
     """
     existing_vertices = self.getVertices()
     for vertex in list_vertices:
         if type(vertex) == str:
             if not (vertex in existing_vertices):
                 newVertex = Vertices(vertex)
                 self.vertices.append(newVertex)
             else:
                 print("Error : " + vertex + " already exists.")
         else:
             print("Error : " + vertex + " must be a String.")