79721093

Date: 2025-07-31 09:48:49
Score: 0.5
Natty:
Report link

I think it is as simple as adding both "ownership paths" together. To help understand the query, I also created as small graph + drawing.

// create example graph
CREATE (:starting)-[:OWNS {p: 0.5}]->(a:node)-[:OWNS {p: 0.8}]->(:node)-[:OWNS {p: 0.4}]->(c:node)-[:OWNS {p: 0.8}]->(:target),
(a)-[:OWNS {p: 0.3}]->(c)

// query it
match p = (:starting)-[:OWNS]->{1,10}(:target)
with p, reduce( acc = 1.0, x in relationships(p) | acc*x.p ) as pct
return sum(pct) as total_ownership

// result
╒═══════════════════╕
│total_ownership    │
╞═══════════════════╡
│0.24800000000000003│
└───────────────────┘

enter image description here

Reasons:
  • Probably link only (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Håkan Löfqvist