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.P82.

# Documentation

cycles :: Vertex -> G -> [[Vertex]] Source #

A cycle is a path in a graph whose first and last vertexes are the same vertex. No edges and no other vertexes repeat in the path.

Write a function which finds all cycles in the graph which include the given vertex.

### Examples

`>>>`

[[1,2,3],[1,2,4,3],[1,3,2],[1,3,4,2]]`sort $ cycles 1 $ toG $ Paths [[1,2,3], [1,3,4,2], [5,6]]`