netjsongraph.js icon indicating copy to clipboard operation
netjsongraph.js copied to clipboard

[gsoc22] crash when there are nodes with the same id

Open mwarning opened this issue 3 years ago • 5 comments

While having two nodes with the same id is probably not valid, netjsongraph.js should at least not crash.

Uncaught TypeError: nodes[data.getRawIndex(...)] is undefined
    update http://localhost:8000/netjsongraph.min.js:55959
    createGraphFromNodeEdge http://localhost:8000/netjsongraph.min.js:56268
    getInitialData http://localhost:8000/netjsongraph.min.js:53647
    init http://localhost:8000/netjsongraph.min.js:94121
    init http://localhost:8000/netjsongraph.min.js:53610
    visitComponent http://localhost:8000/netjsongraph.min.js:75703
    each http://localhost:8000/netjsongraph.min.js:111818
    visitComponent http://localhost:8000/netjsongraph.min.js:75648
    topologicalTravel http://localhost:8000/netjsongraph.min.js:98376
    _mergeOption http://localhost:8000/netjsongraph.min.js:75627
    _resetOption http://localhost:8000/netjsongraph.min.js:75543
    setOption http://localhost:8000/netjsongraph.min.js:75514
    setOption http://localhost:8000/netjsongraph.min.js:79622
    echartsSetOption http://localhost:8000/netjsongraph.min.js:122191
    graphRender http://localhost:8000/netjsongraph.min.js:122398
    onclick http://localhost:8000/netjsongraph.min.js:123301

This happens with MeshGraphViewer when the map is loaded and then updated with a node list that has two nodes of the same id. When I switch to the topology view, the crash happens.

mwarning avatar Sep 11 '22 11:09 mwarning

@mwarning, I would like to work on this issue.

d1vyanshu-kumar avatar Feb 24 '24 19:02 d1vyanshu-kumar

@d1vyanshu-kumar feel free to fix it. But I do participate in the current GSOC in any way.

mwarning avatar Feb 24 '24 20:02 mwarning

@mwarning Thank you for your response. I appreciate the opportunity to work on this issue. I am looking for the file or section of code in the netjasongraph.js repository where the network data is stored. I believe this is typically an array of node objects, each with a unique ID. Could you assist me with this?

As a beginner, I am a bit confused. If this Is the issue of meshgraphViewer then why is this an issue open in netjsongraph.js can you please elaborate on this issue in detail?

d1vyanshu-kumar avatar Feb 24 '24 20:02 d1vyanshu-kumar

@mwarning please look at line 16 and line 22 it has same id. https://github.com/mwarning/MeshGraphViewer/blob/netjson/netjsonmap.json#L16 https://github.com/mwarning/MeshGraphViewer/blob/netjson/netjsonmap.json#L22

d1vyanshu-kumar avatar Feb 25 '24 11:02 d1vyanshu-kumar

hi @d1vyanshu-kumar, I do not know the netjsongraph.js code. I also no proficient JavaScript developer. I plan to use netjsongraph.js for MeshGraphViewer, but for now that is work in progress.

During my tries to integrate netjsongraph.js into MeshGraphViewer, I stumbled over the error I reported above and thought that the netjsongraph.js developers do not want to it to crash even when two nodes entries have the same id.

Your two links point to the data that triggers the error. :-)

mwarning avatar Feb 25 '24 20:02 mwarning