hello, I have created a little traveling line for the bus like following

I want to get the shortest time path between "start" and "fin" with the function reduce, I hope to calculate the sum of running time(temps), and when it changes the bus, we add the time of Changement(att),temps and att are parameters in relationships.

the following is the code I want to realize

match (a:station {name:"start"}),(b:station{name:"fin"}),

p=((a)-[*]->(b))

with p,

reduce(s=0,r in relationships(p) #and ln=type(relationship(p))# (I know it's incorrect| case type(r) when ln then s+r.temps else s+r.temps+r.att and ln=type(r) end)AS temps

return p, temps order by temps asc limit 1

Is it possible to add another variable like ln in function reduce to realize it or is there another solution?

Thank you