Skip to content

Commit

Permalink
easier way to do friend suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
maxdemarzi committed Nov 21, 2010
1 parent 34068ab commit 9dce8b7
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions examples/facebook.rb
Expand Up @@ -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')
Expand Down

0 comments on commit 9dce8b7

Please sign in to comment.