Skip to content

Commit

Permalink
chg: dev: work on json
Browse files Browse the repository at this point in the history
  • Loading branch information
sk2 committed Nov 27, 2014
1 parent 8c864d5 commit 51f1452
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions autonetkit/ank_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 51f1452

Please sign in to comment.