Hello there!
First of all, thanks for the help in all my previous questions, all the 
answers have been helping me to use Neo4j with success.

I have a very simple question, but I haven't found the answer yet...

I'd like to have a function, which signature would be more or less like 
this:

public areTheyConnected(Node *n1*,Node *n2*,Relationship *rel*,Direction 
*dir*)

which returns true iff there is an edge of type *rel*, between *n1* and 
*n2*, in the *dir* direction (the direction has n1 as reference).

Example:

In my graph, I have: "Bob knows Tom, Tom knows Peter, Jack knows Tom"

areTheyConnected(nodeBob,nodeTom,relKnows,Direction.OUTGOING) returns 
true; (Bob knows Tom)
areTheyConnected(nodeTom,nodeJack,relKnows,Direction.INCOMING) also 
returns true; (Jack knows Tom)

areTheyConnected(nodeBob,nodeTom,relKnows,Direction.INCOMING) returns 
false; (Tom doesn't know Bob)

Is there an easy method (constant time, or close) for that?

Thank you very much,
Bruno
_______________________________________________
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to