The Neo4j Data Graph Science library has an Shortest Path algorithm (https://neo4j.com/docs/graph-data-science/current/alpha-algorithms/shortest-path/). The following sequence is the example algorithm which works for my project:
MATCH (start:Loc {name: 'A'}), (end:Loc {name: 'F'})
CALL gds.alpha.shortestPath.stream({
nodeProjection: 'Loc',
relationshipProjection: {
ROAD: {
type: 'ROAD',
properties: 'cost',
orientation: 'UNDIRECTED'
}
},
startNode: start,
endNode: end,
relationshipWeightProperty: 'cost'
})
YIELD nodeId, cost
RETURN gds.util.asNode(nodeId).name AS name, cost
The problem is that the graph has to be filtered before finding the shortest path. Every node has an attribute called currentWeather and every node with currentWeather = "good" is a valid node for the shortest path.
Is it possible to use e.g. the nodeProperties to filter for currentWeather = "good"?
And if that does not work, how would you create a subgraph or filter for nodes with currentWeather = "good"?
Many thanks in advance
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…