In Neo4J how do I get the largest node id in the graph?

I'm running a script that iterates through all the nodes. Initially, I thought the maximum node id would correspond to the total number of nodes in the graph which I retrieved by this Cypher query over REST:

START n=node(*) RETURN count(n)

However, as I iterate through each number, I see that some nodes at certain ids just don't exist. So, this means my maximum id node is a number larger than the total number of nodes. Any idea how I can retrieve this number? I strongly prefer Cypher or Rest.

Answers


You can get this number through JMX, see http://docs.neo4j.org/chunked/1.4.2/operations-monitoring.html or with Java via

Neo4jManager manager = new Neo4jManager( graphDb.getManagementBean( Kernel.class ) );
long nodeIDsInUse    = manager.getPrimitivesBean.getNumberOfNodeIdsInUse();

This is also exposed to the Webadmin JMX endpoint via REST starting at

http://localhost:7474/db/manage/server/jmx/domain/org.neo4j/instance%3Dkernel%230%2Cname%3DPrimitive%20count?_=1342719685294

Need Your Help

borders in java

java swing

I want to set single title border to group of textfields how can i do this in java / swing.

Making a sticky header work

javascript jquery

I've got the following code for a sticky header, but I can't get the scroll to work and it's not a smooth transition. The #top-nav-wrapper barely scrolls when the fixed header below is activated: