Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
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
@szarnyasg

Description

@szarnyasg
Issue body actions

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.