Commit 7f38878d authored by Alexandre Delanoë's avatar Alexandre Delanoë

[ILouvain/HyperGraph'] last fun before mvH

parent 7adf6636
......@@ -166,6 +166,8 @@ class IsHyperGraph a where
imodularity_ :: a -> a -> [Node] -> Double
gmodularity_ :: a -> a -> Double
hdeg_ :: a -> Node -> Maybe Int
------------------------------------------------------------------------
hnodes :: HyperGraph a b -> Node -> [Node]
......@@ -193,11 +195,6 @@ isFlat g = all (isEmpty . snd) (labNodes g)
isFlat' :: HyperGraph' a b c -> Bool
isFlat' g = all (isFlat . snd) (labNodes g)
{-
hdeg :: Graph gr => gr a b -> Node -> Maybe Int
hdeg = undefined
-}
------------------------------------------------------------------------
------------------------------------------------------------------------
-- TODO go depth in HyperGraph (modularity at level/depth)
......@@ -226,17 +223,14 @@ gmodularity' g g' = sum $ map (\n -> imodularity' g g' [n]) $ nodes g'
toHyperGraph :: Gr () Double -> HyperGraph Double Double
toHyperGraph g = nmap (\_ -> empty) g
toHyperGraph' :: Gr () Double -> HyperGraph' Double Double Double
toHyperGraph' g = nmap (\_ -> emptyHyperGraph) g
------------------------------------------------------------------------
emptyHyperGraph :: HyperGraph Double Double
emptyHyperGraph = toHyperGraph empty
emptyHyperGraph' :: HyperGraph' Double Double Double
emptyHyperGraph' = undefined
{-
toHyperGraph' :: Gr () Double -> HyperGraph' Double Double Double
toHyperGraph' g = nmap (\_ -> emptyHyperGraph) g
-}
emptyHyperGraph' = toHyperGraph' empty
------------------------------------------------------------------------
-- Spoon Graph
-- 1
......@@ -260,6 +254,20 @@ spoon = mkGraph ns es
, (4, 5, 1.0)
]
spoon' :: HyperGraph' Double Double Double
spoon' = mkGraph ns es
where
ns :: [LNode (HyperGraph Double Double)]
ns = zip [1..6] (cycle [emptyHyperGraph])
es :: [LEdge Double]
es = [ (1, 2, 1.0)
, (1, 3, 1.0)
, (2, 4, 1.0)
, (3, 4, 1.0)
, (4, 5, 1.0)
]
-- | Needed function
-- mv: a Node elsewhere in the HyperGraph
......@@ -275,6 +283,15 @@ spoon = mkGraph ns es
-- Move target type
-- let's start simple: path lenght <= 2 max
mvH :: Show a
=> HyperGraph' a a a
-> [Node] -> [Node]
-> HyperGraph' a a a
mvH = undefined
mv :: Show a => HyperGraph a a
-> [Node] -> [Node]
-> HyperGraph a a
......@@ -327,7 +344,6 @@ merge = ufold (&)
------------------------------------------------------------------------
test_mv :: (Ord a, Show a) => HyperGraph a a -> Node -> Node -> Bool
test_mv g a b = (mv (mv g [a] [b]) [b,a] []) == g
------------------------------------------------------------------------
-- Paths in the Graph to be tested
-- Directed graph strategy
......
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