PyData Global 2024

Aditi Juneja

Hi, I'm Aditi. I've mostly been involved in the API dispatching discussions in the Scientific Python ecosystem. I am currently part of NetworkX's Core Developer team. NetworkX is a Python library with lots of graph algorithms. I've worked on the NetworkX project and the nx-parallel backend, previously as an Independent contractor, a GSoC contributor and a Core Developer. Also, I've presented my work and the NetworkX's dispatching at SciPy Con 2024(poster), at EuroSciPy 2024(talk) and PyCon India 2024(lightening talk). And, I am currently pursuing a bachelor's in Data Science and Application. (Email: [email protected])

Thank you :)


Sessions

12-03
13:00
30min
Understanding API Dispatching in NetworkX
Aditi Juneja

Hi! Have you ever wished your pure Python libraries were faster? Or wanted to fundamentally improve a Python library by rewriting everything in a faster language like C or Rust? Well, wish no more... NetworkX's backend dispatching mechanism redirects your plain old NetworkX function calls to a FASTER implementation present in a separate backend package by leveraging the Python's entry_point specification!

NetworkX is a popular, pure Python library used for graph(aka network) analysis. But when the graph size increases (like a network of everyone in the world), then NetworkX algorithms could take days to solve a simple graph analysis problem. So, to address these performance issues, a backend dispatching mechanism was recently developed. In this talk, we will unveil this dispatching mechanism and its implementation details, and how we can use it just by specifying a backend kwarg like this:

>>> nx.betweenness_centrality(G, backend=“parallel”)

or by passing the backend graph object(type-based dispatching):

>>> H = nxp.ParallelGraph(G)
>>> nx.betweenness_centrality(H)

We'll also go over the limitations of this dispatch mechanism. Then we’ll use the example of nx-parallel backend as a guide to understand various NetworkX backend and backend configuration features.

Finally, I'll conclude with a brief overview of how this API dispatch mechanism could be integrated in an non-graph-related Python libraries, such as an array-based or data-centric libraries, along with the potential challenges that may arise during integration. This will be followed by an interactive Q&A session.

General Track
General Track