Respected,

I am new to Neo4j. I am playing with neo4j but i have a doubt regarding
traverser function.

I just wrote a code based on finding friends to a particular node in the
tree network based on condition i.e., "timePoint".
For example, tree network looks like this...

Nodes(A, B, C, D, E), Relationship(<-KNOWS->). I have created system time to
timePoint for each relationship i.e at what time they are in relationship.

A<-KNOWS-> B,    A<-KNOWS->C,     B<-KNOWS->C,      B<-KNOWS->D,
 C<-KNOWS->E.

And here is my traverse function,
public Traverser testTraverser(Node node, final long timePoint)
{
   final long currentSystemTime = new Date().getTime();
   Traverser Nodetraverser = node.traverse(Order.BREADTH_FIRST,
new StopEvaluator()
 {
public boolean isStopNode(TraversalPosition currentPos) {
return (currentSystemTime
-(Long)currentPos.lastRelationshipTraversed().getProperty("TimeStamp")>
timePoint);
 }
},  new ReturnableEvaluator()
{
 public boolean isReturnableNode(TraversalPosition currentPos)
{
    Relationship lastRelation = currentPos.lastRelationshipTraversed();
   return lastRelation != null && (currentSystemTime - (Long)
lastRelation.getProperty("TimeStamp") <= timePoint);
 }
}, GraphRelationshipTypes.KNOWS, Direction.BOTH);
}

Here is my question: when I traverse from node "A", it should traverse to
their relations, based on condition (timePoint). If it is true, it returns
require node. So that means the difference between relation time and system
time is > timePoint.... then it won't returns that node.

I got output based on my input like this:
At depth 1 = B
At depth 2 = D

It is working perfectly....as per the traversal function description, *" The
created traverser will iterate over each node that can be reached from this
node by the spanning tree formed by the given relationship types (with
direction) exactly once. "*
*
*
But I was wondering that.... even "B" node has relationship with "C"... and
their relation time is <= to timePoint but it's not returned because of
traverse function specification.

I am looking for other traverse function that which satisfies above
specification like "B" to "C". Means the traverser function should return C
node also.

So people you may got the point what I am trying to say is? Thanks for
valuable time for reading this. I am waiting for valuable replies.

Thanks,
Gunda.
*
*
_______________________________________________
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to