JSON

Required Strucutre of the JSON file

The JSON file must have two keys: 'nodes' and 'edges' each of which contain a list of elements that conform to the cytoscapejs specification: https://js.cytoscape.org/#notation/elements-json

[1]:
import ipycytoscape
[2]:
import json
with open("colaData.json") as fi:
    json_file = json.load(fi)
[3]:
cytoscapeobj = ipycytoscape.CytoscapeWidget()
cytoscapeobj.graph.add_graph_from_json(json_file)
[4]:
cytoscapeobj.set_style([{
                            'selector': 'node',
                            'css': {
                                'background-color': 'red'
                            }
                        },

                        {
                            'selector': 'edge',
                            'css': {
                                'line-color': 'pink'
                            }
                        }])
[5]:
cytoscapeobj