summaryrefslogtreecommitdiff
path: root/src/Grasp
diff options
context:
space:
mode:
authorJed Barber <jjbarber@y7mail.com>2014-12-19 09:44:49 +1100
committerJed Barber <jjbarber@y7mail.com>2014-12-19 09:44:49 +1100
commita206e36b57c18cc44f94178e88ec2565a346e950 (patch)
tree0b0d3169031e94daab89adc5ebcda6694f414f31 /src/Grasp
parentd7ae87b35a8835d60dd0b23a0365e7d938c1665b (diff)
Bugfixes for match, &
Diffstat (limited to 'src/Grasp')
-rw-r--r--src/Grasp/Graph.hs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/Grasp/Graph.hs b/src/Grasp/Graph.hs
index 2f22d2b..febc265 100644
--- a/src/Grasp/Graph.hs
+++ b/src/Grasp/Graph.hs
@@ -121,11 +121,11 @@ match :: Node -> Gr a b -> Decomp a b
match n gr =
if (n `notElem` nodes gr)
then (Nothing, gr)
- else (Just (to, n, label, from), gr)
+ else (Just (to, n, label, from), (delNode n gr))
where
- to = map (\(x,y,z) -> (z,y)) (inn gr n)
+ to = map (\(x,y,z) -> (z,x)) (inn gr n)
label = snd . head $ (filter (\(x,y) -> x == n) (labNodes gr))
- from = map (\(x,y,z) -> (z,x)) (out gr n)
+ from = map (\(x,y,z) -> (z,y)) (out gr n)
@@ -172,8 +172,8 @@ labEdges = getLabEdges
(&) :: Context a b -> Gr a b -> Gr a b
(to, n, lab, from) & gr =
- let edgesTo = map (\(z,y) -> (n,y,z)) to
- edgesFrom = map (\(z,x) -> (x,n,z)) from
+ let edgesTo = map (\(z,y) -> (y,n,z)) to
+ edgesFrom = map (\(z,x) -> (n,x,z)) from
in (insEdges edgesTo) . (insEdges edgesFrom) . (insNode (n,lab)) $ gr