Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions N2G/plugins/diagrams/N2G_DrawIO.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,9 +503,17 @@ def layout(self, algo="kk", ig_kwargs=None, **kwargs):
# populate igraph with nodes and edges from object tags
for item in self.current_root.iterfind("./object"):
# add edges, item[0] refernece to object's mxCell child tag
if item[0].get("source") and item[0].get("target"):
src = igraph_graph.add_vertex(name=item[0].get("source"))
tgt = igraph_graph.add_vertex(name=item[0].get("target"))
src = item[0].get("source")
tgt = item[0].get("target")
if src and tgt:
try:
src = igraph_graph.vs.find(src)
except ValueError:
src = igraph_graph.add_vertex(name=src)
try:
tgt = igraph_graph.vs.find(tgt)
except ValueError:
tgt = igraph_graph.add_vertex(name=tgt)
igraph_graph.add_edge(source=src, target=tgt)
# add nodes
else:
Expand Down