I want to check node exist or not before create a new node. From VivaGraph GitHub documentation I cant find anything.
Asked
Active
Viewed 112 times
0
-
1check the source code then. there must be something written. – Jai Dec 01 '16 at 11:59
-
Why don't you create an array of contains nodes. So you can check if there is a duplicate – aprogrammer Dec 01 '16 at 12:06
1 Answers
0
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.

MrFreeze
- 185
- 2
- 8