예제 #1
0
파일: DBSCAN.cs 프로젝트: targeton/DBSCAN
 private void ExpandCluster(ScanPoint corePoint, List <ScanPoint> nearPoint, int clusterNum, double radius, int minPts)
 {
     corePoint.PointType  = PointType.Core;
     corePoint.ClusterNum = clusterNum;
     foreach (var p in nearPoint)
     {
         if (p.VisitedType == VisitedType.Unvisited)
         {
             p.VisitedType = VisitedType.Visited;
             List <ScanPoint> neighborPoints = GetRegionPoints(p, radius);
             if (neighborPoints.Count >= minPts)
             {
                 ExpandCluster(p, neighborPoints, clusterNum, radius, minPts);
             }
             else
             {
                 p.PointType  = PointType.Edge;
                 p.ClusterNum = clusterNum;
             }
         }
         else
         {
             if (p.ClusterNum < 0)
             {
                 p.PointType  = PointType.Edge;
                 p.ClusterNum = clusterNum;
             }
         }
     }
 }
예제 #2
0
파일: DBSCAN.cs 프로젝트: targeton/DBSCAN
        private List <ScanPoint> GetRegionPoints(ScanPoint corePoint, double radius)
        {
            List <ScanPoint> result      = new List <ScanPoint>();
            List <ScanPoint> otherPoints = _allPoints.Except(new List <ScanPoint>()
            {
                corePoint
            }).ToList();

            foreach (var p in otherPoints)
            {
                if (_calculateDistance(corePoint, p) <= radius)
                {
                    result.Add(p);
                }
            }
            return(result);
        }