Hi,
I'd like to know if its possible to do a faster traversal than in this
stored procedure.
I want to return all reachable (directed) nodes from a startnode:
public class ConnectedComponent {
@Context
public GraphDatabaseService graphDatabaseService;
private static enum RelTypes implements RelationshipType {
CONNECTS
}
@Procedure(value = "connectedComponent")
public Stream<Visited> connectedComponent(@Name("start") Node start) {
return graphDatabaseService.traversalDescription()
.depthFirst()
.relationships( RelTypes.CONNECTS, Direction.OUTGOING )
.uniqueness( Uniqueness.RELATIONSHIP_GLOBAL )
.traverse( start )
.nodes().stream().map(Visited::new);
}
public static class Visited {
public final Node node;
public Visited(Node node) {
this.node = node;
}
}
}
I call the procedure like this:
match (n:Post {id: "3235"}) CALL connectedComponent(n) yield node return
node;
This takes around 3 seconds for 15k visited nodes. That's about 10x slower
compared to a stored procedure in postgres on the same data. Any ideas?
Thank you!
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.