docs: def draw(self, filename, color=True):
          ''' Render a plot of the graph via pygraphviz.
  
          Args:
              filename (str): Path to save the generated image to.
              color (bool): If True, will color graph nodes based on their type,
                  otherwise will draw a black-and-white graph.
          '''
          verify_dependencies(['pgv'])
          if not hasattr(self, '_results'):
              raise RuntimeError("Graph cannot be drawn before it is executed. "
                                 "Try calling run() first.")
  
          g = pgv.AGraph(directed=True)
          g.node_attr['colorscheme'] = 'set312'
  
          for elem in self._results:
              if not hasattr(elem, 'history'):
                  continue
              log = elem.history
  
              while log:
                  # Configure nodes
                  source_from = log.parent[6] if log.parent else ''
                  s_node = hash((source_from, log[2]))
                  s_color = stim_list.index(log[2])
                  s_color = s_color % 12 + 1
  
                  t_node = hash((log[6], log[7]))
                  t_style = 'filled,' if color else ''
                  t_style += 'dotted' if log.implicit else ''
                  if log[6].endswith('Extractor'):
                      t_color = '#0082c8'
                  elif log[6].endswith('Filter'):
                      t_color = '#e6194b'
                  else:
                      t_color = '#3cb44b'
  
                  r_node = hash((log[6], log[5]))
                  r_color = stim_list.index(log[5])
                  r_color = r_color % 12 + 1
  
                  # Add nodes
                  if color:
                      g.add_node(s_node, label=log[2], shape='ellipse',
                                 style='filled', fillcolor=s_color)
                      g.add_node(t_node, label=log[6], shape='box',
                                 style=t_style, fillcolor=t_color)
                      g.add_node(r_node, label=log[5], shape='ellipse',
                                 style='filled', fillcolor=r_color)
                  else:
                      g.add_node(s_node, label=log[2], shape='ellipse')
                      g.add_node(t_node, label=log[6], shape='box',
                                 style=t_style)
                      g.add_node(r_node, label=log[5], shape='ellipse')
  
                  # Add edges
                  g.add_edge(s_node, t_node, style=t_style)
                  g.add_edge(t_node, r_node, style=t_style)
                  log = log.parent
  
          g.draw(filename, prog='dot')