addNetworks Example - cytoscape/cytoscape-web GitHub Wiki

Format of response for addNetworks results

The result should be a list of CX2 networks.

[
  {
    "action": "addNetworks",
    "data":  [ CX2Network object1, CX2Network object2 ]
  }
]

Example:

[ 
  { 
     "action": "addNetworks",
     "data": [[{"CXVersion": "2.0", "hasFragments": false}, {"metaData": [{"elementCount": 1, "name": "attributeDeclarations"}, 
               {"elementCount": 1, "name": "networkAttributes"}, {"elementCount": 2, "name": "nodes"}, 
               {"elementCount": 1, "name": "edges"}]}, 
               {"attributeDeclarations": [{"networkAttributes": {"name": {"d": "string"}}, "nodes": {"name": {"d": "string"}, 
                "age": {"d": "integer"}}, "edges": {"weight": {"d": "double"}}}]}, {"networkAttributes": [{"name": "network name"}]}, 
               {"nodes": [{"id": 0, "v": {"name": "node 1", "age": 5}}, {"id": 1, "v": {"name": "node 2", "age": 10}}]}, 
               {"edges": [{"id": 0, "s": 0, "t": 1, "v": {"weight": 0.3}}]}, {"status": [{"error": "", "success": true}]}]]
  }
]