Last active
November 30, 2020 09:15
-
-
Save joseberlines/f4b9bc50a64086265dec77339f80ca23 to your computer and use it in GitHub Desktop.
First Graph with ipycytoscape
This file contains 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
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