Commit 24a0af39 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[FEAT] Confluence added (test KO).

parent 32783b34
......@@ -34,17 +34,39 @@ type We = Bool
similarity_CONF_x_y :: Graph_Undirected -> (Node,Node) -> Length -> FalseReflexive -> We -> Double
similarity_CONF_x_y g (x,y) l r _w = prox_x_y / (prox_x_y + lim_SC)
similarity_CONF_x_y g (x,y) l r we = similarity
where
similarity :: Double
similarity | denominator == 0 = 0
| otherwise = prox_x_y / denominator
where
denominator = prox_x_y + lim_SC
prox_x_y :: Double
prox_x_y = maybe 0 identity $ Map.lookup y xline
xline :: Map Node Double
xline = prox_markov g [x] l r filterNeighbors
xline = prox_markov g [x] l r filterNeighbors'
where
filterNeighbors' = if we then filterNeighbors
else rm_edge_neighbors y
pair_is_edge :: Bool
pair_is_edge = if we then False
else List.elem y (filterNeighbors g x)
lim_SC :: Double
lim_SC = (degree g y + 1 ) / (2 * (ecount g) + (vcount g))
lim_SC
| count == 0 = 0
| otherwise = if pair_is_edge
then (degree g y + 1-1) / count
else (degree g y + 1 ) / count
where
count = if pair_is_edge
then (2 * (ecount g) + (vcount g) - 2)
else (2 * (ecount g) + (vcount g))
rm_edge_neighbors :: Node -> Graph_Undirected -> Node -> [Node]
rm_edge_neighbors b g a = List.filter (\x -> (x /= a) || (x /= b)) $ filterNeighbors g a
-- | TODO do as a Map instead of [Node] ?
prox_markov :: Graph_Undirected -> [Node] -> Length -> FalseReflexive -> NeighborsFilter -> Map Node Double
......
......@@ -78,17 +78,10 @@ data2graph labels coocs distance partitions = Graph nodes edges Nothing
, edge_id = cs (show i) }
| (i, ((s,t), w)) <- zip ([0..]::[Integer]) (Map.toList distance) ]
------------------------------------------------------------------------
data Layout = KamadaKawai | ACP | ForceAtlas
setCoord'' :: Layout -> (Int, Node) -> Node
setCoord'' ForceAtlas = setCoord' (\i-> (sin $ fromIntegral i, cos $ fromIntegral i))
setCoord'' ACP = undefined
setCoord'' KamadaKawai = undefined
setCoord' :: (Int -> (Double, Double)) -> (Int, Node) -> Node
setCoord' f (i,n) = n { node_x_coord = x, node_y_coord = y }
......
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