qiboteam / qibolab

Quantum hardware module and drivers for Qibo.
https://qibo.science
Apache License 2.0
41 stars 12 forks source link

Drop `networkx` dependency #760

Closed alecandido closed 1 month ago

alecandido commented 7 months ago

The only usage of networkx is currently in the Platform.topology. https://github.com/qiboteam/qibolab/blob/7056c84f28a7c0191f26b29f71a505b9c1b4cf9a/src/qibolab/platform.py#L113-L114

However, we do not use practically anything of it being a graph (before it was used by the transpiler). I'd rather drop it here, and do the conversion in Qibo (if needed).

The connectivity of course has to be kept, but we could save the adjacency matrix or list. And given that the topology is rather sparse (especially for large chips, where it matters more), I'd simply go for an adjacency list (i.e. a list of pairs of QubitId).

The conversion will be trivial: https://networkx.org/documentation/stable/reference/classes/generated/networkx.Graph.add_edges_from.html#networkx.Graph.add_edges_from