Commit 268b2ff0 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[ILouvain] mv done (todo: tests)

parent 504d3cce
......@@ -78,14 +78,16 @@ mv g [ ] [ ] = g
mv g [_] [ ] = g
mv g [ ] [_] = g
mv g [a] [b] = mv' g a b
mv g [a] [b] = case a == b of
True -> panic "mv: same nodes, impossible mv"
False -> mv' g a b
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
(Just (p',n',l',s'), g2) -> (p', n', g2, s')
& ((p , n , delNode b l , s )
& g1)
(Nothing, _) -> panic "mv: snd Node of Path does not exist"
(Just (p',n',l',s'), g2) -> (p', n', g2 , s')
-- & (p , n , delNode b l, s )
& g1
mv g (x:xs) (y:ys) = panic "mv: path too long"
......@@ -116,7 +118,9 @@ merge :: (Graph gr, DynGraph gr)
=> gr a b -> gr a b -> gr a b
merge = ufold (&)
------------------------------------------------------------------------
test_mv :: Ord a => HyperGraph a a -> Node -> Node -> Bool
test_mv g a b = (mv (mv g [a] [b]) [b,a] []) == g
------------------------------------------------------------------------
-- | Recursive Node of Graph
{-
......
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