Search code examples
memgraphdbopencyphermemgraph

MemgraphDB: Why is the different line used in query result?


My first query is MATCH path=(s1:Station {name: "Uhlandstraße"})-[:CONNECTED_VIA *WSHORTEST (r, n | r.time)]-(s2:Station {name: "Kurfürstenstraße"}) RETURN path; and second one is MATCH path=(s1:Station {name: "Nollendorfplatz"})-[:CONNECTED_VIA]-(s2:Station {name: "Kurfürstenstraße"}) RETURN path;.

I can see that there are three lines between Nollendorfplatz and Kurfürstenstraße. Why does WSHORTEST algorithm jump to another line and it does't stay on "green" line?

My data sets are located in CSV files, one for stations and another one for lines.

My results


Solution

  • You're using the weighted shortest algorithm, and for the final leg of your journey, U5 has the shortest time. Nothing in your query constrains the path expansions to only follow edges with the same value for property line.