title: Cypher (Neo4j), how to sum a given property through a full path
body: <p>I have been struggling to find a solution to my issue with Cypher..
  I am trying to sum a given relationship throughout a path.</p>
  
  <p>For example:
      1 --> 2 --> 3
              --> 4
  I want to calculate for node 1 the sum of Amount property for nodes 1,2 3 and 4. (In that case 3 and 4 are both targets of node 2, which i cant manage to represent here)</p>
  
  <p>My understanding is I need to be using collect() and reduce but I still do not get the right answer. I have the following:</p>
  
  <pre><code>MATCH (n)-[p]-&gt;(m)
  WITH m,n, collect(m) AS amounts
  RETURN n.ID as Source,m.ID as Target,n.Amount, 
  REDUCE(total = 0, tot IN amounts | total + tot.Amount) AS totalEUR
  ORDER BY total DESC
  </code></pre>
  
  <p>I get a syntax error, but I am pretty sure even without the syntax error that i will only be summing direct relationships...</p>
  
  <p>Would you guys know if I am on the right path?</p>
  
  <p>Cheers
  Max</p>