Safe Haskell | None |
---|---|
Language | Haskell2010 |
Documentation
bfs :: Graph -> [Vertex] -> Forest Vertex Source #
BFS on a graph, starting from the given source vertices. One tree per source is returned, which contains all the vertices reached from the source before they could be reached by another. Note that this is unlike Data.Graph.dfs, which returns one Tree for each connected component. O(n + m), for a graph with n vertices and m edges.