/// <summary> /// Clusters the specified points using the specified value and minimum points to form a cluster. /// </summary> /// <param name="points">The points to cluster.</param> /// <param name="eps">The value to use to find neighoring points.</param> /// <param name="minimumClusterCount">The minimum number of points to form a cluster.</param> /// <returns>The number of clusters created from the collection.</returns> public static int Dbscan <XType, YType>(IDbscanPoint <XType, YType>[] points, int eps, int minimumClusterCount) { int cid = 0; foreach (IDbscanPoint <XType, YType> p in points) { if (!p.IsVisited) { p.IsVisited = true; IDbscanPoint <XType, YType>[] neighbors = DbscanAlgorithm.GetNeighors(points, p, eps); if (neighbors.Length < minimumClusterCount) { p.IsNoise = true; } else { cid += 1; DbscanAlgorithm.ExpandCluster(points, p, neighbors, cid, eps, minimumClusterCount); } } } return(cid); }