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

[FIX] Spinglass not connected components

parent 407af151
......@@ -63,18 +63,17 @@ spinglass :: Seed -> Map (Int, Int) Double -> IO [ClusterNode]
spinglass s g = toClusterNode
<$> map catMaybes
<$> map (map (\n -> Map.lookup n fromI))
<$> partitions_spinglass' s g'''
<$> List.concat
<$> mapM (partitions_spinglass' s) g'
where
g' = toIndex toI g
g'' = mkGraphUfromEdges (Map.keys g')
g''' = case IG.isConnected g'' of
True -> g''
False -> case head (IG.decompose g'') of
Nothing -> panic "[G.C.V.G.T.Igraph: not connected graph]"
Just g'''' -> g''''
-- Not connected components of the graph make crash spinglass
g' = IG.decompose $ mkGraphUfromEdges
$ Map.keys
$ toIndex toI g
(toI, fromI) = createIndices g
-- | Tools to analyze graphs
partitions_spinglass' :: (Serialize v, Serialize e)
=> Seed -> IG.Graph 'U v e -> IO [[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