Are non integer ids (UUID) supported.
In the below sample topologyData1 and topologyData2 works but topologyData3 is failing.
var topologyData1 = {
nodes: [
{"id": 0, "x": 410, "y": 100, "name": "12K-1"},
{"id": 1, "x": 410, "y": 280, "name": "12K-2"}
],
links: [
{"source": 0, "target": 1},
]
};
var topologyData2 = {
nodes: [
{"id": "0", "x": 410, "y": 100, "name": "12K-1"},
{"id": "1", "x": 410, "y": 280, "name": "12K-2"}
],
links: [
{"source": "0", "target": "1"},
]
};
var topologyData3 = {
nodes: [
{"id": "0", "x": 410, "y": 100, "name": "12K-1"},
{"id": "1a", "x": 410, "y": 280, "name": "12K-2"}
],
links: [
{"source": "0", "target": "1a"},
]
};
nx.graphic.Topology defaults to using the index instead of the id for identifying link source and destinations, you have to set:
identityKey: 'id',
to make it use the ids which then also works with strings.
For future reference. This also works
var topo = new nx.graphic.Topology({
...
identityKey: 'id',
.........
});
Comments
0 comments
Please sign in to leave a comment.