class_docstr: A connected graph of Vertex/Edge objects. A GraphBase is a *component* of a Graph that contains a connected set of Vertex and Edges.
  
  Attributes:
      verticesPoset (Poset[Vertex]): the partially ordered set of vertices of the graph.
      edgesPoset (Poset[Edge]): the partially ordered set of edges of the graph.
      loops (set[Edge]): the set of *loop* edges (of degree 0).
      directed (bool): indicates if the graph is considered *oriented* or not.
class_docstr_tok: ["A","connected","graph","of","Vertex\/Edge","objects",".","A","GraphBase","is","a","*","component","*","of","a","Graph","that","contains","a","connected","set","of","Vertex","and","Edges",".","Attributes",":","verticesPoset","(","Poset","[","Vertex","]",")",":","the","partially","ordered","set","of","vertices","of","the","graph",".","edgesPoset","(","Poset","[","Edge","]",")",":","the","partially","ordered","set","of","edges","of","the","graph",".","loops","(","set","[","Edge","]",")",":","the","set","of","*","loop","*","edges","(","of","degree","0",")",".","directed","(","bool",")",":","indicates","if","the","graph","is","considered","*","oriented","*","or","not","."]
code: def __init__(self, vertices=None, edges=None, directed=True):
      if vertices is None:
          vertices = []
      if edges is None:
          edges = []
      self.directed = directed
      self.verticesPoset = Poset(vertices)
      self.edgesPoset = Poset([])
  
      self.loops = set()
  
      if len(self.verticesPoset) == 1:
          v = self.verticesPoset[0]
          v.component = self
          for e in v.e:
              e.detach()
          return
  
      for e in edges:
          x = self.verticesPoset.get(e.v[0])
          y = self.verticesPoset.get(e.v[1])
          if x is None or y is None:
              raise ValueError("unknown Vertex (%s or %s)" % e.v)
          e.v = (x, y)
          if e.degree == 0:
              self.loops.add(e)
          e = self.edgesPoset.add(e)
          e.attach()
          if x.component is None:
              x.component = Poset([x])
          if y.component is None:
              y.component = Poset([y])
          if id(x.component) != id(y.component):
              x, y = (
                  (x, y)
                  if len(x.component) > len(y.component)
                  else (y, x)
              )
              x.component.update(y.component)
              for v in y.component:
                  v.component = x.component
          s = x.component
      # check if graph is connected:
      for v in self.vertices():
          if v.component is None or (v.component != s):
              raise ValueError("unconnected Vertex %s" % v.data)
          else:
              v.component = self
  
imports: from graphistry.layout.utils import Poset
label_desc: Use image node_id 1 to create a new GraphBase object from inherited base classes: object with example: obj = GraphBase(vertices, edges, directed)