tap.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 '''
3 Load in a graph from a JsonClusterTap JSON file
4 '''
5 
6 import json
7 
8 def load(filename):
9  dat = json.load(open(filename))
10  import networkx as nx
11  gr = nx.Graph(filename=filename)
12  for vtx in dat['vertices']:
13  gr.add_node(vtx['ident'], code=vtx['type'], **vtx['data'])
14  for edge in dat['edges']:
15  gr.add_edge(*edge)
16  return gr
17 
int open(const char *, int)
Opens a file descriptor.
def load(filename)
Definition: tap.py:8