Java API to fetch max node id

26 views
Skip to first unread message

Lokesh Gidra

unread,
Apr 22, 2014, 2:02:24 AM4/22/14
to ne...@googlegroups.com
Hello,

I am trying to write a java program which will use neo4j in embedded mode. This program will use fork/join mechanism to traverse the graph in parallel to perform operations like finding connected components. Can someone please suggest me the best way to divide the task in this scenario? The only idea that struck my mind is to use the node ids and dividing the range.


Regards,
Lokesh

Michael Hunger

unread,
Apr 22, 2014, 8:55:10 AM4/22/14
to ne...@googlegroups.com
Yep makes sense.
You can get the highest node id by asking the NodeManager afaik.

((GraphDatabaseAPI)gdb).getDepencencyResolver().resolveDependency(NodeManager.class).getHighestIdInUse(Node.class)

Written out of the top of my head, so please check that this works :)



--
You received this message because you are subscribed to the Google Groups "Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email to neo4j+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Lokesh Gidra

unread,
Apr 22, 2014, 9:28:27 AM4/22/14
to ne...@googlegroups.com
Yeah I saw that nodeManager is the one which can return this value. I was just unsure of how to access nodeManager in Java.
Reply all
Reply to author
Forward
0 new messages