The order method indeed does decide what order the graph is traversed, you can either use it with the predefined traversal orders like so:
td.order(CommonBranchOrdering.PREORDER_DEPTH_FIRST) or you can pass it your own branch selector implementation, see https://github.com/neo4j/community/blob/master/kernel/src/main/java/org/neo4j/kernel/PreorderDepthFirstSelector.javafor an example. An easier way to include weights would be to make the traversal only follow LIKES relationships that are over a certain weight threshold. You can also process the weights outside of the traversal entirely. For instance, you can calculate the average weight for each path returned by the traversal, sort the result by that, and only return the top results. /jake On Thu, Jun 23, 2011 at 8:30 AM, Igor Dovgiy <[email protected]> wrote: > Hi all, > > I'm trying to implement a recommendations system app with Neo4j (1.4). > Basically, I intend to have some 'User' nodes and some 'Interest' nodes in > my graph. Then, to find users with similar interests, traverse it by > something like... > > TraversalDescription td = new Traversal.description() > .relationships(RelTypes.LIKES) > .evaluator(Evaluators.atDepth(2)); > > The real question is, though, whether I'll be able to choose what Interest > nodes to walk through first, depending on their weights (i.e., number of > users linked to them)? As I understand, the order() method is designed > right > for this case, but sadly I was unable to find examples of its usage... > > Any help will be greatly appreciated! > > -- iD > _______________________________________________ > Neo4j mailing list > [email protected] > https://lists.neo4j.org/mailman/listinfo/user > -- Jacob Hansson Phone: +46 (0) 763503395 Twitter: @jakewins _______________________________________________ Neo4j mailing list [email protected] https://lists.neo4j.org/mailman/listinfo/user

