chadbrewbaker / endoscope

Toolkit for analysis of endofunctions on small sets
BSD 3-Clause "New" or "Revised" License
9 stars 0 forks source link

Fixed points or 3-colorings of functions without fixed points #1

Open chadbrewbaker opened 8 years ago

chadbrewbaker commented 8 years ago

Felix Dilke put in a request for fixed points of an endofunction, or a 3-coloring of an endofunction such that x and f(x) do not have the same color.

fixedPoints :: (a->a) -> [a] -> [a]

threeColoring :: (a->a) -> [a] -> [ [a],[a],[a]] threeColoring f set | (length $ fixedPoints f set) == 0 = [] | otherwise = -- split into connected components. 3 color cycles, greedy color tree branches

chadbrewbaker commented 8 years ago

If memory serves Munro had a few algorithms in that vein which could be nice to have features, Succinct Representations of Permutations and Functions