I am new to Neo4j & just playing to learn in deep. I have a small doubt like,
if I created two nodes in the space and provided relationship and also the system time (to know at what time they are friends each other) between those two nodes.
So now 开发者_如何学Gomy question is, Is it possible to get two different relation times (If I provide Direction as Both & I created the relation only once)?
You people knows that how traverse function behaves in Neo4j.
If so please explain with me some example like how ?
Your question is not entirely clear.
If you have
(person) - knows [started = time] -> (person)
then you can have as many of those relationships as you'd like, they could be in either direction (BOTH actually means two relationship, one in either direction).
For direct relationships you could do:
Node me, you;
for (Relationship r : me.getRelationships(KNOWS)) {
if (r.getOtherNode(me).equals(you)) result.add(r.getProperty("time"));
}
For longer paths you can use GraphAlgoFactory.allSimplePaths to retrieve the paths between two people and do with the relationships and their time information whatever you want.
HTH
Michael
精彩评论