haccepted-0.1.0.0: Data structures and algorithms
Safe HaskellNone
LanguageHaskell2010

BFS

Description

Synopsis

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.