Commit 54343c54 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[Minor] adding type signature

parent 1851c3ee
......@@ -118,6 +118,7 @@ step (p, v, l, s) cgr = cgr
where
mNc = nodeCommunity v cgr
ncs = nodeNeighbours v cgr
-- We move node from community nc into ncs
moves :: Maybe (LNode Community, [LNode Community])
moves = case mNc of
......@@ -155,14 +156,14 @@ nodeCommunity n cgr = head (filter f $ labNodes cgr)
nodeNeighbours :: Node -> CGr -> [LNode Community]
nodeNeighbours n cgr =
case nodeCommunity n cgr of
Nothing -> []
Nothing -> []
Just (cn, _) -> mapMaybe (lnode cgr) (neighbors cgr cn)
-- | Find 'Ajd CGrEdge's of 'Community' graph neighbouring a given node
nodeLNeighbours :: Node -> CGr -> Adj CGrEdge
nodeLNeighbours n cgr =
case nodeCommunity n cgr of
Nothing -> []
Nothing -> []
Just (cn, _) -> lneighbors cgr cn
-- | Moves 'Node' in the 'Direction' of 'Community' and recomputes 'Community''s weights
......@@ -177,11 +178,12 @@ moveNodeWithNeighbours :: Adj FEdge -> Node -> Direction -> Community -> Communi
moveNodeWithNeighbours lnNeighbors n direction (Community (ns, inwsum, totwsum)) =
Community (newNs, newInWsum, newTotWsum)
where
newNs :: [Node]
newNs = case direction of
Into -> n:ns
OutOf -> DL.delete n ns
newInWsum, newTotWsum :: Double
newInWsum = inwsum + directionN * sumN
newTotWsum = totwsum + directionN * (sumN - sumNonCom)
......
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