NetworkX is a Python library for building and analysing networks. It’s used extensively as a basis for simulation, notably for simulating the spread of epidemic across populations.

We used NetworkX as a basis for epydemic, our epidemic spreading library. This is great for building larger systems, but there’s a problem for the science. Because NetworkX is a pure Python library it’s relatively slow — around 20 times the speed of native C. More importantly, it’s big, and this restricts our ability to do things like make use of Cython and numba to run epydemic in parallel, on GPUs, and so forth.

One solution to this problem is to build a “micro-NetworkX” that would provide exactly the features we need for simulation, but in a way that’s optimised for speed. There are several ways we could do this, while maintaining the parts of the API that we use so that we can swap-in the optimised version without too many implications. The goal of this project is to write uNetworkX and explore how it can be used to speed-up the existing Python codes that we have. This might lead to more work in changing epydemic to optimise the two libraries together.

This project would suit someone with an interest in high-performance scientific computing.



  • Determine the core functionality of NetworkX needed by applications
  • Design a high-performance implemnetation of this core
  • Evaluate speedup and flexibility on different underlying architectures
  • Develop verification tests to ensure compatibility
  • Integrate into existing scientific codes


Simon Dobson. Epidemic modelling – Some notes, maths, and code. Independent Publishing Network, 2020. ISBN 978-183853-565-0. URL: https://www.amazon.co.uk/dp/1838535659/.

epydemic documentation.