I want to get a list of all nodes and some attributes (e.g. label name) in a yEd created graphml file regardless of where they are located in the graph. This has been partially dealt with already (Processing XML file with networkx in python and How to iterate over GraphML file with lxml) but not when you 'group' nodes within yEd - and I have lots of groupings within groupings.
Have tried networkx and lxml but not getting complete set of results using simple approaches suggested - any suggestions on elegant way to resolve and which library to use short of recursively iterating through tree and identifying group nodes and drilling down again.
Example:
Sample output for very simple graph using networkx when you have groupings:
('n0', {})
('n1', {'y': '0.0', 'x': '26.007967509920633', 'label': 'A'})
('n0::n0', {})
('n0::n1', {})

After trying out networkx, lxml and pygraphml, I decided they won't do the job at all. I'm using BeautifulSoup and writing everything from the ground up:
Then you get your results like this:
This should get you going. You can make Group, Node & Edge objects and use them for some processing.
I may open source the library I am working on as it would be used for a bigger purpose than just parsing graphs.
And the output: