Neo4J: How to find all the paths starting from node till the first node with certain label

Viewed 37

hope you can help me with this, so basically I'm looking for a way to Find all paths till the first node of certain label (the query should explore all the paths from a node and stop when a node with a specific label is found).

I have two labels (A and B)

let us say we have the following connectivity

A1>B1>B2>A2>B6>A6
A1>A4>A5 
A1>B3>A3>B8>A7

i want to know how can i return path starting from A1 till the first node of label A only therefore the output should be like this:

A1>B1>B2>A2
A1>A4
A1>B3>A3

screenshot of the graph is below enter image description here

what im looking for as a result should be like the below enter image description here

thanks in advance

1 Answers
Related