Commit c3c1e31e authored by Alexandre Delanoë's avatar Alexandre Delanoë

[ILouvain] more func/instances to be defined.

parent b8c4566e
...@@ -159,10 +159,11 @@ class IsHyperGraph a where ...@@ -159,10 +159,11 @@ class IsHyperGraph a where
imodularity_ :: a -> a -> [Node] -> Double imodularity_ :: a -> a -> [Node] -> Double
gmodularity_ :: a -> a -> Double gmodularity_ :: a -> a -> Double
toHyperGraph_ :: Gr () Double -> a toHyperGraph_ :: Gr () Double -> a
toNodes_ :: a -> [Node]
toNodes_ :: a -> [[Node]]
isFlat_ :: a -> Bool isFlat_ :: a -> Bool
------------------------------------------------------------------------
------------------------------------------------------------------------
hnodes :: HyperGraph a b -> Node -> [Node] hnodes :: HyperGraph a b -> Node -> [Node]
hnodes g n = case match n g of hnodes g n = case match n g of
(Nothing , _) -> [] (Nothing , _) -> []
...@@ -170,15 +171,22 @@ hnodes g n = case match n g of ...@@ -170,15 +171,22 @@ hnodes g n = case match n g of
hnodes' :: HyperGraph' a b c -> Node -> [Node] hnodes' :: HyperGraph' a b c -> Node -> [Node]
hnodes' g n = concat $ map (hnodes g) $ hnodes g n hnodes' g n = concat $ map (hnodes g) $ hnodes g n
------------------------------------------------------------------------ ------------------------------------------------------------------------
toNodes :: HyperGraph a a -> [[Node]] toNodes :: HyperGraph a a -> [[Node]]
toNodes g = map (hnodes g) (nodes g) toNodes g = map (hnodes g) (nodes g)
toNodes' :: HyperGraph' a b c -> [[Node]]
toNodes' g = map (hnodes' g) (nodes g)
------------------------------------------------------------------------
isFlat :: HyperGraph a b -> Bool isFlat :: HyperGraph a b -> Bool
isFlat g = all (isEmpty . snd) (labNodes g) isFlat g = all (isEmpty . snd) (labNodes g)
-- flatten
{-
isFlat' :: HyperGraph' a b c-> Bool
isFlat' g = all (isFlat . concat . (map nodes) . snd) (labNodes g)
-}
{- {-
hdeg :: Graph gr => gr a b -> Node -> Maybe Int hdeg :: Graph gr => gr a b -> Node -> Maybe Int
......
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