You can provide graph data to the engine using graphData or by providing a URL to a JSON file via jsonUrl.
To use graphData, provide an object following this structure:
{
"nodes": [
{ "id": "id1", "name": "name1", "val": 1 },
{ "id": "id2", "name": "name2", "val": 10 }
],
"links": [
{ "source": "id1", "target": "id2" }
]
}
If your data uses different keys for identifiers, you can customize the accessors:
nodeId(str): The attribute for unique node IDs (default: 'id').linkSource(str): The attribute in link objects referring to the source node ID (default: 'source').linkTarget(str): The attribute in link objects referring to the target node ID (default: 'target').
graphInstance.graphData({ nodes: [...], links: [...] });
// OR
graphInstance.jsonUrl('https://example.com/data.json');