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

Add G(n,m) random graph generator #176

Merged
merged 3 commits into from
Oct 19, 2020
Merged

Conversation

MoAllabbad
Copy link
Contributor

This adds two G(n,m) graph generators, one directed and one undirected.
The generated graph will be a random graph out of all the possible
graphs that are n nodes and m edges with max n*(n-1) edges for directed
graphs and n*(n-1)/2 for undirected graphs, avoiding self-loops and
multigraphs. The run time is O(n+m)
Fixes #174

This adds two G(n,m) graph generators, one directed and one undirected.
The generated graph will be a random graph out of all the possible
graphs that are n nodes and m edges with max n*(n-1) edges for directed
graphs and n*(n-1)/2 for undirected graphs, avoiding self-loops and
multigraphs. The run time is O(n+m)
Fixes Qiskit#174
@coveralls
Copy link

coveralls commented Oct 19, 2020

Pull Request Test Coverage Report for Build 315839295

  • 66 of 66 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.2%) to 93.454%

Totals Coverage Status
Change from base Build 315696750: 0.2%
Covered Lines: 2270
Relevant Lines: 2429

💛 - Coveralls

@mtreinish mtreinish changed the title Add G(n,m) random graph generator #1 Add G(n,m) random graph generator Oct 19, 2020
Copy link
Member

@mtreinish mtreinish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM, thanks for taking on this enhancement.

Before we merge this I think we should do the !.is_some() -> is_none() change. The other comments inline are just a couple of idle thoughts I had, but not worth blocking over (or necessarily even doing in the case of usize vs isize for parameters)

src/lib.rs Outdated Show resolved Hide resolved
src/lib.rs Outdated Show resolved Hide resolved
src/lib.rs Show resolved Hide resolved
src/lib.rs Show resolved Hide resolved
MoAllabbad and others added 2 commits October 19, 2020 11:01
Apply suggestions from code review

Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
@mtreinish mtreinish merged commit 9c4ecf5 into Qiskit:master Oct 19, 2020
@MoAllabbad MoAllabbad deleted the random-gnm branch October 21, 2020 01:56
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.

None yet

3 participants