plotly / react-cytoscapejs

React component for Cytoscape.js network visualisations
MIT License
472 stars 69 forks source link

Fix doc #49

Closed SamLebarbare closed 3 years ago

SamLebarbare commented 4 years ago

each edge must have an unique id, or update will fail.

SamLebarbare commented 4 years ago

Hello @maxkfranz ok for you? or i missed something with edge id's?

kinimesi commented 3 years ago

Edge ids are not necessary, you don't need to provide them (but if you do, they must be unique). You can paste the examples in the Readme file into the demo.html file in this repo, it works without a problem:

{
   "id":"cy",
   "className":"foo bar",
   "style":{
      "border":"1px solid #ccc",
      "width":"400px",
      "height":"400px"
   },
   "global":"cy",
   "elements":[
      {
         "data":{
            "id":"one",
            "label":"Node 1"
         },
         "position":{
            "x":0,
            "y":0
         }
      },
      {
         "data":{
            "id":"two",
            "label":"Node 2"
         },
         "position":{
            "x":100,
            "y":0
         }
      },
      {
         "data":{
            "source":"one",
            "target":"two",
            "label":"Edge from Node1 to Node2"
         }
      }
   ],
   "layout":{
      "name":"preset"
   }
}

image

Please let's know, if the problem still persists, thanks.