I have the following graph
I try to model the above graph in Neo4j such that for any duplicate node (say A), a property 'count' on the node is incremented to reflect the number of occurrences of A. Similarly, for any duplicate relationship (say A->B), a property 'frequency' is updated.
A Neo4j console for the graph is implemented here.
I modeled the graph in the above way keeping in mind that I could track the number of occurrences of each node and each individual transitions.
The next part of my requirement is to track all 3-nodes path and this is the query I issue, the output of which is visible in the Neo4j console -
MATCH (n)-[]->(m)-[]->(p) return n.name+' - '+m.name+' - '+p.name as NewName
However, the output I would like to have is -
A - B - C
B - D - A
D - A - B
B - D - E
E - B - C
D - E - B
A - B - D
But since the nodes and relationship are unique, one additional combination is also reported.
E - B - D
QUESTIONS
What would I need to change in the graph setup/query so as to report only the 7 listed combinations instead of the 8 combinations?
Is there a way to also count the frequency of such 3-nodes path?
I am fine creating multiple CYPHER scripts to achieve this. That being said, the CYPHER scripts are auto - generated as part of a bigger workflow and I would like to avoid manually typing the n-nodes path(s) and its frequency.
