Function: fromNodeLink()
ts
function fromNodeLink(json): GraphData;A graph from node-link JSON, whichever of these shapes it has:
- networkx
node_link_dataand d3:{ directed?, nodes: [{ id, … }], links | edges: [{ source, target, … }] }. Ends are node ids; when the nodes have no ids, they are indices. - graphology
graph.export():{ options: { type }, nodes: [{ key, attributes }], edges: [{ source, target, attributes, undirected? }] }. - Cytoscape
cy.json()and element lists:{ elements: { nodes: [{ data: { id, … }, position }], edges: [{ data: { source, target, … } }] } },{ elements: [ … ] }or the array itself. A node'sparent(a compound node) becomes its group. Cytoscape's y axis points down, soposition.yis negated.
Attributes named label / name, group / community / cluster, value / size / weight, color, x and y fill the matching arrays; the rest goes to customdata. Links whose ends are not nodes are skipped. Throws a TypeError for anything else.
Parameters
| Parameter | Type |
|---|---|
json | unknown |