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 bidirectional flag to existing generator functions #184

Closed
mtreinish opened this issue Oct 27, 2020 · 7 comments · Fixed by #189
Closed

Add bidirectional flag to existing generator functions #184

mtreinish opened this issue Oct 27, 2020 · 7 comments · Fixed by #189
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@mtreinish
Copy link
Member

What is the expected enhancement?

The existing directed_* generator functions in https://github.com/Qiskit/retworkx/blob/master/src/generators.rs only have an option to add a single edge. But it could be useful to add edges in both directions. While this is essentially the same as a undirected version of the function there are use cases where you could want bidirectional edges added to a directed graph generatore. For example a bidirectional path graph: a <-> b <-> c instead of just a -> b -> c that exists now. This would be to add a new boolean kwarg to the existing (and potential future) directed generator functions to set adding bidirectional edges.

This is related to #150 but self contained enhancement for the existing generator functions rather than adding new functions.

@mtreinish mtreinish added enhancement New feature or request good first issue Good for newcomers labels Oct 27, 2020
@darknight009
Copy link
Contributor

Can I work on this?

@mtreinish
Copy link
Member Author

@darknight009 sure go ahead. I've assigned the issue to you.

@darknight009
Copy link
Contributor

What is the default expected behavior of bidirectionality? Should it be set to "false" for directed_* generators?

@mtreinish
Copy link
Member Author

Yeah, it should be default false. By default things should not be bidirectional, it should be an opt-in option that a user can set

@darknight009
Copy link
Contributor

How should the case for directed_star_graph be handled where both bidirectionality and inward are passed. For eg. directed_star_graph(num_nodes = 5, bidirectional=True, inward= True). Does bidirectional override inward?

@mtreinish
Copy link
Member Author

Hmm, I forgot about that. I'll defer to you on that as long as it's documented clearly. Either we have one flag take precedence over the other or raise an exception. It doesn't really matter as long as we make it clear what the behavior is in that edge case (and probably have a test asserting that behavior too).

@darknight009
Copy link
Contributor

Ok proceeding with precedence of bidirectional over inward.

mtreinish pushed a commit that referenced this issue Nov 3, 2020
Allows users to pass optional parameter 'bidirectional' to add edges in both directions
For directed_star_graph generator if 'bidirectional' is set to 'True', the 'inward' parameter is ignored.

Fixes #184

* Added Bidirectional parameters for directed graph generators

* Sets bidirectional parameter as false by default using pyfunction macro

* Refactoring
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants