Given a graph via "contains" I have the following:
- D contains LibD
- C contains LibC and D
- B contains LibB and D
- A contains LibA, B, and C
Using:
FOR v,e,p IN 1..50 INBOUND 'pmconfig/899018092734' pm_content RETURN p.vertices
I get the following paths:
- A->B->LibB
- A->B->D->LibD
- A->B->D
- A->B
- A->LibA
- A->C->LibC
- A->C->D->LibD
- A->C->D
- A->C
I'd like to filter out intermediate points so I get:
- A->B->LibB
- A->B->D->LibD
- A->LibA
- A->C->LibC
- A->C->D->LibD
If the LibX elements were leafs, I could add a filter like
FILTER LENGTH(EDGES(pm_content,v._id,'inbound'))==0
But suppose I had one path: A->B->C->D->B
In this case I would filter everything out. What I would like to have is A->B->C->D since the walk should stop when it recognizes a cycle.
How can I construct a filter that removes intermediate points? Specifically, only those that end with a leaf node or all content links point to vertex that were already traversed.