Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
05-07-2021 01:15 AM
Hello,
I have this two request with apoc :
CALL apoc.path.expandConfig(start, {
relationshipFilter: "A|B>",
labelFilter: "-C",
maxLevel: 6,
minLevel: 1,
uniqueness: 'NODE_PATH',
endNodes:[end]}) YIELD path
RETURN path;
it work perfectly but i have a case that the start and end is the same node.
what i want is to return the node in this case, is it possible ? i tried minLevel:0 but it doesn't return the node
I have an another possibility :
MATCH (from), (to)
CALL apoc.algo.allSimplePaths(from, to, 'A|B>', 10)
YIELD path
RETURN path
This one work good, even with the case of from = to but i cannot filter the labels node like the first request (labelFilter: "-C").
My question is :
how can i get the only for the first request the start node if the start = end,
or, for the seconde how i can filter the labels ?
Thank you
05-07-2021 06:20 AM
to resolve this i use :
CALL apoc.path.expandConfig(start, {
relationshipFilter: "A|B>",
labelFilter: "-C",
maxLevel: 6,
minLevel: 1,
uniqueness: 'NODE_PATH',
endNodes:[end]}) YIELD path
WITH path, start
unwind CASE WHEN length(path) IS NULL THEN [start] ELSE nodes(path) END as n
...
i don't know if we can configure apoc.path.expandConfig to return simple node
05-15-2021 02:14 PM
06-01-2021 06:23 AM
simple node means that the start and the end nodes are the same
06-01-2021 10:27 AM
To answer your first question on apoc.path.expandConfig()
, filtering isn't applied to start nodes by default, which is why your start node isn't returned as a result. You can toggle this on by adding filterStartNode:true
in the config parameter map.
The documentation on that one could use an update. It specifically mentions label filters, and those predated the node filters (where we pass in the endNodes or terminatorNodes). Though not mentioned, the filterStarNode
config property also applies to them.
All the sessions of the conference are now available online