[Neo4j] Creating a graph database with BatchInserter and getting the node degree of every node

st3ven st3ven at web.de
Tue Sep 20 13:00:03 CEST 2011


Peter,

the import of the data into the graph database is not the main problem for
me. 
The lookup of nodes from the index is fast enough for me.
To create the database it took me nearly half a day.

My main problem here is getting the node degree of every node.
As I already said I am using this code to get the node degree of every node:

for (Node node : db.getAllNodes()) {
                        counter = 0;

                        if (node.getId() > 0) {
                                for (Relationship rel :
node.getRelationships()) {
                                        counter++;
                                }
                               
System.out.println(node.getProperty("name").toString() + ": "
                                                + counter);
                        }

                } 

After 3 days I only got the node degree of 80000 nodes and I want to
optimize my traversal here, cause this is very slow.
What can I do to make this faster or do I have to change my code for getting
the node degree?
I only posted my import code because I thought I could maybe optimize there
something for this traversal.

Thank you very much for your help!

Cheers,
Stephan


--
View this message in context: http://neo4j-community-discussions.438527.n3.nabble.com/Creating-a-graph-database-with-BatchInserter-and-getting-the-node-degree-of-every-node-tp3351599p3351664.html
Sent from the Neo4j Community Discussions mailing list archive at Nabble.com.


More information about the User mailing list