diff --git a/autonetkit/ank_json.py b/autonetkit/ank_json.py index ea716105..1785dc2a 100644 --- a/autonetkit/ank_json.py +++ b/autonetkit/ank_json.py @@ -15,6 +15,7 @@ import networkx as nx from networkx.readwrite import json_graph from autonetkit.render2 import NodeRender, PlatformRender +from autonetkit.ank import shallow_copy_nx_graph class AnkEncoder(json.JSONEncoder): @@ -278,6 +279,9 @@ def jsonify_anm_with_graphics(anm, nidb=None): for overlay_id in overlay_ids: try: + #make a shallow copy + # input_graph = anm[overlay_id]._graph + # nm_graph = shallow_copy_nx_graph(input_graph) nm_graph = anm[overlay_id]._graph.copy() except Exception, e: log.warning("Unable to copy overlay %s: %s", overlay_id, e) @@ -340,12 +344,6 @@ def jsonify_anm_with_graphics(anm, nidb=None): # store on graph nm_graph.node[node] = node_data - if nm_graph.is_multigraph(): - for u, v, k in nm_graph.edges(keys=True): - # Store key: nx node_link_data ignores it - #anm_graph[u][v][k]['_key'] = k - pass # is this needed? as key itself holds no value? - try: del nm_graph.node[node]['id'] except KeyError: