-
Notifications
You must be signed in to change notification settings - Fork 177
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
Update Data.Graph documentation #923
Conversation
For topSort and reverseTopSort the graph is expected to be acyclic. For bcc the graph is expected to be undirected.
One more for the release 😄 |
@@ -383,8 +383,8 @@ graphFromEdges' x = (a,b) where | |||
(a,b,_) = graphFromEdges x | |||
{-# INLINABLE graphFromEdges' #-} | |||
|
|||
-- | Build a graph from a list of nodes uniquely identified by keys, | |||
-- with a list of keys of nodes this node should have edges to. | |||
-- | \(O((V+E) \log V)\). Build a graph from a list of nodes uniquely identified |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The sort step is
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're absolutely right. I got my edges and vertices crossed for a moment.
-- | ||
-- Note: A topological sort exists only when there are no cycles in the graph. | ||
-- If the graph has cycles, the output of this function will not be a | ||
-- topological sort. In such a case consider using 'scc'. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be good to mention that reverseTopSort
is (currently?) faster.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because of the reverse
? That seems avoidable. We build the list from the tree so we should also be able to build the reverse of the list directly. I can make a PR later.
I'm going to merge this for the release, but I think my comments should be considered for the next one. |
Thanks for the fast merge! |
Data.Graph
functions.Forest
synonym as it can be confusing. We stopped using it inData.Tree
in Stop using the Forest type synonym #665.topSort
,reverseTopSort
andbcc
.