Skip to content
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

Initialize Lattices from networkx.Graphs #467

Closed
wants to merge 6 commits into from

Conversation

Cryoris
Copy link
Contributor

@Cryoris Cryoris commented Dec 17, 2021

Summary


Edit: This PR is now split into #471 and #472.


Fixes #465: Support the initialization of lattices from networkx graphs.
Fixes #466: Allow only numerical values for edge weights.

Details and comments

Now we can for instance construct lattices as

import networkx as nx
from qiskit_nature.problems.second_quantization.lattice import Lattice
# 3-regular random graph on 6 nodes
graph = nx.generators.random_graphs.random_regular_graph(3, n=6)
lattice = Lattice(graph)

@coveralls
Copy link

coveralls commented Dec 17, 2021

Pull Request Test Coverage Report for Build 1593395376

  • 14 of 16 (87.5%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.02%) to 85.38%

Changes Missing Coverage Covered Lines Changed/Added Lines %
qiskit_nature/problems/second_quantization/lattice/lattices/lattice.py 14 16 87.5%
Totals Coverage Status
Change from base Build 1593381601: 0.02%
Covered Lines: 10115
Relevant Lines: 11847

💛 - Coveralls

@Cryoris
Copy link
Contributor Author

Cryoris commented Dec 20, 2021

Closing in favor of splitting this PR in two: the edge type check #471 and the networkx support #472.

@Cryoris Cryoris closed this Dec 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Type check edge weights in Lattice constructions? Initialize Lattices with networkx.Graphs
4 participants