Modularise graph functions
This commit is contained in:
+1
-9
@@ -1,6 +1,7 @@
|
||||
module Dodge.Path where
|
||||
import Dodge.Data
|
||||
import Dodge.Base
|
||||
import Dodge.Graph
|
||||
|
||||
import Geometry
|
||||
|
||||
@@ -160,12 +161,3 @@ maybeToEither :: a -> Maybe b -> Either a b
|
||||
maybeToEither _ (Just x) = Right x
|
||||
maybeToEither y Nothing = Left y
|
||||
|
||||
pairsToIncidence :: (Eq a,Ord a) => [(a,a)] -> [(a,[a])]
|
||||
pairsToIncidence = map ((\(xs,ys) -> (head xs,ys)) . unzip)
|
||||
. groupBy ( (==) `on` fst)
|
||||
. sort
|
||||
|
||||
incidenceToFunction :: Eq a => [(a,[a])] -> a -> [a]
|
||||
incidenceToFunction xs a = case lookup a xs of Just ys -> ys
|
||||
Nothing -> []
|
||||
|
||||
|
||||
Reference in New Issue
Block a user