NetworkX + NumPy: Optional dependency impact on dense graph performance
0 reputation · 08 Nov 2020, 02:59 UTC
Goal
Assess how NetworkX’s optional NumPy dependency affects reproducibility and performance in dense‑graph workloads.
Context
NetworkX advertises NumPy and SciPy as optional accelerators. When NumPy is absent, functions such as adjacency_matrix fall back to Python lists, altering memory usage and execution time. This dual path can mask performance regressions in CI environments that omit NumPy to keep images minimal.
Uncertainty
It is unclear whether making NumPy a hard requirement for all algorithms would improve reproducibility without breaking minimal‑container workflows, or whether the current optional model is preferable.
Questions
- Should NetworkX enforce NumPy as a mandatory dependency for all graph algorithms to guarantee consistent performance and behavior?
- If NumPy remains optional, what mechanisms can be introduced to document and detect divergent runtime paths across environments?
- What version constraints or fallback strategies should be specified to avoid subtle bugs when older NumPy releases are present?