From 9dce8b7626715cd8ba9fe8ee6b758d4d16193db0 Mon Sep 17 00:00:00 2001 From: maxdemarzi Date: Sun, 21 Nov 2010 15:55:20 -0800 Subject: [PATCH] easier way to do friend suggestions --- examples/facebook.rb | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/examples/facebook.rb b/examples/facebook.rb index c9069e4..55f930e 100644 --- a/examples/facebook.rb +++ b/examples/facebook.rb @@ -13,16 +13,13 @@ def make_mutual_friends(node1, node2) end def suggestions_for(node) - existing_friends = @neo.traverse(node,"nodes", {"order" => "breadth first", - "uniqueness" => "node global", - "relationships" => {"type"=> "friends", "direction" => "in"}, - "depth" => 1}) - - possible_friends = @neo.traverse(node,"nodes", {"order" => "breadth first", - "uniqueness" => "node global", - "relationships" => {"type"=> "friends", "direction" => "in"}, - "depth" => 2}) - possible_friends - existing_friends + @neo.traverse(node,"nodes", {"order" => "breadth first", + "uniqueness" => "node global", + "relationships" => {"type"=> "friends", "direction" => "in"}, + "return filter" => { + "language" => "javascript", + "body" => "position.length() == 2;"}, + "depth" => 2}) end johnathan = create_person('Johnathan')