Hello,
I want to expand all paths from a starting node, but exclude certain relationships for specific labels. Is this possible?
Here is an example:
Query to recreate the graph
MERGE (startFile:File {name: "StartFile"})
MERGE (file2:File {name: "File2"})
MERGE (file3:File {name: "File3"})
MERGE (sql1:SQL {name: "SQL1"})
MERGE (sql2:SQL {name: "SQL2"})
MERGE (script:Script {name: "Script"})
MERGE (startFile)<-[:WRITES]-(sql1) //should not be excluded
MERGE (sql1)<-[:READS]-(file2)
MERGE (sql1)-[:WRITES]->(file3)
MERGE (sql2)<-[:READS]-(startFile)
MERGE (script)-[:CONTAINS]->(sql1)
MERGE (script)<-[:READS]-(file2)
MERGE (script)-[:WRITES]->(file3)
This graph contains File, SQL, and Script nodes. I want to expand all paths from StartFile, excluding these relationships:
(:File)-[:READS]->()
(:SQL)-[:WRITES]->()
(:Script)-[:WRITES]->()
(:Script)-[:READS]->()
This is my current approach, which returns all nodes:
MATCH (start:File {name: 'StartFile'})
WITH start
CALL apoc.path.expandConfig(
start,
{ minLevel:1,
maxLevel:5,
uniqueness:'RELATIONSHIP_PATH',
bfs:true } )
YIELD path
RETURN path
So far, I have only found ways to exclude either labels or relationships. But no way to exclude relationships for specific labels.
Any help would be greatly appreciated!