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" }}, |
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
ipycytoscape_obj2 = ipycytoscape.CytoscapeWidget() | |
ipycytoscape_obj2.graph.add_graph_from_json(railnetJSON, directed=True) | |
ipycytoscape_obj2 |
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", "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" }}, |
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
my_style = [ | |
{'selector': 'node','style': { | |
'font-family': 'helvetica', | |
'font-size': '20px', | |
'label': 'data(label)'}}, | |
] |
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
ipycytoscape_obj5 = ipycytoscape.CytoscapeWidget() | |
ipycytoscape_obj5.graph.add_graph_from_json(railnetJSON, directed=False) | |
ipycytoscape_obj5.set_style(my_style) | |
ipycytoscape_obj5 |
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
my_style = [ | |
{'selector': 'node','style': { | |
'font-family': 'arial', | |
'font-size': '10px', | |
'label': 'data(label)', | |
'background-color': 'red'}}, | |
] | |
ipycytoscape_obj6 = ipycytoscape.CytoscapeWidget() | |
ipycytoscape_obj6.graph.add_graph_from_json(railnetJSON, directed=False) # I am telling I dont want directions | |
ipycytoscape_obj6.set_style(my_style) |
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
my_style = [ | |
{'selector': 'node','style': { | |
'font-family': 'arial', | |
'font-size': '10px', | |
'label': 'data(label)', | |
'background-color': 'red'}}, | |
{'selector': 'node[id = "BER"]','style': { | |
'font-family': 'arial', | |
'font-size': '10px', |
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", "label":"HBf BER"}}, | |
{"data": { "id": "MUN", "label":"HBf MUN"}}, | |
{"data": { "id": "FRA", "label":"HBf FRA"}}, | |
{"data": { "id": "HAM", "label":"HBf HAM"}} | |
], | |
"edges": [ | |
{"data": { "id": "line1", "source": "BER", "target": "MUN","label":"200km/h"}}, | |
{"data": { "id": "line2", "source": "MUN", "target": "FRA","label":"200km/h"}}, |
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", "label":"HBf BER", "classes":"east"}}, | |
{"data": { "id": "MUN", "label":"HBf MUN", "classes":"west"}}, | |
{"data": { "id": "FRA", "label":"HBf FRA", "classes":"west"}}, | |
{"data": { "id": "HAM", "label":"HBf HAM", "classes":"west"}}, | |
{"data": { "id": "LEP", "label":"HBf LEP", "classes":"east"}} | |
], | |
"edges": [ | |
{"data": { "id": "line1", "source": "BER", "target": "MUN","label":"200km/h"}}, |
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
import ipycytoscape | |
import json | |
import ipywidgets | |
# I paste here allthe data in order to allow you to copy and paste it without loading data from files. | |
railnet= '''{ | |
"nodes": [ | |
{"data": { "id": "BER", "label":"HBf BER", "classes":"east"}}, | |
{"data": { "id": "MUN", "label":"HBf MUN", "classes":"west"}}, | |
{"data": { "id": "FRA", "label":"HBf FRA", "classes":"west"}}, | |
{"data": { "id": "HAM", "label":"HBf HAM", "classes":"west"}}, |
OlderNewer