Commit 60924bc5 authored by Alexandre Delanoë's avatar Alexandre Delanoë

fix merge

parent 9941ec91
......@@ -132,7 +132,6 @@ 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
......@@ -172,14 +171,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
......@@ -194,19 +193,13 @@ moveNodeWithNeighbours :: Adj (FEdge b) -> Node -> Direction -> Community -> Com
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) = computeWeights direction (inwsum, totwsum) sumN sumNonCom
directionN :: Double
directionN = case direction of
Into -> 1
OutOf -> -1
-- Update InWeightSum with connections between node and the community
sumN :: Double
sumN = sum $ map (fedgeWeight . fst) comNeighbors
......
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