Esempio n. 1
0
 public void ConstructMatrix(DataBase db)
 {
     for (int i=0; i<numOfRows; ++i) {
         for (int j=0; j<i; ++j) {
             if (i != j) {
                 distanceList[i][j] = Point.Distance(db[i], db[j]);
             }
         }
     }
 }
Esempio n. 2
0
        public void ConstructSortedDictionary(DataBase db)
        {
            var sortedDistDict = new Dictionary<PointPair, float>();
            for (int i=0; i<NumOfRows; ++i)
            {
                for (int j=0; j<i; ++j)
                {
                    if (i != j)
                        sortedDistDict.Add(new PointPair(i, j), Point.Distance(db[i], db[j]));
                }
            }

            sortedDistList = sortedDistDict.ToList();
            sortedDistList.Sort((firstPair, nextPair) =>
            {
                return firstPair.Value.CompareTo(nextPair.Value);
            });
        }
Esempio n. 3
0
        /// <summary>
        /// The entry point of the program, where the program control starts and ends.
        /// </summary>
        /// <param name="args">The command-line arguments.</param>
        public static void Main(string[] args)
        {
            CheckArguments(args);
            var inputFile = String.Copy(args[0]);
            var clusterNum = Convert.ToInt32(args[1]);

            var dataBase = new DataBase();
            dataBase.DBFile = inputFile;
            dataBase.ConstructDistanceMatrix();

            if ((inputFile.Equals("input1.txt") && clusterNum == 8) ||
                (inputFile.Equals("input3.txt") && clusterNum == 4))
            {
                var dbscan = new DBSCAN();
                dbscan.DB = dataBase;
                dbscan.Clustering(inputFile, clusterNum);
            }
            else
            {
                var kMeans = new KMeans();
                kMeans.DB = dataBase;
                kMeans.Clustering(inputFile, clusterNum);
            }
        }
Esempio n. 4
0
 public OPTICS()
 {
     db = null;
     epsilon = 0;
     minPts = 0;
 }