Is your feature request related to a problem? Please describe.
get_path_length_to_station() in edisgo/tools/tools.py uses len(path) - 1 to calculate the distance from each bus to the station. This returns the number of edges (hops) in the shortest path, not the actual cable distance in km. As a result, a bus behind 2 long cables (e.g. 2 × 10 km) appears "closer" than one behind 5 short cables (e.g. 5 × 100 m), which is misleading when you need to identify the electrically most remote bus.
Describe the solution you'd like
Use nx.shortest_path_length(graph, source, target, weight="length") instead of counting nodes in the path. The graph edges already carry a length attribute (populated from lines_df), so the data is there — it just isn't being used. For LV buses, the MV cable distance to the respective LV station should be added on top of the LV path length.
Describe alternatives you've considered
- Using impedance (R + X from line parameters) as the weight instead of physical length, which would better reflect electrical distance. However, this would require additional data and
length is a good enough proxy for most use cases.
- A separate function rather than changing the existing one, to avoid breaking downstream code that relies on hop counts.
Is your feature request related to a problem? Please describe.
get_path_length_to_station()inedisgo/tools/tools.pyuseslen(path) - 1to calculate the distance from each bus to the station. This returns the number of edges (hops) in the shortest path, not the actual cable distance in km. As a result, a bus behind 2 long cables (e.g. 2 × 10 km) appears "closer" than one behind 5 short cables (e.g. 5 × 100 m), which is misleading when you need to identify the electrically most remote bus.Describe the solution you'd like
Use
nx.shortest_path_length(graph, source, target, weight="length")instead of counting nodes in the path. The graph edges already carry alengthattribute (populated fromlines_df), so the data is there — it just isn't being used. For LV buses, the MV cable distance to the respective LV station should be added on top of the LV path length.Describe alternatives you've considered
lengthis a good enough proxy for most use cases.