I have the following graph with Stop
(red) and Connection
(green) nodes.
I want to find the shortest path from A
to C
using a cost property on Connection
.
I would like to avoid making Connection
a relationship because than I loose the CONTAINS
relationship of Foo
.
I can match a single hop like this
MATCH p=(:Stop {name:'A'})<-[:BEGINS_AT]-(:Connection)-[:ENDS_AT]->(:Stop {name:'B'}) RETURN p
but this does not work with an arbitrary number of Connection
s like it would with relationships and [*]
.
I also tried to make a projection down to simple relationships but it seems like I cannot do something with this without GDS.
MATCH (s1:Stop)<-[:BEGINS_AT]-(c:Connection)-[:ENDS_AT]->(s2:Stop) RETURN id(s1) AS source, id(s2) AS target, c.cost AS cost
Note that the connection is unidirectional, so it must not be possible to go from C
to A
.
Is there a way to do this without any Neo4j plugins?