Does NetworkX intend to add timeout arguments to its graph algorithms?
0 reputation · 19 Jul 2023, 05:15 UTC
NetworkX’s core graph algorithms such as shortest_path and dijkstra_path currently run synchronously and do not accept timeout or cancellation arguments. Users who need a time limit must rely on external mechanisms like concurrent.futures or Unix signals, which introduce portability concerns and risk leaving internal structures in an inconsistent state. The project has an open discussion about adding optional timeout parameters, but no agreement exists on the API shape, implementation strategy, or potential performance impact.
Given these uncertainties, what factors should guide the decision to expose timeout support directly in NetworkX functions? Which design options balance usability, thread‑safety, and backward compatibility? How might a timeout feature be implemented without requiring users to wrap every algorithm call in a separate thread or process?