I'm playing with py2neo and now the I'm looking for the most convenient manner to find all children of a specific node using recursion.
What I'm looking for is the following idea:
MATCH (:LabelA {id:"C"})-[:to*]->(m:LabelA) RETURN n;
This is what it would look like in cypher. I know this query can be run with graph.run() and by passing this query. But I was wondering if somebody knows if it is possible using the graph.match() code?
Finding the first node is possible with:
sNode = graph.nodes.match(id="C").first()
firstNode = graph.match((sNode, ), r_type="to")
and I'm hoping there is a construct such as (I tried this and this does not work :) ):
sNode = graph.nodes.match(id="C").first()
nodesFound = graph.match((sNode, ), r_type="to*")
#do something with nodesFound
that would return all recursively found nodes in a list or so.
Does anyone have experience with this?
There is no way to do this with the matchers. You'll have to use Cypher.