Satchel
Satchel

Reputation: 16734

how do I find related nodes given a node using Neography in neo4j?

The documentation doesn't seem to work as expected.

node
#<Neography::Node>>

node.outgoing
#<Neography::NodeTraverser:0x007f5981427f20

I just want to get the nodes for a given relationship, but it's unclear based on the current documentation:

https://github.com/maxdemarzi/neography

Upvotes: 0

Views: 26

Answers (1)

Max De Marzi
Max De Marzi

Reputation: 1108

That syntax builds a traversal description until you are ready to .each it:

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

Upvotes: 0

Related Questions