gds.shortestPath.dijkstra.stream not return relationship type #329
Open
Description
Is your feature request related to a problem? Please describe.
I have a graph with multiple edge types and I need to retrieve the shortest path having the edge type of each one. I'm trying to execute the follow query:
MATCH (source:City {id: 'natal'}), (target:City {id: 'pelotas'})
CALL gds.shortestPath.dijkstra.stream('projection', {
sourceNode: source,
targetNodes: target,
relationshipWeightProperty: 'distance_km'
})
YIELD index, sourceNode, targetNode, totalCost, nodeIds, costs, path
RETURN
index,
gds.util.asNode(sourceNode).name AS sourceNodeName,
gds.util.asNode(targetNode).name AS targetNodeName,
totalCost,
[nodeId IN nodeIds | gds.util.asNode(nodeId).name] AS nodeNames,
costs,
nodes(path) as path
ORDER BY index
It works, but I don´t know how to retrieve the relationship types. Executing this query in localhost:7474
if return edge types, but the text don't.
I didn't find a way to retrieve this info using the documentation. This is my projection.
MATCH (a:City)-[r]->(b:City)
RETURN gds.graph.project(
'projection',
a,
b,
{
relationshipProperties: r { .distance_km },
relationshipType: type(r)
}
)
Describe the solution you would like
I would like a way to retrieve the relationship type as I retrieve the costs. Example, by adding a type after path.
MATCH (source:City {id: 'natal'}), (target:City {id: 'pelotas'})
CALL gds.shortestPath.dijkstra.stream('projection', {
sourceNode: source,
targetNodes: target,
relationshipWeightProperty: 'distance_km'
})
YIELD index, sourceNode, targetNode, totalCost, nodeIds, costs, path, relationshipType
RETURN
index,
gds.util.asNode(sourceNode).name AS sourceNodeName,
gds.util.asNode(targetNode).name AS targetNodeName,
totalCost,
[nodeId IN nodeIds | gds.util.asNode(nodeId).name] AS nodeNames,
costs,
nodes(path) as path,
relationshipType
ORDER BY index
Describe alternatives you have considered
Additional context