Check Duplicate Node VivaGraph js

120 Views Asked by At

I want to check node exist or not before create a new node. From VivaGraph GitHub documentation I cant find anything.

1

There are 1 best solutions below

0
MrFreeze On

You can use

graph.getNode(id)

with graph being your VivaGraph instance, which would return null if no node with the given id exists. It is automatically called by graph.addNode(id, data), so it is not possible to create two nodes with the same id anyway.