From 1966421975e60c836f1fd1540705a44ed0e38c69 Mon Sep 17 00:00:00 2001 From: Pitchaya Boonsarngsuk <2285135b@student.gla.ac.uk> Date: Wed, 31 Jan 2018 08:37:23 +0000 Subject: [PATCH] Added comment, clean up stub API --- src/link.js | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/link.js b/src/link.js index 8037180..f04012b 100644 --- a/src/link.js +++ b/src/link.js @@ -4,6 +4,7 @@ import jiggle from "./jiggle"; /** * Modified link force algorithm * - simplify calculations for parameters locked for spring model + * - replace the use of links {} with loop. greatly reduce memory usage * - removed other unused functions * Alpha should be constant 1 for accurate simulation */ @@ -39,6 +40,7 @@ export default function(links) { function initialize() { if (!nodes) return; + // 0.5 to divide the force to two part for source and target node dataSizeFactor = 0.5/(nodes.length-1); initializeDistance(); } @@ -57,14 +59,6 @@ export default function(links) { initialize(); }; - force.links = function(_) { - return arguments.length ? (links = _, initialize(), force) : links; - }; - - force.id = function(_) { - return arguments.length ? (id = _, force) : id; - }; - force.iterations = function(_) { return arguments.length ? (iterations = +_, force) : iterations; };