Add extra end condition for hybrid phase 3
This commit is contained in:
@@ -151,9 +151,9 @@ The hybrid layout algorithm reduces the computation power usage even further by
|
||||
|
||||
Creates a new hybrid layout simulation default parameters. The simulation will takeover control of [d3.forceSimulation](https://github.com/d3/d3-force#forceSimulation) provided (*simulation* parameter). *forceSample* and *forceFull* are pre-configured [d3.forceNeighbourSampling](#forceNeighbourSampling) forces to be run over the $\sqrt{n}$ samples and full dataset respectively. While unsupported, other D3 forces such as [d3.forceLinkFullyConnected](forceLinkFullyConnected) may also work.
|
||||
|
||||
*forceSample* may have [stableVelocity](neighbourSampling_stableVelocity) configured to end the simulation and begin the interpolation phase early, but any [handler](neighbourSampling_onStableVelo) functions will be replaced be hybridSimulation's own internal function.
|
||||
*forceSample* and *forceFull* may have [stableVelocity](neighbourSampling_stableVelocity) configured to end the simulation and begin the interpolation phase early, but any [handler](neighbourSampling_onStableVelo) functions will be replaced be hybridSimulation's own internal function.
|
||||
|
||||
*forceSample* may be absent, null, or undefined to skip the final refinement.
|
||||
*forceFull* may also be absent, null, or undefined to skip the final refinement.
|
||||
|
||||
*simulation* should have already been loaded with nodes. If there are any changes in the list of nodes, the simulation have to be re-set using the [.simulation](#hybrid_simulation) method.
|
||||
|
||||
@@ -175,7 +175,7 @@ If *force* is specified, sets the neighbour and sampling force to run on the $\s
|
||||
|
||||
<a name="hybrid_forceFull" href="#hybrid_forceFull">#</a> *hybrid*.**forceFull**([*force*])
|
||||
|
||||
If *force* is specified, sets the neighbour and sampling force to run on the whole dataset after interpolation and returns this layout simulation. If set to null, the process will be skipped. If *force* is not specified, returns the current force object.
|
||||
If *force* is specified, sets the neighbour and sampling force to run on the whole dataset after interpolation and returns this layout simulation. The same limitation applies: [stableVelocity](neighbourSampling_stableVelocity) may be configured to end the simulation and begin the interpolation phase early, but any [handler](neighbourSampling_onStableVelo) functions will be replaced be hybridSimulation's own internal function. If set to null, the process will be skipped. If *force* is not specified, returns the current force object.
|
||||
|
||||
<a name="hybrid_sampleIterations" href="#hybrid_sampleIterations">#</a> *hybrid*.**sampleIterations**([*iterations*])
|
||||
|
||||
|
||||
@@ -63,6 +63,10 @@ export default function (sim, forceS, forceF) {
|
||||
forceSample.onStableVelo(sampleEnded);
|
||||
}
|
||||
|
||||
if (forceFull.onStableVelo) {
|
||||
forceFull.onStableVelo(fullEnded);
|
||||
}
|
||||
|
||||
// Set default value for interpDistanceFn if not been specified yet
|
||||
if(interpDistanceFn === undefined) {
|
||||
if(forceFull.distance == 'function')
|
||||
@@ -96,6 +100,11 @@ export default function (sim, forceS, forceF) {
|
||||
function fullTick() {
|
||||
event.call("fullTick");
|
||||
if(++alreadyRanIterations >= FULL_ITERATIONS){
|
||||
fullEnded();
|
||||
}
|
||||
}
|
||||
|
||||
function fullEnded() {
|
||||
simulation.stop();
|
||||
initAlready = false;
|
||||
simulation.force("Full force", null);
|
||||
|
||||
Reference in New Issue
Block a user