Does Neo4j provide a native query method to search and count all the descendants of a node for a specified relationship type such as REFERRED? I'm trying to build a system to record 'A referred B' type of relationships for each referral. It's required to real time count all the references from A down to the bottom which was caused by A. The picture might look like this:
A
/ \
B C
/ \ /\
D E F G
/ \ / \ \
M N O P Q
ANY suggestion please?
Thanks!
You can use the the Cypher query language to investigate Neo4j graphs; and certainly with Cypher you can construct a query to give you the answer to your question.
Assuming for your question the A node has an id property of uid='A'and the relationship type is 'Referred' then the query could look like:
Here the first part
indicates a starting point for your query. The Second part
describes which relations to follow. The next part
names the terminating nodes for your query and lastly
returns a count of those nodes.