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

[FIX] getNeighbours False instead of True (commit 4cbd0eb4) TODO check behavior.

parent a4a4a2fb
...@@ -37,6 +37,7 @@ import GHC.Err.Located (undefined) ...@@ -37,6 +37,7 @@ import GHC.Err.Located (undefined)
import GHC.Real (round) import GHC.Real (round)
import Control.Monad.IO.Class (MonadIO) import Control.Monad.IO.Class (MonadIO)
import Data.Maybe (isJust, fromJust, maybe) import Data.Maybe (isJust, fromJust, maybe)
import Data.Text (Text)
import Protolude ( Bool(True, False), Int, Int64, Double, Integer import Protolude ( Bool(True, False), Int, Int64, Double, Integer
, Fractional, Num, Maybe(Just,Nothing) , Fractional, Num, Maybe(Just,Nothing)
, Enum, Bounded, Float , Enum, Bounded, Float
...@@ -269,4 +270,5 @@ maximumWith f = L.maximumBy (compare `on` f) ...@@ -269,4 +270,5 @@ maximumWith f = L.maximumBy (compare `on` f)
listToCombi :: forall a b. (a -> b) -> [a] -> [(b,b)] listToCombi :: forall a b. (a -> b) -> [a] -> [(b,b)]
listToCombi f l = [ (f x, f y) | (x:rest) <- L.tails l, y <- rest ] listToCombi f l = [ (f x, f y) | (x:rest) <- L.tails l, y <- rest ]
head' :: Text -> [a] -> a
head' e xs = maybe (panic e) identity (head xs) head' e xs = maybe (panic e) identity (head xs)
...@@ -32,7 +32,7 @@ import Gargantext.Viz.Phylo.Tools ...@@ -32,7 +32,7 @@ import Gargantext.Viz.Phylo.Tools
relatedComp :: Int -> PhyloGroup -> GroupGraph -> [PhyloGroup] -> [[PhyloGroup]] -> [[PhyloGroup]] relatedComp :: Int -> PhyloGroup -> GroupGraph -> [PhyloGroup] -> [[PhyloGroup]] -> [[PhyloGroup]]
relatedComp idx curr (nodes,edges) next memo relatedComp idx curr (nodes,edges) next memo
| null nodes' && null next' = memo' | null nodes' && null next' = memo'
| (not . null) next' = relatedComp idx (head' "relatedComp1" next') (nodes',edges) (tail next') memo' | (not . null) next' = relatedComp idx (head' "relatedComp1" next' ) (nodes' ,edges) (tail next') memo'
| otherwise = relatedComp (idx + 1) (head' "relatedComp2" nodes') (tail nodes',edges) [] memo' | otherwise = relatedComp (idx + 1) (head' "relatedComp2" nodes') (tail nodes',edges) [] memo'
where where
-------------------------------------- --------------------------------------
...@@ -43,7 +43,7 @@ relatedComp idx curr (nodes,edges) next memo ...@@ -43,7 +43,7 @@ relatedComp idx curr (nodes,edges) next memo
| otherwise = memo ++ [[curr]] | otherwise = memo ++ [[curr]]
-------------------------------------- --------------------------------------
next' :: [PhyloGroup] next' :: [PhyloGroup]
next' = filter (\x -> not $ elem x $ concat memo) $ nub $ next ++ (getNeighbours False curr edges) next' = filter (\x -> not $ elem x $ concat memo) $ nub $ next ++ (getNeighbours True curr edges)
-------------------------------------- --------------------------------------
nodes' :: [PhyloGroup] nodes' :: [PhyloGroup]
nodes' = filter (\x -> not $ elem x next') nodes nodes' = filter (\x -> not $ elem x next') nodes
......
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