Commit 640915a9 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[ILouvain] inv mv almost done

parent edfe388c
......@@ -84,10 +84,18 @@ mv g [_] [ ] = g
mv g [ ] [_] = g
mv g [a] [b] = mv' g a b
mv g [a,b] [ ] = undefined
mv g [a,b] [ ] = case match a g of
(Nothing, _) -> panic "mv: fst Node of Path does not exist"
(Just (p, n, l, s), g1) -> case match b l of
(Nothing, _) -> panic "mv: snd Node of Path does not exist"
(Just (p',n',l',s'), g2) -> (p', n', g2 , s')
-- & (p , n , empty, s )
& g1
mv g (x:xs) (y:ys) = panic "mv: path too long"
----------------------------
-- | Start simple (without path)
mv' :: HyperGraph a a
-> Node -> Node
......@@ -101,13 +109,13 @@ mvMContext :: Maybe (HyperContext a a)
-> Maybe (HyperContext a a)
-> HyperContext a a
mvMContext (Just (a1 ,n ,l ,a2 ))
(Just (a1',n',l',a2')) = (a1',n', merge l (c' & l'),a2')
(Just (a1',n',l',a2')) = (a1',n', merge l' (c & l),a2')
where
c' = (a1, n, (), a2)
c = (a1, n, (), a2)
mvMContext _ (Just _) = panic "First Node does not exist"
mvMContext (Just _) _ = panic "Snd Node does not exist"
mvMContext _ _ = panic "Both Nodes do not exist"
mvMContext _ (Just _) = panic "mvmcontext: First Node does not exist"
mvMContext (Just _) _ = panic "mvmcontext: Snd Node does not exist"
mvMContext _ _ = panic "mvmcontext: Both Nodes do not exist"
merge :: (Graph gr, DynGraph gr)
=> gr a b -> gr a b -> gr a b
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment