Sha256: aefcaebba32f3104499e7ceb36b9f4ac52e5524f1f57f619582c1d42b75d66b1

Contents?: true

Size: 701 Bytes

Versions: 3

Compression:

Stored size: 701 Bytes

Contents

require 'rubygems'
require 'neo4j-core'


def connect(d)
  d.each{|i| Neo4j::Relationship.new(:flies_to, i[:from], i[:to])}
end

puts "Using #{Neo4j::Core::VERSION}"

tx = Neo4j::Transaction.new
@a, @b, @c, @z = (1..4).map{Neo4j::Node.new}
connect([ {:from=>@a, :to=>@b}, {:from=>@a, :to=>@c},  {:from=>@b, :to=>@c},
          {:from=>@b, :to=>@z}, {:from=>@c, :to=>@b},  {:from=>@c, :to=>@z}])
tx.success
tx.finish


traversal = @a.outgoing(:flies_to).depth(:all).eval_paths { |path|  :include_and_continue }

# This prints out
#Path (1)--[flies_to,0]-->(2)
#Path (1)--[flies_to,1]-->(3)
#Path (1)--[flies_to,0]-->(2)--[flies_to,3]-->(4)
traversal.paths.each do |path|
  puts "Path #{path.to_s}"
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
neo4j-core-2.0.1-java lib/test.rb~
neo4j-core-2.0.0-java lib/test.rb~
neo4j-core-2.0.0.rc2-java lib/test.rb~