I see that you're using an older version of Neo4j. Have you tried using 1.0?
http://components.neo4j.org/neo4j-kernel http://neo4j.org/download Maven groupId: org.neo4j artifactId: neo4j-kernel version: 1.0 ...and at first glance I don't see any direct problem with your code. 2010/2/23 Miguel Ángel Águila <[email protected]>: > Hello, > > I'm doing a code to walk around all the nodes and get the node with the > maximum out degree. The main problem is that there are around 57 million > of nodes and 322 million of edges in the neo database, and using a 64 GB > RAM is insufficient to execute the program. It is the code: > Can anyone see what I'm doing wrong? I don't understand. > > Thanks. > Mike > > > > public static void getNodeMaxOutDegreeNeo(final NeoService neo, > final IndexService indexService) { > Node idNode; > long degree; > long maxDegree = 0; > IndexHits<Node> nodes; > long idDegree; > long idMaxDegree; > Transaction tx = neo.beginTx(); > try { > nodes = indexService.getNodes("TYPE", "titles"); > Iterator<Node> it = nodes.iterator(); > Node idNodeMaxDegree=it.next(); > Iterator<Relationship> relIterator = > idNodeMaxDegree.getRelationships( > NeoDataBase.MyRelationshipTypes.REF, > Direction.OUTGOING).iterator(); > > while (relIterator.hasNext()) { > relIterator.next(); > maxDegree++; > } > long counter = 0; > while (it.hasNext()) { > if ( ++counter % 50000 == 0 ) { > tx.success(); > tx.finish(); > tx = neo.beginTx(); > } > idNode = it.next(); > relIterator = > idNode.getRelationships(NeoDataBase.MyRelationshipTypes.REF, > Direction.OUTGOING).iterator(); > degree = 0; > while (relIterator.hasNext()) { > relIterator.next(); > degree++; > } > if (degree >= maxDegree) { > if(degree==maxDegree) { > idDegree= > Long.getLong((String)idNode.getProperty("ID_TITLE")); > idMaxDegree= > Long.getLong((String)idNodeMaxDegree.getProperty("ID_TITLE")); > if(idDegree>idMaxDegree) { > idNodeMaxDegree = idNode; > } > } > else { > maxDegree = degree; > idNodeMaxDegree = idNode; > } > } > } > > System.out.println("OId = > "+(String)idNodeMaxDegree.getProperty("ID_TITLE")); > System.out.println("Title = > "+(String)idNodeMaxDegree.getProperty("NAME")); > System.out.println("#refs = "+maxDegree); > tx.success(); > } > finally > { > tx.finish(); > } > } > > _______________________________________________ > Neo mailing list > [email protected] > https://lists.neo4j.org/mailman/listinfo/user > -- Mattias Persson, [[email protected]] Neo Technology, www.neotechnology.com _______________________________________________ Neo mailing list [email protected] https://lists.neo4j.org/mailman/listinfo/user

