Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
02-14-2021 07:56 AM
Hi all, I am using apoc procedures to perform a breadth first search but I think I have not quite gotten the syntax right.
I have my database of dependencies loaded and as an example if I execute this cypher
match (n:Node)-[:Depends_On]->(e:Node) where n.name = "BankAccount" return n, e
I get my expected results that shows my everything that is dependent on 'BankAccount'
Now I am trying to execute a breadth first search and I want to start at 'BankAccount' and get all the immediate dependencies on 'BankAccount' AND I then want to get ALL of the dependents dependencies as well until there are no more dependencies.
I have managed to come up with this cypher so far
MATCH (n:Node)
WHERE n.name = 'BankAccount'
CALL apoc.path.expandConfig(n,{relationshipFilter:"Depends_On",maxLevel:1,uniqueness:"NODE_GLOBAL"}) YIELD path
WITH n, RELATIONSHIPS(path) as r, LAST(NODES(path)) as es
WHERE es:Node
RETURN n,es,r
but this is not returning the results as I might have expected, I am actually getting the following
I am maybe misunderstanding something but this doesn't look right to me as the relationship arrows all seem to be pointing inwards towards my starting node 'BankAccount'. I am thinking that this should look like my first image but with the addition of all the depenendent dependencies shown also?
Can anyone see what I am doing wrong here?
02-14-2021 11:40 AM
Try this with no relationship filter:
MATCH (n:Node)
WHERE n.name = 'BankAccount'
CALL apoc.path.expandConfig(n,{maxLevel:1,uniqueness:"NODE_GLOBAL"}) YIELD path
RETURN path
02-14-2021 02:29 PM
For those who are following at home, the documentation for version 4.1 seems pretty good with examples (I haven't worked through it yet, so I can't say how good it really is.)
However, the documentation for 4.2 is next to useless, without detailed explanation of the config and no examples, The 4.2 doc needs to be updated:
02-14-2021 03:17 PM
V 4.2 doc .
At the bottom of the page there is a link to go to next page:
More documentation of apoc.path.expandConfig
and there you can see all the info including examples.
All the sessions of the conference are now available online