Counting INCLUDES in Traversal Framework

5 views
Skip to first unread message

David Dupuis

unread,
Mar 23, 2018, 2:29:45 AM3/23/18
to Neo4j
Hi,

I'm currently coding my own Traverser. The objective is to perform a type of random walk on the graph and count the number of visited nodes.

To code the random walk part I create my own Evaluation function and pruned the graph as desired. 

To count I do the following:

long score = 0;
for (Node currentNode : traversal.traverse( nodeList ).nodes())
{
    score
+= 1;
}

However, this doesn't always work as I would like and I was therefore wondering if there was a way to keep track of how many nodes we INCLUDE in the Evaluation function?

For instance I have a global score variable, and in the Evaluation function before I perform "return INCLUDE_AND_CONTINUE" or "return INCLUDE_AND_PRUNE" I increment score

Thanks,
Reply all
Reply to author
Forward
0 new messages