@ -524,21 +524,26 @@ class ClusterEngine {
* @ private
* /
_cluster ( childNodesObj , childEdgesObj , options , refreshData = true ) {
// kill condition: no nodes don't bother
if ( Object . keys ( childNodesObj ) . length == 0 ) { return ; }
// allow clusters of 1 if options allow
if ( Object . keys ( childNodesObj ) . length == 1 && options . clusterNodeProperties . allowSingleNodeCluster != true ) { return ; }
// check if this cluster call is not trying to cluster anything that is in another cluster.
// Remove nodes which are already clustered
var tmpNodesToRemove = [ ]
for ( let nodeId in childNodesObj ) {
if ( childNodesObj . hasOwnProperty ( nodeId ) ) {
if ( this . clusteredNodes [ nodeId ] !== undefined ) {
return ;
tmpNodesToRemove . push ( nodeId ) ;
}
}
}
for ( var n = 0 ; n < tmpNodesToRemove . length ; ++ n ) {
delete childNodesObj [ tmpNodesToRemove [ n ] ] ;
}
// kill condition: no nodes don't bother
if ( Object . keys ( childNodesObj ) . length == 0 ) { return ; }
// allow clusters of 1 if options allow
if ( Object . keys ( childNodesObj ) . length == 1 && options . clusterNodeProperties . allowSingleNodeCluster != true ) { return ; }
let clusterNodeProperties = util . deepExtend ( { } , options . clusterNodeProperties ) ;
// construct the clusterNodeProperties