iduedu.ShortestPathResult¶
- class iduedu.ShortestPathResult(distances, path_store, *, path_storage='eager', nearest_sources=None)[source]¶
Distances and paths from the same Dijkstra searches.
distancesis a sparse pandas Series or DataFrame, a NumPy array, or a SciPy CSR array, depending ondistance_format. Array positions match the pandas path table, with one distance per row for one-dimensional arrays. Accessingpathscreates and caches the path table. Withpath_storage="lazy", useget_pathto reconstruct individual routes without materializing that table or rerunning Dijkstra. Results retain a snapshot of node ids and predecessors, so later graph edits do not change the saved routes.For single-source and nearest-source results, call
get_path(target). For matrices and pairwise results, callget_path(origin, destination)using the result labels (object labels when object tables were supplied). Duplicate labels require positional access throughget_path_at.- Parameters:
path_store (_PathStore)
- distances¶
Shortest costs in the selected weight units.
- nearest_sources¶
A pandas Series of winning graph node ids for a nearest-source search, in distance order for every format. Unreachable targets have a None owner. Other searches set this to None.
Methods
Return one route by labels, or None if it is unreachable or beyond cutoff.
Return a route by zero-based table positions (also supports duplicate labels).
- property paths: Series | DataFrame¶
Materialize and cache the sparse path table, without another search.