private Pair < long [ ] , ArrayModifiableDBIDs > findParent ( Relation < V > relation , Pair < long [ ] , ArrayModifiableDBIDs > child , Object2ObjectMap < long [ ] , List < ArrayModifiableDBIDs > > clustersMap ) { Centroid child_centroid = ProjectedCentroid . make ( child . first , relation , child . second ) ; Pair < long [ ] , ArrayModifiableDBIDs > result = null ; int resultCardinality = - 1 ; long [ ] childPV = child . first ; int childCardinality = BitsUtil . cardinality ( childPV ) ; for ( long [ ] parentPV : clustersMap . keySet ( ) ) { int parentCardinality = BitsUtil . cardinality ( parentPV ) ; if ( parentCardinality >= childCardinality || ( resultCardinality != - 1 && parentCardinality <= resultCardinality ) ) { continue ; } long [ ] pv = BitsUtil . andCMin ( childPV , parentPV ) ; if ( BitsUtil . equal ( pv , parentPV ) ) { List < ArrayModifiableDBIDs > parentList = clustersMap . get ( parentPV ) ; for ( ArrayModifiableDBIDs parent : parentList ) { NumberVector parent_centroid = ProjectedCentroid . make ( parentPV , relation , parent ) ; double d = weightedDistance ( child_centroid , parent_centroid , parentPV ) ; if ( d <= 2 * epsilon ) { result = new Pair <> ( parentPV , parent ) ; resultCardinality = parentCardinality ; break ; } } } } return result ; }
Returns the parent of the specified cluster