#!/usr/bin/env python # coding: utf-8 # # 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 # In[ ]: import ipycytoscape # In[ ]: import json with open("colaData.json") as fi: json_file = json.load(fi) # In[ ]: cytoscapeobj = ipycytoscape.CytoscapeWidget() cytoscapeobj.graph.add_graph_from_json(json_file) # In[ ]: cytoscapeobj.set_style([{ 'selector': 'node', 'css': { 'background-color': 'red' } }, { 'selector': 'edge', 'css': { 'line-color': 'pink' } }]) # In[ ]: cytoscapeobj