run bfs on large graph dataset using neo4j is slow? or what is the problem with the code i am referring?

34 views
Skip to first unread message

TC

unread,
Apr 18, 2014, 5:11:37 PM4/18/14
to ne...@googlegroups.com
Hi, I'm running a large graph node. 265214 nodes and 420045 edges.
I'm using the traversal example from neo4j doc.
public String knowsTraverserforward( Node node )
    {
        String output = "";
        // START SNIPPET: knowslikestraverser
        for ( Path position : db.traversalDescription()
               .breadthFirst()
                .relationships( Rels.KNOWS, Direction.OUTGOING )
        //        .evaluator( Evaluators.toDepth(10) )
                .traverse( node ) )
        {
            output += position + "\n";
        }
        // END SNIPPET: knowslikestraverser
        return output;
    }

while i when i set the depth like 10, it take little time to output
now i delete the depth assumption, it take so long time to produce the output and didn't give me valid output yet.
i using eclipse on windows to do this code. 
is there something with my attempt?
Thanks

Michael Hunger

unread,
Apr 18, 2014, 6:02:22 PM4/18/14
to ne...@googlegroups.com
Perhaps you can say something about your graph structure?

Do you have loops? You might consider setting a uniqueness constraint on the traverser.

It will try to traverse to the end of the graph now. Which might result in many many paths.

(michael)-[:SUPPORTS]->(YOU)-[:USE]->(Neo4j)
Learn OnlineOffline or Read a Book (in Deutsch)
We're trading T-shirts for cool Graph Models


--
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.

TC

unread,
Apr 18, 2014, 6:15:07 PM4/18/14
to ne...@googlegroups.com, michael...@neotechnology.com
Hi, I think there will be loop in the graph. I use the example from online.
So i think it already define the uniqueness of traversal.
public TraversalExample( GraphDatabaseService db )
    {
        this.db = db;
        // START SNIPPET: basetraverser
        friendsTraversal = db.traversalDescription()
                .breadthFirst()
                .relationships( Rels.KNOWS )
                .uniqueness( Uniqueness.RELATIONSHIP_GLOBAL );
        // END SNIPPET: basetraverser
    }
Reply all
Reply to author
Forward
0 new messages