This repository was archived by the owner on Apr 22, 2020. It is now read-only.
This repository was archived by the owner on Apr 22, 2020. It is now read-only.
Write total cost of shortest path to property #912
Copy link
Copy link
Open
Description
I am using the latest versions (Neo4j 3.5.8, Algorithm library 3.5.8.0).
Given a simple two-node graph:
CREATE ({VID: 1})-[:EDGE {weight: 0.2}]->({VID: 2})
I'd like to run an SSSP algorithm and save the total cost of the paths to property SSSP
.
MATCH (startNode {VID: 1}), (endNode)
CALL algo.shortestPath(startNode, endNode, 'weight', {write: true, writeProperty: 'SSSP', direction: 'OUTGOING'} )
YIELD nodeCount, totalCost, loadMillis, evalMillis, writeMillis
RETURN endNode.VID, totalCost
The results are correct:
╒═════════════╤═══════════════════╕
│"endNode.VID"│"totalCost" │
╞═════════════╪═══════════════════╡
│1 │-1.0 │
├─────────────┼───────────────────┤
│2 │0.20000000298023224│
└─────────────┴───────────────────┘
But the propery contains the traversal level and not the total cost:
MATCH (n)
RETURN n.VID, n.SSSP
╒═══════╤════════╕
│"n.VID"│"n.SSSP"│
╞═══════╪════════╡
│1 │0 │
├───────┼────────┤
│2 │1 │
└───────┴────────┘
Is there a way to write the total cost to the property?
Metadata
Metadata
Assignees
Labels
No labels