Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
25 lines (19 sloc) 795 Bytes
require 'rubygems'
require 'neography'
@neo =
def suggestions_for(node)
node.incoming(:friends).order("breadth first").uniqueness("node global").filter("position.length() == 2;").depth(2)
johnathan = Neography::Node.create("name" =>'Johnathan')
mark = Neography::Node.create("name" =>'Mark')
phill = Neography::Node.create("name" =>'Phill')
mary = Neography::Node.create("name" =>'Mary')
luke = Neography::Node.create("name" =>'Luke')
johnathan.both(:friends) << mark
mark.both(:friends) << mary
mark.both(:friends) << phill
phill.both(:friends) << mary
phill.both(:friends) << luke
puts "Johnathan should become friends with #{suggestions_for(johnathan).map{|n| }.join(', ')}"
# Johnathan should become friends with Mary, Phill
Something went wrong with that request. Please try again.