Commit 4c7c38ee authored by Alexandre Delanoë's avatar Alexandre Delanoë

[FIX] cluster on connected components only and leaves others nodes alone...

[FIX] cluster on connected components only and leaves others nodes alone (todo). Use Order1 by default
parent 67c34520
...@@ -125,7 +125,7 @@ recomputeGraph _uId nId maybeDistance = do ...@@ -125,7 +125,7 @@ recomputeGraph _uId nId maybeDistance = do
identity identity
$ nodeGraph ^. node_parent_id $ nodeGraph ^. node_parent_id
similarity = case graphMetric of similarity = case graphMetric of
Nothing -> withMetric Order2 Nothing -> withMetric Order1
Just m -> withMetric m Just m -> withMetric m
case graph of case graph of
...@@ -159,7 +159,7 @@ computeGraph cId d nt repo = do ...@@ -159,7 +159,7 @@ computeGraph cId d nt repo = do
let ngs = filterListWithRoot MapTerm let ngs = filterListWithRoot MapTerm
$ mapTermListRoot [lId] nt repo $ mapTermListRoot [lId] nt repo
myCooc <- HashMap.filter (>1) -- Removing the hapax (ngrams with 1 cooc) myCooc <- HashMap.filter (>2) -- Removing the hapax (ngrams with 1 cooc)
<$> getCoocByNgrams (Diagonal True) <$> getCoocByNgrams (Diagonal True)
<$> groupNodesByNgrams ngs <$> groupNodesByNgrams ngs
<$> getNodesByNgramsOnlyUser cId (lIds <> [lId]) nt (HashMap.keys ngs) <$> getNodesByNgramsOnlyUser cId (lIds <> [lId]) nt (HashMap.keys ngs)
......
...@@ -68,7 +68,9 @@ spinglass s g = toClusterNode ...@@ -68,7 +68,9 @@ spinglass s g = toClusterNode
g'' = mkGraphUfromEdges (Map.keys g') g'' = mkGraphUfromEdges (Map.keys g')
g''' = case IG.isConnected g'' of g''' = case IG.isConnected g'' of
True -> g'' True -> g''
False -> panic "[G.C.V.G.T.Igraph: not connected graph]" False -> case head (IG.decompose g'') of
Nothing -> panic "[G.C.V.G.T.Igraph: not connected graph]"
Just g'''' -> g''''
(toI, fromI) = createIndices g (toI, fromI) = createIndices g
......
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