aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Bedo <cu@cua0.org>2023-01-17 14:59:10 +1100
committerJustin Bedo <cu@cua0.org>2023-01-17 17:41:27 +1100
commit0e45006f1f5a5c0837aef19726a496394fff2436 (patch)
treee2c2e0c913a8b2a91d65f1fc9323b844e8751537
parent4f82de5bbcd6dc17256d73551bb68b4ee8de454e (diff)
scale graph nodes to parent
-rw-r--r--bin/cluster.hs4
1 files changed, 2 insertions, 2 deletions
diff --git a/bin/cluster.hs b/bin/cluster.hs
index 8d1745d..4d67541 100644
--- a/bin/cluster.hs
+++ b/bin/cluster.hs
@@ -92,9 +92,9 @@ drawGraph path ps cl = writeFile path $ "digraph{" <> edges <> "}"
fmtDbl = show . (/ 10) . fromIntegral . round . (* 1000)
ps' = transpose $ map norm ps
- -- Normalise to purity of first node
+ -- Normalise to frequency of parent
norm :: [Double] -> [Double]
- norm (x : xs) = x : map (/ x) xs
+ norm xxs@(x : xs) = x : zipWith (\i y -> y / xxs !! parent i) [1..] xs
-- Command line args
data Options = Options