cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
932
Views
2
Helpful
2
Replies

Not integer id.

npateriy
Cisco Employee
Cisco Employee

Are non integer ids (UUID) supported?

In 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"},

      

    ]

};

1 Accepted Solution

Accepted Solutions

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.

View solution in original post

2 Replies 2

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.

npateriy
Cisco Employee
Cisco Employee

Thanks Alexendar.

For future refernce. This works

var topo = new nx.graphic.Topology({

                    ...

                    identityKey: 'id',

                     .........

                });