code: def __init__(self, vertices=None, edges=None, directed=True):
      if vertices is None:
          vertices = []
      if edges is None:
          edges = []
      self.directed = directed
  
      for v in vertices:
          v.component = Poset(
              [v]
          )  # at first, every vertex is its own component
      components = [v.component for v in vertices]
      # then pass through edges and union associated vertices such that
      # CV finally holds only connected sets:
      for e in edges:
          x = e.v[0]
          y = e.v[1]
          assert x in vertices
          assert y in vertices
          assert x.component in components
          assert y.component in components
          e.attach()
          if x.component != y.component:
              # merge y.component into x.component :
              x.component.update(y.component)
              # update set list (MUST BE DONE BEFORE UPDATING REFS!)
              components.remove(y.component)
              # update reference:
              for z in y.component:
                  z.component = x.component
      # create the components
      self.components = []
      for vertices in components:
          edge_set = set()
          for v in vertices:
              edge_set.update(v.e)
          self.components.append(
              self.component_class(vertices, edge_set, directed)
          )
  
imports: from typing import List
  from .graphBase import GraphBase
  from graphistry.layout.utils import Poset
  import pandas
label_desc: Use image node_id 1 to create a new Graph object from inherited base classes: object with example: obj = Graph(vertices, edges, directed)