-
Notifications
You must be signed in to change notification settings - Fork 164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expand Generators Module #150
Comments
Adds both directed and undirected versions of Mesh and Grid graph generators. Related to #150 * Added Mesh and Grid graph generator * Updated grid_graph generator for 1D weights list * Lint refactoring * Minor refactoring * Added Graphviz examples for mesh and grid generators * Minor refactors Fixes Rust Lint error where <0 check was implemented on a usize variable
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 ). |
I will work on the heavy hex generator. |
Related to #150. Added new functions for the generator module: undirected hexagonal lattice graph; Directed hexagonal lattice graph; * Added hexagonal graph without weights as input * Added more hexagonal tests * removed the weight argument * Added itertools to dependencies * Added complete_graph * Add release notes complete_graph, hexagonal_graph * Added complete graph * Removed MANIFEST * Linting * Linting * Removed complete graph * Removed complete graph test * Fixed typo on documentation. Co-authored-by: georgios-ts <[email protected]> * Removed option for row and cols Co-authored-by: georgios-ts <[email protected]> * Removed if statement Removed if statement ` i + 1 < rowlen` because it would yield wrong results as pointed out by @georgios-ts * Expanded test coverage Added coverage for creating an empty hexagonal graph * Add documentation for the deleted nodes * fix docs typo * change name to `hexagonal_lattice_graph` * add `directed_hexagonal_lattice_graph` * lint * lint * Fix test name * typo on docs * fix typo docs * add edge_list assertion and bidirectional cases * run black fmt Co-authored-by: georgios-ts <[email protected]>
Related to #150 * Add binomial tree graph Add binomial tree graph for a given order. * update documentation * add release notes * lint * lint * lint * fix docs * remove option for order * change order to u32 This is done because that for `pow`method a u32 is needed. * clippy * add directed binomial tree graph * lint * fix positional argument Co-authored-by: Matthew Treinish <[email protected]> * updated test Co-authored-by: Matthew Treinish <[email protected]> * updated tests Co-authored-by: Matthew Treinish <[email protected]> * add case mismatch weights * add edgelist assertion * lint * add find_edge before adding edge `find_edge`makes sure that you don't add repeated edges on the graph * add bidirectional tests * clippy * lint * lint * run black * fix merge leftover * fix lint * add newline release notes * add `.is_none()` assertion Co-authored-by: Matthew Treinish <[email protected]> * `order` required arg Co-authored-by: Matthew Treinish <[email protected]> * `order` required arg Co-authored-by: Matthew Treinish <[email protected]> * Use `.is_none()` instead of `== None` everywhere * Run cargo fmt Co-authored-by: Matthew Treinish <[email protected]>
Added implementation of heavy hex [1], the input is the code distance, d. In the implementation I chose to add nodes referring to each type of qubit used in the Heavy Hex Code (data, syndrome, and flag) which may cause the node order to be confusing, but that was the best way that I figure out how to implement. Now I will explain the way that I implemented the code, which could be better for people without experience with the heavy hex code. In the heavy hex code, there are d ** 2 data qubits, (d + 1) * (d - 1) / 2 syndrome qubits, and d * (d - 1) flag qubits. In order to implement I follow 3 steps: * Each flag qubit is conneceted with 2 data qubits forming a chain on the graph, the chain has size d. * Connect syndrome qubits that are connected to data qubits. * Connect flag and syndrome qubits. In steps (ii) and (iii), there are two patterns depending on the eve (odd) columns of syndrome qubits, which are treated accordingly using an if statement. It was also required to use .chunk() for Vectors in order to represent them in a column. Related to #150 [1] https://journals.aps.org/prx/abstract/10.1103/PhysRevX.10.011022 * Added heavy hex Added firs implementation for heavy hex, it only implements 1 1 heavy hex and has some hardcoded parts that will be worked on. * Added to docs * lint * lint * add heavy hex generator * lint * add release notes * add test edge assertion * fix merge * add doc references * upgrade legibilitty * fix doc identation * add code-block for ASCII * add ascii block Co-authored-by: Matthew Treinish <[email protected]> * add `directed_heavy_hex_graph` * updated release notes * Fix edge directions * Fix docstring typos Co-authored-by: Eric Peterson <[email protected]> * Updates tests with direction fixes Co-authored-by: Matthew Treinish <[email protected]> Co-authored-by: Eric Peterson <[email protected]>
* add heavy square graph to generators Added implementation of [heavy square](https://journals.aps.org/prx/abstract/10.1103/PhysRevX.10.011022), the input is the code distance, d. In the implementation I chose to add nodes referring to each type of qubit used in the Heavy Hex Code (data, syndrome, and flag) which _may cause the node order to be confusing_, but that was the best way that I figure out how to implement. Related to #150 * add release notes * add heavy square edge assertion * add reference on the docs * fmt * updated text_signature * fmt * fix doc identation * Add code block for ASCII * lint * add note about the four-frequency variant * add `directed_heavy_square_code` * Fix edge directions * Update edge directions in tests Co-authored-by: Matthew Treinish <[email protected]>
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. |
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. |
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. |
I am working on |
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
(this was handled by #191)qiskit.transpiler.CouplingMap.from_line
,qiskit.transpiler.CouplingMap.from_ring
,qiskit.transpiler.CouplingMap.from_grid
, andqiskit.transpiler.CouplingMap.from_full
The text was updated successfully, but these errors were encountered: