title: How to make a igraph object with a list of objects?
body: <p>I have a list of &quot;treenode&quot; objects.</p>
  <p>Each &quot;treenode&quot; has 3 attributes, all strings.</p>
  <p>I tried following the tutorial <a href="https://igraph.org/python/doc/tutorial/tutorial.html#generating-graphs" rel="nofollow noreferrer">here</a></p>
  <p>However, I cannot add the nodes.</p>
  <p>My current code:</p>
  <pre><code>testlist = []
  for elem in mytree1.iter():
      testlist.append(treenode(elem.tag,elem.attrib,elem.text))
  
  G = Graph()
  for x in testlist:
      G.add_vertices(x)
  </code></pre>
  <p>The error I get:</p>
  <pre><code>an integer is required (got type treenode)
  </code></pre>
  <p>How should I go about using a list to add nodes to the igraph?</p>