Copyright | Copyright (C) 2021 Yoo Chung |
---|---|
License | GPL-3.0-or-later |
Maintainer | dev@chungyc.org |
Safe Haskell | Safe-Inferred |
Language | GHC2021 |
Part of Ninety-Nine Haskell Problems. Some solutions are in Solutions.P88.
Synopsis
- connectedComponents :: G -> [[Vertex]]
Documentation
connectedComponents :: G -> [[Vertex]] Source #
Write a function that splits a graph into its connected components.
Examples
>>>
sort $ map sort $ connectedComponents $ toG $ Paths [[1,2,3,4,5], [2,4], [6,7]]
[[1,2,3,4,5],[6,7]]