After testing networkx, lxml, and pygraphml, I decided that they would not do the job at all. I use BeautifulSoup and write everything from scratch:
from bs4 import BeautifulSoup
fp = "files/tes.graphml"
with open(fp) as file:
soup = BeautifulSoup(file, "lxml")
nodes = soup.findAll("node", {"yfiles.foldertype":""})
groups = soup.find_all("node", {"yfiles.foldertype":"group"})
edges = soup.findAll("edge")
Then you will get the following results:
print " --- Groups --- "
for group in groups:
print group['id']
print group.find("y:nodelabel").text.strip()
print " --- Nodes --- "
for node in nodes:
print node['id']
print node.find("y:nodelabel").text.strip()
That should make you. You can create Group, Node, and Edge objects and use them for some processing.
I can open the source library I'm working on, as it will be used for a greater purpose than just analyzing graphs.

And the conclusion:
--- Groups ---
n0 / SimpleApp
--- Nodes ---
n0::n0 / main
n0::n1 / say hello
n1 / Exit
--- Edges ---
n0::e0 / n0::n0 / n0::n1 / str:username, int:age
e0 / n0::n1 / n1 / None
source
share