I am new to Python and even newer to iGraph.
I have a project which I have been stuck on for a while (please bear with me…)
I wish to generate a tree structure to visualize the structure of an XML file with Plotly-igraph.
I am using this as reference:
Trouble is, I am unsure how to do so.
My current implementation entails the following steps:
Getting all the elements of the XML file and putting it in to a list.
(elements include 3 strings: tag, attribute, text)
Using the list to generate the tree in igraph.
However, I am unsure how to do the 2nd part…
igraph does not seem to accept objects as arguments when I try to do a:
G = Graph()
for x in elementlist:
giving the following error:
an integer is required (got type treenode)
As such, my 2 main questions are:
1. How do I use a list to generate a graph object?
2. I also have no idea how to get the edges between each node in an XML.
Any help with the first question will be greatly appreciated and it would be nice if anyone has suggestions for the 2nd question! (I’m open to changing my current implementation)