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

Calling Graph.reverse() on a graph with a 2-cycle throws an Error #302

Open
DCtheTall opened this issue Feb 12, 2019 · 1 comment
Open

Comments

@DCtheTall
Copy link

DCtheTall commented Feb 12, 2019

Graph.reverse() is currently broken for directed graphs with a 2-cycle. Consider the complete, directed graph of size 2, if you call the reverse() method in its current form, it will throw an error.

I think a fix would be to make the reverse() methods of both the Graph and GraphEdge objects pure functions which return new instances of the respective objects.

This would add the additional benefit of allowing calling these functions to not change the original graph, which can be overwritten/garbage collected if desired.

I am currently working on a pull request for issue #252 and would like to use the already-implemented stronglyConnectedComponents function to implement Johnson's algorithm.

I would be willing to open a preliminary PR making the change described above (and refactoring tests) if the owners are ok with this change.

@DCtheTall DCtheTall changed the title Graph.reverse() breaks for 2-cycles Calling Graph.reverse() on a graph with a 2-cycle throws an Error Feb 12, 2019
@DCtheTall
Copy link
Author

Bumping this issue, is this a change that the owners of this repo would accept? If so I can open a PR for this within a few days.

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

No branches or pull requests

1 participant