last day (34 days later) » 

1:20 PM
0
A: Neo4j returning duplicate nodes while traversing

František HartmanThis is because you can get to your result through multiple paths in your data. If you want unique results you can use DISTINCT keyword inside the collect function: MATCH (s3:SEG3{name:'Engineering'})-[:MAP_TO]->(ANODE:Package{name:'A'}), (s4:SEG4{name:'Currency'})-[:MAP_TO]->(ANODE), (GG)-[...

 
Thanks for the response. Will my result set is according to the dependency. ? If you see my dependency relation Z->A ,I->A O->I,I->Z . It means Z needs to be processed before I. so result should be [A Z I O]
I tried your query the response is ["A", "I", "O", "Z"] But expected is ["A","Z", "I", "O"]
 
You need to describe the rule for that better, e.g why is it not A I Z O? Note that you have direct link from A to I in your data.
 
I agree A has direct link to I . As A->Z ,A->I but I->Z so Z needs to be processed. How to define the rule so that i get in correct order. ?
 
But what is the correct order? Please update your question with explanation for the order you want.
 
The correct order i want is ["A","Z", "I", "O"] that i mentioned in question already.
 
1:20 PM
There are 2 paths for (GG)-[:DEPENDS_ON*0..]->(ANODE) : A,Z,I,O and A,I,O. You need to describe how you get the result you want from these 2 paths. Otherwise the solution may not work in other cases.
hi
 
The use case is similar to cell dependency in excel. If you want to compute a value in cell first all dependent cells values needs to be calculated .How i can achieve this? As i already established relationships between nodes. How to get the resultant value accordingly.
 
So you want breadth first order?
Both A,Z,I,O and A,I,Z,O are correct results?
ah no I see the point, ok
 
A,I,Z,O is not correct because I is dependent on Z
 
1:37 PM
MATCH (s3:SEG3{name:'Engineering'})-[:MAP_TO]->(ANODE:Package{name:'A'}),
(s4:SEG4{name:'Currency'})-[:MAP_TO]->(ANODE),
p=(GG)-[:DEPENDS_ON*0..]->(ANODE)
WITH GG.name as name,max(length(p)) as l
ORDER BY l
RETURN collect(name)
I have updated the answer
 
Thanks a lot. I have got the expected answer. What happens when if i have cycles in the graph?
 
2:38 PM
Per path per MATCH, there is a property in Cypher such that relationships must be unique. If a path has already traversed a relationship once, it will not traverse it again. You won't encounter infinite loops.
 
 
1 hour later…
4:02 PM
How i can use the path per Match property? Is there any reference i can read?
 

  last day (34 days later) »