You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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
Graph.reverse()
is currently broken for directed graphs with a 2-cycle. Consider the complete, directed graph of size 2, if you call thereverse()
method in its current form, it will throw an error.I think a fix would be to make the
reverse()
methods of both theGraph
andGraphEdge
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.
The text was updated successfully, but these errors were encountered: