Beispiel #1
0
 public RootCluster(Cluster firstCluster, Cluster secondCluster, LinkageFunctionTypes linkageFunction, DistanceMeasurementTypes distanceMeasurement)
 {
     FirstCluster  = firstCluster;
     SecondCluster = secondCluster;
     Distance      = LinkageFunctionHelper.Calculate(linkageFunction, distanceMeasurement, FirstCluster, SecondCluster);
     FirstCluster.ComputeDistance(linkageFunction, distanceMeasurement);
     SecondCluster.ComputeDistance(linkageFunction, distanceMeasurement);
 }
        public void ComputeDistance(LinkageFunctionTypes linkageFunction, DistanceMeasurementTypes distanceMeasurement)
        {
            if (Child == null)
            {
                Distance = LinkageFunctionHelper.Calculate(linkageFunction, distanceMeasurement, new List <double[]> {
                    FirstDatapoint
                }, new List <double[]> {
                    SecondDatapoint
                });;
                return;
            }

            Distance = LinkageFunctionHelper.Calculate(linkageFunction, distanceMeasurement, new List <double[]> {
                FirstDatapoint
            }, Child.GetAllDatapoints());
            Child.ComputeDistance(linkageFunction, distanceMeasurement);
        }