py4cytoscape.networks.create_network_from_networkx

create_network_from_networkx(netx, title='From networkx', collection='My NetworkX Network Collection', base_url='http://127.0.0.1:1234/v1')[source]

Create a Cytoscape network from a NetworkX graph.

Parameters
  • netx (Graph, DiGraph, MultiGraph or MultiDiGraph) – networkx object

  • title (str) – network name

  • collection (str) – network collection name

  • base_url (str) – Ignore unless you need to specify a custom domain, port or version to connect to the CyREST API. Default is http://127.0.0.1:1234 and the latest version of the CyREST API supported by this version of py4cytoscape.

Returns

The SUID of the new network

Return type

int

Raises

requests.exceptions.RequestException – if can’t connect to Cytoscape or Cytoscape returns an error

Examples

>>> create_network_from_networkx(netx)
31766
>>> create_network_from_networkx(netx, 'Cool Networkx', 'Collection of Cool Networks')
31766