Expand description
Weighted shortest path via Dijkstra.
Edge weight is relationship strength (higher = stronger), but shortest
path minimizes distance. We convert with distance = -ln(weight): a
perfect edge (weight 1.0) costs 0, a weak edge costs more, and weight → 0
tends to infinity (the edge becomes impassable). This turns products of
edge strengths along a path into a sum of costs, so a path of two strong
edges can legitimately beat one weak edge — matching the shortestPath
semantics of Neo4j/GDS.
Constants§
- SHORTEST_
PATH_ W_ MIN - Edge weights at or below this are treated as impassable (infinite distance).
Functions§
- dijkstra
- Dijkstra from
src, returning(node_index, distance)for every reachable node, sorted by distance ascending.srcitself appears with distance 0.0. - shortest_
path - Cheapest path from
srctodstas a node-index sequence, orNoneif unreachable (or either endpoint is out of range). - shortest_
path_ ids - Build a CSR snapshot from
connand resolve a path between two node IDs.