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

27 views Asked by At

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

1

There are 1 answers

0
Max De Marzi On

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