Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gds.shortestPath.dijkstra.stream not return relationship type #329

Open
johnfercher opened this issue Sep 16, 2024 · 1 comment
Open

gds.shortestPath.dijkstra.stream not return relationship type #329

johnfercher opened this issue Sep 16, 2024 · 1 comment
Labels
feature request A suggestion for a new feature

Comments

@johnfercher
Copy link

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.

Screenshot from 2024-09-15 23-38-59

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

@johnfercher johnfercher added the feature request A suggestion for a new feature label Sep 16, 2024
@vnickolov
Copy link
Contributor

@johnfercher thank you for creating this issue, we have put it in our backlog, however there is no concrete timeline on when it will be available in GDS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request A suggestion for a new feature
Projects
None yet
Development

No branches or pull requests

2 participants