Closed tomasonjo closed 2 years ago
If you add a defaultValue
to your relationship projection, does that fix the issue?
CALL gds.graph.project(
'test',
'Stop',
{
TRAM: { properties: { duration: { defaultValue: 0 }}},
WALK: { properties: { duration: { defaultValue: 0 }}}
}
)
In general, we like to not validate every property value during algorithm execution, since this inhibits performance. Of course, in case GDS is the source of the NaN
we would have to check for it.
Ok, I get it. Just a behavior I noticed, how you handle it is up to you :)
Closing for now
@tomasonjo I appreciate very much that you created the issue! Maybe a default default value of 0
would be more useful than default default of NaN
.
@tomasonjo It seems as though this may be a bug anyway. We will investigate more thoroughly.
I investigated it and came to the conclusion that Dijkstra behaves exactly as expected. The problem is - as Mats already pointed out - the default value for the WALK
relationship. Using relationshipProperties
in the project procedure, is shorthand for saying "all projected relationship types have that property and the default value is NaN`.
If the relationship projection would be written as
{
TRAM: { properties: { duration: { defaultValue: 0 }}},
WALK: { }
}
the in-memory graph would have no property assigned to the WALK
relationship, which - when executing Dijkstra - would trigger the algorithm specific fallback value of 1.0
.
Hope this clarifies things.
the in-memory graph would have no property assigned to the WALK relationship, which - when executing Dijkstra - would trigger the algorithm specific fallback value of 1.0
Perhaps adding this line to the docs would make sense
I agree. We're discussing to either make it more prominent in the docs or to change the behaviour of relationshipProperties
to only make it available for relationship types that actually have that property. Wdyt?
When a user has multiple relationship types in their shortest path, the engine doesn't recognize that all relationship types need to have the particular relationship weight.
Using GDS 2.0.1
Create graph:
Project a graph
Run Dijkstra shortest path:
Results
You can observer the NaN values. I think it would be preferred to omit users to be able to return shortest paths with NaN values for cost.