Qiskit / rustworkx

A high performance Python graph library implemented in Rust.
https://www.rustworkx.org
Apache License 2.0
1.11k stars 151 forks source link

Expand Generators Module #150

Open mtreinish opened 4 years ago

mtreinish commented 4 years ago

What is the expected enhancement?

In #121 we added a new module for graph generators which will create graphs of with a certain layout easily. #121 only added a few different types of graphs with the intention of adding more in the future. We should add more generators to the graph to offer more options for quickly creating graphs. Networkx has a long list of generators that can be used for inspiration on different types of generators to add:

https://networkx.github.io/documentation/stable/reference/generators.html

Also, specifically for a qiskit use case we should make sure that we have generators to cover ~qiskit.transpiler.CouplingMap.from_line, qiskit.transpiler.CouplingMap.from_ring, qiskit.transpiler.CouplingMap.from_grid, and qiskit.transpiler.CouplingMap.from_full~ (this was handled by #191)

mtreinish commented 3 years ago

Some generators that would be useful to do as part of this would be to add generators for some layouts that are used for error correction codes like heavy hex and heavy square. (see: https://journals.aps.org/prx/abstract/10.1103/PhysRevX.10.011022 ).

nahumsa commented 3 years ago

I will work on the heavy hex generator.

mtreinish commented 3 years ago

There has been a lot of good work here since this was initially opened and we've added a bunch of new generators. But, when you compare the number of generators in networkx: https://networkx.org/documentation/stable/reference/generators.html to list in networkx: https://qiskit.org/documentation/retworkx/api.html#generators there is still a large functionality gap.

I think before we can close this issue we need to close this gap much more. Each generator function is a really good starting PR that's self contained and a good project for getting your feet wet with the library.

e-eight commented 3 years ago

Added a generator for undirected lollipop graphs in PR #454. Not sure if there should also be a directed version. Networkx does not seem to have any.

e-eight commented 3 years ago

I am going add a generator for the barbell graph too, since it is just an extension of the lollipop graph. If anyone is already working on it, please let me know.

k-tamuraphys commented 3 years ago

I am working on lattice module, https://github.com/Qiskit/qiskit-nature/pull/365 , in which retworkx is used. I hope I can generate translational invariant graphs (lattice) with uniform weights on edges using retworkx. Standard examples of such are hypercubic (hyperrectangle, triangular, hexagonal lattices. Furthermore, is such a graph has edges several directions like a square (or grid graph) and a triangular lattice , it is desirable to be able to assign uniform weights to each direction. For example, I may want to generate a square lattice with a weight of 1.0 in the horizontal direction and a weight of 2.0 in the vertical direction.