Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

26 lines (20 sloc) 0.838 kb
require 'rubygems'
require 'neography'
Neography::Config.server = 'neography.org'
@neo = Neography::Rest.new
def suggestions_for(node)
node.incoming(:friends).order("breadth first").uniqueness("node global").filter("position.length() == 2;").depth(2)
end
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| n.name }.join(', ')}"
# RESULT
# Johnathan should become friends with Mary, Phill
Jump to Line
Something went wrong with that request. Please try again.