/** * Initialize the hybrid layout algorithm and start simulation. */ function startHybridSimulation() { console.log("startHybridSimulation"); springForce = false; d3.selectAll(".nodes").remove(); simulation.stop(); p1 = performance.now(); configuration = { iteration: ITERATIONS, neighbourSize: NEIGHBOUR_SIZE, sampleSize: SAMPLE_SIZE, distanceRange: SELECTED_DISTANCE * MULTIPLIER, fullIterations: FULL_ITERATIONS, fullNeighbourSize: FULL_NEIGHBOUR_SIZE, fullSampleSize: FULL_SAMPLE_SIZE, fullDistanceRange: FULL_SELECTED_DISTANCE * MULTIPLIER, distanceFn: function (s, t) {return distanceFunction(s, t, props, norm) * MULTIPLIER;}, pivots: PIVOTS, numPivots: NUM_PIVOTS }; console.log(configuration); hybridSimulation = d3.hybridSimulation(nodes, configuration); let sample = hybridSimulation.sample(); let remainder = hybridSimulation.remainder(); addNodesToDOM(sample); hybridSimulation .on("sampleTick", ticked) .on("fullTick", ticked) .on("startFull", startedFull) .on("end", ended); function startedFull() { console.log("startedFull"); d3.selectAll(".nodes").remove(); addNodesToDOM(nodes); } }