title: how to check if a node is already present in Graphviz Python
body: <p>How to check if a particular node is already present in the graph.</p>
  
  <p>Here is what I have tried. </p>
  
  <pre><code>&gt;&gt;&gt;from graphviz import Digraph
  &gt;&gt;&gt;dot = Digraph()
  &gt;&gt;&gt;dot.node('solid',xlabel='0')
  &gt;&gt;&gt;dot.node('liquid',xlabel='0')
  &gt;&gt;&gt;dot.edge('solid','liquid','melt')
  &gt;&gt;&gt;print (dot)
  
  digraph {
      solid [xlabel=0]
      liquid [xlabel=0]
      solid -&gt; liquid [label=melt]
  }
  
  &gt;&gt;&gt;check = 'solid' in dot
  &gt;&gt;&gt;print (solid)
  
  False
  </code></pre>
  
  <p>As we see here I can't directly check for the node.</p>
  
  <p>I am looking for a way to check if the node has been visited/created before and if that node is visited then increment it's <em>xlabel</em> by 1.</p>
  
  <p>Is there a way to traverse and visit each node in graphviz or do I have to write a separate code to check if a specific node is present? </p>