Skip to content
This repository
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 22 lines (17 sloc) 0.674 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
require 'rubygems'
require 'neography'

@neo = Neography::Rest.new

johnathan = Neography::Node.create("name" =>'Johnathan')
mark = Neography::Node.create("name" =>'Mark')
phill = Neography::Node.create("name" =>'Phill')
mary = Neography::Node.create("name" =>'Mary')

johnathan.both(:friends) << mark
mark.both(:friends) << phill
phill.both(:friends) << mary
mark.both(:friends) << mary

johnathan.all_simple_paths_to(mary).incoming(:friends).depth(4).nodes.each do |node|
  puts node.map{|n| n.name }.join(' => friends => ')
end

# RESULT
# Johnathan => friends => Mark => friends => Phill => friends => Mary
# Johnathan => friends => Mark => friends => Mary
Something went wrong with that request. Please try again.