Created
September 10, 2015 17:59
-
-
Save danlamanna/3302ae595f4d5b4d3073 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import networkx as nx | |
import romanesco | |
betweenness_centrality = { | |
'inputs': [ | |
{'name': 'G', | |
'type': 'graph', | |
'format': 'networkx'}, | |
{'name': 'node', | |
'type': 'string', | |
'format': 'text'} | |
], | |
'outputs': [ | |
{'name': 'measure', | |
'type': 'number', | |
'format': 'number'} | |
], | |
'script': | |
''' | |
from networkx import betweenness_centrality | |
measure = betweenness_centrality(G)[node] | |
''' | |
} | |
with open('/home/dan/Downloads/alphabet-network.json', 'rb') as infile: | |
clique_graph = infile.read() | |
output = romanesco.run(betweenness_centrality, inputs={'G': {'format': 'clique.json', | |
'data': clique_graph}, | |
'node': {'format': 'text', | |
'data': '55ba5019f8883b5bf35f3e30'}}) | |
print output |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment