Skip to content

Instantly share code, notes, and snippets.

@joseberlines
Last active November 30, 2020 09:15
Show Gist options
  • Save joseberlines/f4b9bc50a64086265dec77339f80ca23 to your computer and use it in GitHub Desktop.
Save joseberlines/f4b9bc50a64086265dec77339f80ca23 to your computer and use it in GitHub Desktop.
First Graph with ipycytoscape
railnet= '''{
"nodes": [
{"data": { "id": "BER" }},
{"data": { "id": "MUN"}},
{"data": { "id": "FRA"}},
{"data": { "id": "HAM"}}
],
"edges": [
{"data": { "source": "BER", "target": "MUN" }},
{"data": { "source": "MUN", "target": "FRA" }},
{"data": { "source": "FRA", "target": "BER" }},
{"data": { "source": "BER", "target": "HAM" }}
]
}'''
railnetJSON = json.loads(railnet)
ipycytoscape_obj = ipycytoscape.CytoscapeWidget()
ipycytoscape_obj.graph.add_graph_from_json(railnetJSON)
ipycytoscape_obj
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment