Commit 2e1077dd authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

Merge branch 'flouvain' of ssh://gitlab.iscpif.fr:20022/gargantext/clustering-louvain into flouvain

parents 747b4a4e 1dd094f7
......@@ -29,6 +29,13 @@ import Data.Graph.Inductive
type HyperGraph a b = Gr (Gr () a) b
type HyperContext a b = Context (Gr () a) b
toInfra :: Gr (Gr () a) b -> Gr () a
toInfra = undefined
toSupra :: Gr () a -> Gr (Gr () a) b
toSupra = undefined
-- TODO Later (hypothesis still)
-- type StreamGraph a b = Gr a (Gr () b)
------------------------------------------------------------------------
......@@ -69,31 +76,40 @@ spoon = mkGraph ns es
-- mv (mv spoon [1] [4]) [4,1] [] = identity
-- Move target type
mv' :: HyperGraph a a
-- let's start simple: path lenght <= 2 max
mv :: HyperGraph a a
-> [Node] -> [Node]
-> HyperGraph a a
mv' g [] [] = g
mv' g [_] [] = g
mv' g (x:xs) [] = undefined
mv g [] [] = g
mv g [_] [] = g
mv g [] [_] = g
mv g [a] [b] = mv' g a b
mv g [a,b] [] = undefined
mv g (x:xs) (y:ys) = panic "mv path too long"
-- | Start simple (without path)
mv :: HyperGraph a a
mv' :: HyperGraph a a
-> Node -> Node
-> HyperGraph a a
mv g n1 n2 = delNode n1 g
-- buildGr $ catMaybes [c1, c2]
mv' g n1 n2 = (mvMContext c1 c2) & g2
where
(c1, g1) = match n1 g
(c2, g2) = match n2 g1
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',c'&l,a2')
where
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"
{-
insertContext :: HyperContext a b
-> HyperContext a b
-> HyperContext a b
insertContext (a1,n,l,a2) (a1',n',l',a2') = (a1,n,l&l',a2)
--}
------------------------------------------------------------------------
-- | 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