Skip to content

Instantly share code, notes, and snippets.

@joseberlines
Last active November 22, 2020 19:13
Show Gist options
  • Save joseberlines/ee3d00d9143ea62aab69d502ae4704a7 to your computer and use it in GitHub Desktop.
Save joseberlines/ee3d00d9143ea62aab69d502ae4704a7 to your computer and use it in GitHub Desktop.
adding names
railnet= '''{
"nodes": [
{"data": { "id": "BER", "label":"HBf BER"}},
{"data": { "id": "MUN", "label":"HBf MUN"}},
{"data": { "id": "FRA", "label":"HBf FRA"}},
{"data": { "id": "HAM", "label":"HBf 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_obj4 = ipycytoscape.CytoscapeWidget()
ipycytoscape_obj4.graph.add_graph_from_json(railnetJSON, directed=False)
ipycytoscape_obj4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment