ninetynine-1.3.0: Ninety-Nine Haskell Problems
CopyrightCopyright (C) 2021 Yoo Chung
LicenseGPL-3.0-or-later
Maintainerdev@chungyc.org
Safe HaskellSafe-Inferred
LanguageGHC2021

Problems.P88

Description

Part of Ninety-Nine Haskell Problems. Some solutions are in Solutions.P88.

Synopsis

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]]