Here is the scenario: I have graph with a series of documents that reference each other with directed relationships. A given document may reference parents, grandparents, and or great-grandparents. What I am interested in is reducing the graph to bare essence to so that the reference node relationships go through the tree structure. I am looking to pare down the relationships to highlight the the flow through the documents.
For example if a start with this.
My hand trimming reveals this:
Is there a generic cypher strategy to reveal this pattern from the original. I have date properties and document serial numbers as property keys to assist.
How would I go about writing this?
I am not sure if I understood what you wanted to achieve, and I didn't test the query myself, so better test it on a backup first. But maybe you can alter that query to get exactly what you want. Another alternative, yielding a different result, might be:
MATCH (d1:Document)-[c1:CITES]->(:Document)-[c2:CITES]->(d3:Document)<-[:CITES]-(d1) DELETE c1, c2