title: Neo4j - apoc.algo.dijkstra - shortest path from a to b, but via c, d, e etc
body: <p>Hi I am experimenting with routing using neo4j but I am struggling with adapting apoc.algo.dijkstra. I don’t just want to go from A to B, but actually go from A to B via C, whilst taking into account a weighting on the link.</p>
  
  <p>The A-B query is...</p>
  
  <pre><code>MATCH  (startNode:road_node {id:'59030214550942348742a27d'}), (endNode:road_node {id:'59030215550942348742a610'})
  call apoc.algo.dijkstra(startNode, endNode, 'ROADLINK', 'min_travel_time') YIELD path, weight
  return path, weight/60
  </code></pre>
  
  <p>I tried a few ways of including a via c but can't get it to work... for example</p>
  
  <pre><code>MATCH  (startNode:road_node {id:'59030214550942348742a27d'}), (endNode:road_node {id:'59030215550942348742a610'})
  call apoc.algo.dijkstra(startNode, endNode, 'ROADLINK', 'min_travel_time') 
  with path, weight
  MATCH (startNode)-[*]-(via:road_node {id:'59030215550942348742a666'})-[*]-(endNode)
  return path, weight
  </code></pre>
  
  <p>Any ideas or suggestions on how to route from A to B via C, whilst taking into a count a weighting on the links, would be very helpful.</p>