summaryrefslogtreecommitdiff
path: root/preprocess.js
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2014-05-21 12:46:36 +0200
committerPeter Wu <peter@lekensteyn.nl>2014-05-21 12:46:36 +0200
commit830dd5e5d40ed39b435c8d0ab2a834c7abfaf7a0 (patch)
tree374b869d4cac54ec2fc1bc5d0abfd18051df6d8c /preprocess.js
parentdd6e5fbbb759a37262dff252ec20013f25c19546 (diff)
downloadd3viz-830dd5e5d40ed39b435c8d0ab2a834c7abfaf7a0.tar.gz
Color neighbors on hover
Diffstat (limited to 'preprocess.js')
-rw-r--r--preprocess.js3
1 files changed, 3 insertions, 0 deletions
diff --git a/preprocess.js b/preprocess.js
index 831e3cf..904d6be 100644
--- a/preprocess.js
+++ b/preprocess.js
@@ -74,5 +74,8 @@ function preprocess(data, options) {
data.edges.map(function (link) {
link.source = userIds_indices[link.source];
link.target = userIds_indices[link.target];
+ // for faster lookup, store neighboring nodes per node
+ data.nodes[link.source].related.push(link.target);
+ data.nodes[link.target].related.push(link.source);
});
}