cytoscape_data(G, attrs=None, name='name', ident='id')
The graph to convert to cytoscape format
A dictionary containing the keys 'name' and 'ident' which are mapped to the 'name' and 'id' node elements in cyjs format. All other keys are ignored. Default is :None:None:`None`
which results in the default mapping dict(name="name", ident="id")
.
The :None:None:`attrs`
keyword argument will be replaced with :None:None:`name`
and :None:None:`ident`
in networkx 3.0
A string which is mapped to the 'name' node element in cyjs format. Must not have the same value as :None:None:`ident`
.
A string which is mapped to the 'id' node element in cyjs format. Must not have the same value as :None:None:`name`
.
If the values for :None:None:`name`
and :None:None:`ident`
are identical.
A dictionary with cyjs formatted data.
Returns data in Cytoscape JSON format (cyjs).
cytoscape_graph
convert a dictionary in cyjs format to a graph
>>> G = nx.path_graph(2)See :
... nx.cytoscape_data(G) # doctest: +SKIP {'data': [], 'directed': False, 'multigraph': False, 'elements': {'nodes': [{'data': {'id': '0', 'value': 0, 'name': '0'}}, {'data': {'id': '1', 'value': 1, 'name': '1'}}], 'edges': [{'data': {'source': 0, 'target': 1}}]}}
The following pages refer to to this document either explicitly or contain code examples using this.
networkx.readwrite.json_graph.cytoscape.cytoscape_graph
networkx.readwrite.json_graph.cytoscape.cytoscape_data
Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.
Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)
SVG is more flexible but power hungry; and does not scale well to 50 + nodes.
All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them