Skip to content
This repository has been archived by the owner on Apr 22, 2020. It is now read-only.

Write total cost of shortest path to property #912

Open
szarnyasg opened this issue Aug 22, 2019 · 0 comments
Open

Write total cost of shortest path to property #912

szarnyasg opened this issue Aug 22, 2019 · 0 comments

Comments

@szarnyasg
Copy link

szarnyasg commented Aug 22, 2019

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?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant