var_inherits=function(subClass,superClass){if(typeofsuperClass!=='function'&&superClass!==null){thrownewTypeError('Super expression must either be null or a function, not '+typeofsuperClass);}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)subClass.__proto__=superClass;};
var_inherits=function(subClass,superClass){if(typeofsuperClass!=='function'&&superClass!==null){thrownewTypeError('Super expression must either be null or a function, not '+typeofsuperClass);}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)subClass.__proto__=superClass;};
<p>This is a list of all the methods in the public API. Options can be set directly to the module or you can use the setOptions method of the network itself and use the module name as an object name.</p>
<code>String nodeId</code><br>)</td><tdclass="mid">Array</td><td>Nodes can be in clusters. Clusters can also be in clusters. This function returns and array of nodeIds showing where the node is. Example: <br>
cluster 'A' contains cluster 'B',<br>
cluster 'B' contains cluster 'C',<br>
cluster 'C' contains node 'fred'.<br>
<code>network.clustering.findNode('fred')</code> will return <code>['A','B','C','fred']</code>.
</td></tr>
<tr><td>isCluster(<br>
<code>String nodeId</code><br>)</td><tdclass="mid">Boolean</td><td>Returns true if the node whose ID has been supplied is a cluster.</td></tr>
<tr><td>openCluster(<br>
<code>String nodeId</code><br>)</td><tdclass="mid">none</td><td>Opens the cluster, releases the contained nodes and edges, removing the cluster node and cluster edges.</td></tr>
<tr><td>cluster(<br>
<code>Object options</code><br>)</td><tdclass="mid">none</td><td>The options object is explained in full <ahref="#optionsObject">below</a>. The joinCondition function is presented with all nodes.</td></tr>
<tr><td>clusterByConnection(<br>
<code>String nodeId</code>,<br>
<code>[Object options]</code><br>
)</td><tdclass="mid">none</td><td>This method looks at the provided node and makes a cluster of it and all it's connected nodes. The behaviour can be customized by proving the options object. All options of this object are explained <ahref="#optionsObject">below</a>. The joinCondition is only presented with the connected nodes.</td></tr>
<tr><td>clusterByHubsize(<br>
<code>Number hubsize</code>,<br>
<code>[Object options]</code><br>)</td><tdclass="mid">none</td><td>This method checks all nodes in the network and those with a equal or higher amount of edges than specified with the <code>hubsize</code> qualify. Cluster by connection is performed on each of them. The options object is described for <code>clusterByConnection</code> and does the same here.</td></tr>
<tr><td>clusterOutliers(<br>
<code>[Object options]</code><br>)</td><tdclass="mid">none</td><td>This method will cluster all nodes with 1 edge with their respective connected node.</td></tr>
</table>
<h3>Events</h3>
<p>This is a list of all the events in the public API. They are collected here from all individual modules.</p>
<br>
<h4id="optionsObject">Cluster options object</h4>
<p>The options object supplied to the cluster functions can contain these properties:</p>
<tr><td>startStabilizing</td><tdclass="mid">none</td><td>Fired when stabilization starts. This is also the case when you drag a node and the physics simulation restarts to stabilize again. Stabilization does not neccesarily imply 'without showing'.</td>
<td><i>Optional for all but the cluster method. </i> The cluster module loops over all nodes that are selected to be in the cluster and calls this function with their data as argument.
If this function returns true, this node will be added to the cluster. You have access to all options (including the default)
as well as any custom fields you may have added to the node to determine whether or not to include it in the cluster. Example:
<preclass="code">
{
iterations: Number // iterations so far,
total: Number // total iterations in options
var nodes = [
{id: 4, label: 'Node 4'},
{id: 5, label: 'Node 5'},
{id: 6, label: 'Node 6', cid:1},
{id: 7, label: 'Node 7', cid:1}
]
var options = {
joinCondition:function(nodeOptions) {
return nodeOptions.cid === 1;
}
}
</pre></td><td>Fired when a multiple of the <code>updateInterval</code> number of iterations is reached. This only occurs in the 'hidden' stabilization.</td></tr>
<tr><td>stabilizationIterationsDone</td><tdclass="mid">none</td><td>Fired when the 'hidden' stabilization finishes. This does not necessarily mean the network is stabilized; it could also mean that the amount of iterations defined in the options has been reached.</td>
<tr><td>stabilized</td><tdclass="mid">
network.clustering.cluster(options);
</pre></td></tr>
<tr><td>processProperties(<br> <code>Object nodeOptions</code><br>)</td><tdclass="mid">Function</td><td><i>Optional. </i> Before creating the new cluster node, this (optional) function will be called with the properties supplied by you (<code>clusterNodeProperties</code>), all contained nodes and all contained edges. You can use this to update the
properties of the cluster based on which items it contains. The function should return the properties to create the cluster node. In the example below, we ensure preservation of mass and value when forming the cluster:
<preclass="code">
{
iterations: Number // iterations it took
var options = {
processProperties: function (clusterOptions, childNodes, childEdges) {
</td><td>Fired when the network has stabilized or when the <code>stopSimulation()</code> has been called. The amount of iterations it took could be used to tweak the maximum amount of iterations needed to stabilize the network.</td>
</pre></td></tr>
<tr><td>clusterNodeProperties</td><tdclass="mid">Object</td><td><i>Optional. </i> This is an object containing the options for the cluster node. All options described in the <ahref="./nodes.html">nodes module</a> are allowed. This allows you to style your cluster node any way you want. This is also the style object that is provided in the processProperties function for fine tuning. If undefined, default node options will be used.</td></tr>
<tr><td>clusterEdgeProperties</td><tdclass="mid">Object</td><td><i>Optional. </i> This is an object containing the options for the edges connected to the cluster. All options described in the <ahref="./edges.html">edges module</a> are allowed. Using this, you can style the edges connecting to the cluster any way you want. If none are provided, the optoins from the edges that are replaced are used. If undefined, default edge options will be used.</td></tr>
</table>
<p>
</p>
<br><br>
<h3>Events</h3>
<p>The clustering module does not have any events.</p>
<tr><tdclass="gren"><ahref="./view.html">view</a></td><td>Acts as the camera that looks on the canvas. Does the animation, zooming and focusing.</td></tr>
<tr><tdclass="gren"><ahref="./interaction.html">interaction</a></td><td>Used for all user interaction with the network. Handles mouse and touch events as well as the navigation buttons and the popups.</td></tr>
<tr><tdclass="gren"><ahref="./selection.html">selection</a></td><td>Handles the selection of nodes and edges.</td></tr>
<tr><tdclass="blue"><ahref="./clustering.html">clustering</a></td><td>Provides the clustering api, giving users full control over the formed clusters.</td></tr>
<tr><tdclass="gren"><ahref="./clustering.html">clustering</a></td><td>Provides the clustering api, giving users full control over the formed clusters.</td></tr>
<tr><tdclass="blue"><ahref="./manipulation.html">manipulation</a></td><td>Supplies an API and optional GUI to alter the data in the network.</td></tr>
<trparent="barnesHut"class="hidden"><tdclass="indent">barnesHut.springConstant</td><tdclass="mid">Number</td><tdclass="mid"><code>0.04</code></td><td>This is how 'sturdy' the springs are. Higher values mean stronger springs.</td></tr>
<trparent="barnesHut"class="hidden"><tdclass="indent">barnesHut.damping</td><tdclass="mid">Number</td><tdclass="mid"><code>0.09</code></td><td>Accepted range: <code>[0 .. 1]</code>. The damping factor is how much of the velocity from the previous physics simulation iteration carries over to the next iteration.</td></tr>
<trclass='toggle collapsible'onclick="toggleTable('physicsTable','repulsion');"><td><spanparent="repulsion"class="right-caret"></span> repulsion</td><tdclass="mid">Object</td><tdclass="mid"><code>Object</code></td><td>The repulsion model assumes nodes have a simplified repulsion field around them. It's force linearly decreases from 1 (at 0.5*nodeDistance and smaller) to 0 (at 2*nodeDistance).</td></tr>
<trclass='toggle collapsible'onclick="toggleTable('physicsTable','repulsion', this);"><td><spanparent="repulsion"class="right-caret"></span> repulsion</td><tdclass="mid">Object</td><tdclass="mid"><code>Object</code></td><td>The repulsion model assumes nodes have a simplified repulsion field around them. It's force linearly decreases from 1 (at 0.5*nodeDistance and smaller) to 0 (at 2*nodeDistance).</td></tr>
<trparent="repulsion"class="hidden"><tdclass="indent">repulsion.nodeDistance</td><tdclass="mid">Number</td><tdclass="mid"><code>100</code></td><td>This is the range of influence for the repulsion.</td></tr>
<trparent="repulsion"class="hidden"><tdclass="indent">repulsion.centralGravity</td><tdclass="mid">Number</td><tdclass="mid"><code>0.2</code></td><td>There is a central gravity attractor to pull the entire network back to the center.</td></tr>
<trparent="repulsion"class="hidden"><tdclass="indent">repulsion.springLength</td><tdclass="mid">Number</td><tdclass="mid"><code>200</code></td><td>The edges are modelled as springs. This springLength here is the the rest length of the spring.</td></tr>
<trparent="repulsion"class="hidden"><tdclass="indent">repulsion.springConstant</td><tdclass="mid">Number</td><tdclass="mid"><code>0.05</code></td><td>This is how 'sturdy' the springs are. Higher values mean stronger springs.</td></tr>
<trparent="repulsion"class="hidden"><tdclass="indent">repulsion.damping</td><tdclass="mid">Number</td><tdclass="mid"><code>0.09</code></td><td>Accepted range: <code>[0 .. 1]</code>. The damping factor is how much of the velocity from the previous physics simulation iteration carries over to the next iteration.</td></tr>
<trclass='toggle collapsible'onclick="toggleTable('physicsTable','hierarchicalRepulsion');"><td><spanparent="hierarchicalRepulsion"class="right-caret"></span> hierarchicalRepulsion</td><tdclass="mid">Object</td><tdclass="mid"><code>Object</code></td><td>This model is based on the repulsion solver but the levels are taken into account and the forces are normalized.</td></tr>
<trclass='toggle collapsible'onclick="toggleTable('physicsTable','hierarchicalRepulsion', this);"><td><spanparent="hierarchicalRepulsion"class="right-caret"></span> hierarchicalRepulsion</td><tdclass="mid">Object</td><tdclass="mid"><code>Object</code></td><td>This model is based on the repulsion solver but the levels are taken into account and the forces are normalized.</td></tr>
<trparent="hierarchicalRepulsion"class="hidden"><tdclass="indent">hierarchicalRepulsion.nodeDistance</td><tdclass="mid">Number</td><tdclass="mid"><code>120</code></td><td>This is the range of influence for the repulsion.</td></tr>
<trparent="hierarchicalRepulsion"class="hidden"><tdclass="indent">hierarchicalRepulsion.centralGravity</td><tdclass="mid">Number</td><tdclass="mid"><code>0.0'</code></td><td>There is a central gravity attractor to pull the entire network back to the center.</td></tr>
<trparent="hierarchicalRepulsion"class="hidden"><tdclass="indent">hierarchicalRepulsion.springLength</td><tdclass="mid">Number</td><tdclass="mid"><code>100</code></td><td>The edges are modelled as springs. This springLength here is the the rest length of the spring.</td></tr>
@ -101,7 +101,7 @@
<tr><td>maxVelocity</td><tdclass="mid">Number</td><tdclass="mid"><code>50</code></td><td>The physics module limits the maximum velocity of the nodes to increase the time to stabilization. This is the maximium value.</td></tr>
<tr><td>minVelocity</td><tdclass="mid">Number</td><tdclass="mid"><code>0.1</code></td><td>Once the minimum velocity is reached for all nodes, we assume the network has been stabilized and the simulation stops.</td></tr>
<tr><td>solver</td><tdclass="mid">String</td><tdclass="mid"><code>'barnesHut'</code></td><td>You can select your own solver. Possible options: <code>'barnesHut','repulsion','hierarchicalRepulsion'</code>. When setting the hierarchical layout, the hierarchical repulsion solver is automaticaly selected, regardless of what you fill in here.</td></tr>
<trclass='toggle collapsible'onclick="toggleTable('physicsTable','stabilization');"><td><spanparent="stabilization"class="right-caret"></span> stabilization</td><tdclass="mid">Object | Boolean</td><tdclass="mid"><code>Object</code></td><td>When true, the network is stabilized on load using default settings. If false, stabilization is disabled. To further customize this, you can supply an object.</td></tr>
<trclass='toggle collapsible'onclick="toggleTable('physicsTable','stabilization', this);"><td><spanparent="stabilization"class="right-caret"></span> stabilization</td><tdclass="mid">Object | Boolean</td><tdclass="mid"><code>Object</code></td><td>When true, the network is stabilized on load using default settings. If false, stabilization is disabled. To further customize this, you can supply an object.</td></tr>
<trparent="stabilization"class="hidden"><tdclass="indent">stabilization.enabled</td><tdclass="mid">Boolean</td><tdclass="mid"><code>true</code></td><td>Toggle the stabilization. This is an optional property. If undefined, it is automatically set to true when any of the properties of this object are defined.</td></tr>
<trparent="stabilization"class="hidden"><tdclass="indent">stabilization.iterations</td><tdclass="mid">Number</td><tdclass="mid"><code>1000</code></td><td>The physics module tries to stabilize the network on load up til a maximum number of iterations defined here. If the network stabilized with less, you are finished before the maximum number.</td></tr>
<trparent="stabilization"class="hidden"><tdclass="indent">stabilization.updateInterval</td><tdclass="mid">Number</td><tdclass="mid"><code>100</code></td><td>When stabilizing, the DOM can freeze. You can chop the stabilization up into pieces to show a loading bar for instance. The interval determines after how many iterations the <code>stabilizationProgress</code> event is triggered.</td></tr>