Commit 22b6aa97 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[FIX] clustering, order 2 similarity, ok

parent badfdf60
......@@ -9,6 +9,8 @@ Portability : POSIX
-}
{-# LANGUAGE ScopedTypeVariables #-}
module Gargantext.Core.Viz.Graph.Tools
where
......@@ -78,7 +80,8 @@ cooc2graphWith' :: ToComId a
cooc2graphWith' doPartitions distance threshold myCooc = do
let
-- TODO remove below
theMatrix = Map.fromList $ HashMap.toList myCooc
theMatrix = Map.fromList
$ HashMap.toList myCooc
(ti, _) = createIndices theMatrix
myCooc' = toIndex ti theMatrix
......@@ -99,7 +102,13 @@ cooc2graphWith' doPartitions distance threshold myCooc = do
printDebug "Similarities" similarities
let
distanceMap = case distance of
links = round (let n :: Double = fromIntegral (Map.size ti) in n * log n)
distanceMap = Map.fromList
$ List.take links
$ List.sortOn snd
$ Map.toList
$ case distance of
Conditional -> Map.filter (> threshold)
Distributional -> Map.filter (> 0)
$ mat2map similarities
......
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