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.


You can get this number through JMX, see 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


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: