graph theory algorithms in Haskell