@ -161,8 +161,7 @@ class ClusterEngine {
// collect the nodes that will be in the cluster
// collect the nodes that will be in the cluster
util . forEach ( this . body . nodes , ( node , nodeId ) => {
util . forEach ( this . body . nodes , ( node , nodeId ) => {
let clonedOptions = NetworkUtil . cloneOptions ( node ) ;
if ( options . joinCondition ( clonedOptions ) === true ) {
if ( node . options && options . joinCondition ( node . options ) === true ) {
childNodesObj [ nodeId ] = node ;
childNodesObj [ nodeId ] = node ;
// collect the edges that will be in the cluster
// collect the edges that will be in the cluster
@ -1222,7 +1221,7 @@ class ClusterEngine {
_updateState ( ) {
_updateState ( ) {
let nodeId ;
let nodeId ;
let deletedNodeIds = [ ] ;
let deletedNodeIds = [ ] ;
let deletedEdgeIds = [ ] ;
let deletedEdgeIds = { } ;
/ * *
/ * *
* Utility function to iterate over clustering nodes only
* Utility function to iterate over clustering nodes only
@ -1273,7 +1272,7 @@ class ClusterEngine {
util . forEach ( this . clusteredEdges , ( edgeId ) => {
util . forEach ( this . clusteredEdges , ( edgeId ) => {
let edge = this . body . edges [ edgeId ] ;
let edge = this . body . edges [ edgeId ] ;
if ( edge === undefined || ! edge . endPointsValid ( ) ) {
if ( edge === undefined || ! edge . endPointsValid ( ) ) {
deletedEdgeIds . push ( edgeId ) ;
deletedEdgeIds [ edgeId ] = edgeId ;
}
}
} ) ;
} ) ;
@ -1282,8 +1281,8 @@ class ClusterEngine {
// So the cluster nodes also need to be scanned for invalid edges
// So the cluster nodes also need to be scanned for invalid edges
eachClusterNode ( function ( clusterNode ) {
eachClusterNode ( function ( clusterNode ) {
util . forEach ( clusterNode . containedEdges , ( edge , edgeId ) => {
util . forEach ( clusterNode . containedEdges , ( edge , edgeId ) => {
if ( ! edge . endPointsValid ( ) && deletedEdgeIds . indexOf ( edgeId ) === - 1 ) {
deletedEdgeIds . push ( edgeId ) ;
if ( ! edge . endPointsValid ( ) && ! deletedEdgeIds [ edgeId ] ) {
deletedEdgeIds [ edgeId ] = edgeId ;
}
}
} ) ;
} ) ;
} ) ;
} ) ;
@ -1309,7 +1308,7 @@ class ClusterEngine {
}
}
if ( ! edge . endPointsValid ( ) || ! isValid ) {
if ( ! edge . endPointsValid ( ) || ! isValid ) {
deletedEdgeIds . push ( edgeId ) ;
deletedEdgeIds [ edgeId ] = edgeId ;
}
}
} ) ;
} ) ;
@ -1325,7 +1324,7 @@ class ClusterEngine {
}
}
edge . clusteringEdgeReplacingIds = this . _filter ( edge . clusteringEdgeReplacingIds , function ( id ) {
edge . clusteringEdgeReplacingIds = this . _filter ( edge . clusteringEdgeReplacingIds , function ( id ) {
return deletedEdgeIds . indexOf ( id ) === - 1 ;
return ! deletedEdgeIds [ id ] ;
} ) ;
} ) ;
} ) ;
} ) ;