summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJed Barber <jjbarber@y7mail.com>2014-11-24 01:46:29 +1100
committerJed Barber <jjbarber@y7mail.com>2014-11-24 01:46:29 +1100
commit92e5783f59ae689cf8b2da6a6e68f6b1e48b405e (patch)
treef2b9fd2a46f554b39d286146fde013e89ab2bdfc /src
parentd0cab364562ba696dfd5396a10b698de6a1a5f02 (diff)
Bugfixes of calculating Adj
Diffstat (limited to 'src')
-rw-r--r--src/Grasp/Graph.hs16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/Grasp/Graph.hs b/src/Grasp/Graph.hs
index 0caaee7..bc08bbe 100644
--- a/src/Grasp/Graph.hs
+++ b/src/Grasp/Graph.hs
@@ -106,9 +106,9 @@ match n gr =
then (Nothing, gr)
else (Just (to, n, label, from), gr)
where
- to = map edgeToAdjTo (filter (edgeTo n) (labEdges gr))
+ to = edgesToAdjTo (filter (edgeTo n) (labEdges gr))
label = snd . head $ (filter (\(x,y) -> x == n) (labNodes gr))
- from = map edgeToAdjFrom (filter (edgeFrom n) (labEdges gr))
+ from = edgesToAdjFrom (filter (edgeFrom n) (labEdges gr))
@@ -133,21 +133,21 @@ nodes gr = (map fst) . labNodes $ gr
-edgeToAdjFrom :: LEdge a -> Adj a
-edgeToAdjFrom (x,y,z) = (z,y)
+edgesToAdjFrom :: [LEdge a] -> Adj a
+edgesToAdjFrom = map (\(x,y,z) -> (z,x))
-edgeToAdjTo :: LEdge a -> Adj a
-edgeToAdjTo (x,y,z) = (z,x)
+edgesToAdjTo :: [LEdge a] -> Adj a
+edgesToAdjTo = map (\(x,y,z) -> (z,y))
edgeFrom :: Node -> LEdge a -> Bool
-edgeFrom n (x,y,z) = (y == n)
+edgeFrom n (x,y,z) = (x == n)
edgeTo :: Node -> LEdge a -> Bool
-edgeTo n (x,y,z) = (x == n)
+edgeTo n (x,y,z) = (y == n)