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 generators module #121

Merged
merged 6 commits into from
Aug 26, 2020
Merged

Add generators module #121

merged 6 commits into from
Aug 26, 2020

Conversation

mtreinish
Copy link
Member

This commit adds a new module to retworkx, generators, which contains a
bunch of helper functions to quickly create various types of graphs. To
start it adds generators for a star graph, path graph, and cycle graph.
We can continue to grow this set out over time.

This commit adds a new module to retworkx, generators, which contains a
bunch of helper functions to quickly create various types of graphs. To
start it adds generators for a star graph, path graph, and cycle graph.
We can continue to grow this set out.
@coveralls
Copy link

coveralls commented Aug 20, 2020

Coverage Status

Coverage decreased (-2.8%) to 88.665% when pulling 745dcaf on mtreinish:add-generators into f4af5b0 on Qiskit:master.

@mtreinish
Copy link
Member Author

Hmm, I think coveralls is a little confused. There was no change in coverage from the previous commit (it was just a merge commit pulling in a requirements bump). Looking at https://coveralls.io/builds/32982740 it shows the new generator module having 97% coverage but files not changed decreasing. I'm not sure how to retrigger it, rerunning the job didn't work.

@mtreinish
Copy link
Member Author

Hmm, I think coveralls is a little confused. There was no change in coverage from the previous commit (it was just a merge commit pulling in a requirements bump). Looking at https://coveralls.io/builds/32982740 it shows the new generator module having 97% coverage but files not changed decreasing. I'm not sure how to retrigger it, rerunning the job didn't work.

Yeah looking a bit more closely at the coverage reporting there it's missing src/lib.rs I'm not sure where it went, but that drops ~1k total lines so the total ratio of covered lines goes down. This actually is increasing coverage by about ~0.6%. I'm not sure why grcov/coveralls isn't reporting the coverage for src/lib.rs anymore.

Copy link
Collaborator

@lcapelluto lcapelluto left a comment

Choose a reason for hiding this comment

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

I'll have to read generators.rs tomorrow


def test_directed_cycle_graph_weights(self):
graph = retworkx.generators.directed_cycle_graph(
weights=list(range(20)))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Weights are attached to nodes, rather than edges? And it's also separate from node data (which seems to be None, here)?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, the weights here are attached to the nodes, the edge weights end up as None in the generator. I use data and weights interchangeably in retworkx (which is probably pretty sloppy on my part). The Nones below are actually the edge weight/data PyDiGraph.out_edges() returns a list of tuples of the form (source node index, target node index, edge weight) https://github.com/Qiskit/retworkx/blob/master/src/digraph.rs#L852-L871. The assertEqual at L32 is checking the node weights, PyDigraph.nodes() returns a list of all the node data https://github.com/Qiskit/retworkx/blob/master/src/digraph.rs#L391-L401

Copy link
Collaborator

Choose a reason for hiding this comment

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

thank you:)

tests/generators/test_path.py Outdated Show resolved Hide resolved
@mtreinish mtreinish merged commit ef2fff4 into Qiskit:master Aug 26, 2020
@mtreinish mtreinish deleted the add-generators branch August 26, 2020 20:41
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.

3 participants