MATCH (a:Artifact{gav:'org.slf4j:slf4j-api:1.6.1'})
WITH id(a) AS startNode
CALL gds.alpha.dfs.stream('myGraph', {startNode: startNode})
YIELD path
UNWIND [ n in nodes(path) | n.gav ] AS tags
RETURN tags
ORDER BY tags
A further question about this cypher:
Can I set the direction of the relationship in this cypher?
What I want to know is all the project depend on this particular artifact (e.g. Artifact{gav:'org.slf4j:slf4j-api:1.6.1'}) using DFS algorithm. After I got the result, I want to see the does the result include the released project belong to our company( for exmaple, project A, B are directly or indirectly depending on 'org.slf4j:slf4j-api:1.6.1', but project C doesn't ). Finding all the released projects (as parameters) depending on this artifact as the termination condition , return project A and B's GAV information.
MATCH (a:Artifact {gav:'org.slf4j:slf4j-api:1.6.1'})
WITH id(a) AS startNode
CALL gds.alpha.dfs.stream('myGraph', {endNode: startNode})
YIELD path
UNWIND [ n in nodes(path) | n.gav ] AS tags
RETURN tags
ORDER BY tags
I tried this cypher but the performance is too bad when the result subgraph is too big match (sss) -[:DEPEND_ON]->(a:Artifact{gav:"org.slf4j:slf4j-api:1.6.1"}) where sss<>a return distinct sss
I also tried this cypher: MATCH (a:Artifact{gav:'org.slf4j:slf4j-api:1.6.1'}), (d:Artifact{gav:'org.wso2.carbon.identity.framework:org.wso2.carbon.identity.core:5.12.150'}) WITH id(a) AS startNode, id(d) AS targetNode CALL gds.alpha.dfs.stream('myGraph', {startNode: startNode, targetNode: targetNode}) YIELD path UNWIND [ n in nodes(path)] AS tags RETURN tags ORDER BY tags
It only showed the node itself.