Exemplo n.º 1
0
        /// <summary>
        /// Reads a .cluster file into a partition
        /// </summary>
        /// <param name="filename"></param>
        public Partition(String filename)
        {
            Clusters = new List <Cluster>();

            using (StreamReader sr = new StreamReader(filename))
            {
                String dataString   = sr.ReadLine();
                String dataType     = dataString.Substring(0, dataString.IndexOf(' '));
                String dataFileName = dataString.Substring(dataString.IndexOf(' ') + 1);
                String folder       = filename.Substring(0, filename.LastIndexOf('\\'));

                //Get the DataPoints
                switch (dataType)
                {
                case "Points":
                    Data = new PointSet(dataFileName);
                    break;

                case "DistanceMatrix":
                    Data = new DistanceMatrix(dataFileName);
                    break;

                case "Graph":
                    String extension = dataFileName.Substring(dataFileName.LastIndexOf('.') + 1);
                    if (extension == "gml")
                    {
                        Data = LightWeightGraph.GetGraphFromGML(dataFileName);
                    }
                    else if (extension == "graph")
                    {
                        Data = LightWeightGraph.GetGraphFromFile(dataFileName);
                    }
                    break;

                default:
                    throw new InvalidDataException("dataType");
                }


                //Parse the Clusters
                String line        = sr.ReadLine();
                int    numClusters = int.Parse(line.Split(' ')[1]);

                for (int i = 0; i < numClusters; i++)
                {
                    Cluster C        = new Cluster(i);
                    int     numItems = int.Parse(sr.ReadLine());
                    line = sr.ReadLine();
                    String[] split = line.Split(' ');
                    for (int k = 0; k < numItems; k++)
                    {
                        int pointIndex = int.Parse(split[k]);
                        C.AddPoint(new ClusteredItem(pointIndex));
                    }
                    Clusters.Add(C);
                }
            }
        }
Exemplo n.º 2
0
        public void DeleteDataset(AbstractDataset dataset)
        {
            if (dataset == null)
            {
                Log.Warn("[PersonController.DeleteDataset] try to delete empty dataset");
                return;
            }

            StoreProvider.DeleteEntry(dataset.GetType().Name, dataset.ToDictionary());
        }
Exemplo n.º 3
0
        public void SaveDataset(AbstractDataset dataset)
        {
            if (dataset == null)
            {
                Log.Warn("[PersonController.SavePerson] try to save empty dataset");
                return;
            }

            // TODO: set Id as Primary-Field
            // actual the first property is primary if Store does not exist
            StoreProvider.UpdateStore(dataset.GetType().Name, dataset.ToDictionary());
        }
Exemplo n.º 4
0
 /// <summary>
 /// Creates a Dataset partition
 /// </summary>
 /// <param name="clusters">List of clusters</param>
 /// <param name="data">The dataset used to create the partition</param>
 /// <param name="m">Meta Data about the partition</param>
 public Partition(List <Cluster> clusters, AbstractDataset data, String m = "")
 {
     Clusters = clusters;
     MetaData = m;
     Data     = data;
 }
Exemplo n.º 5
0
 public HIntegrityClust(LightWeightGraph data, int k, bool weighted, double alpha = 1.0f, double beta = 0.0f, bool reassignNodes = true, bool hillClimb = true)
     : this(k, weighted, null, alpha, beta, reassignNodes, hillClimb)
 {
     _data = data;
 }
Exemplo n.º 6
0
 public HIntegrityClust(AbstractDataset data, int k, IPointGraphGenerator graphGen, bool weighted = true, double alpha = 1.0f, double beta = 0.0f, bool reassignNodes = true, bool hillClimb = true)
     : this(k, weighted, graphGen, alpha, beta, reassignNodes, hillClimb)
 {
     _data = data;
 }
Exemplo n.º 7
0
        //public HVatABCClust(AbstractDataset data, int minK, IPointGraphGenerator graphGen, bool weighted = true, double alpha = 1.0f, double beta = 0.0f, bool reassignNodes = true, bool hillClimb = true)
        //    : this(minK, M, K, weighted, graphGen, alpha, beta, reassignNodes, hillClimb)
        // {
        //    _data = data;
        // }

        public HVatABCClust(LightWeightGraph data, int minK, int myM, int myK, bool weighted, double alpha = 1.0f, double beta = 0.0f, bool reassignNodes = true, bool hillClimb = true)
            : this(minK, weighted, myM, myK, null, alpha, beta, reassignNodes, hillClimb)
        {
            _data = data;
        }
Exemplo n.º 8
0
 public HyperVATClust(List <List <int> > overlaps, LightWeightGraph data, int k, bool weighted, double alpha = 1.0f, double beta = 0.0f, bool reassignNodes = true, bool hillClimb = true)
     : this(overlaps, k, weighted, null, alpha, beta, reassignNodes, hillClimb)
 {
     _data = data;
 }
Exemplo n.º 9
0
 public HyperVATClust(List <List <int> > overlaps, AbstractDataset data, int k, IPointGraphGenerator graphGen, bool weighted = true, double alpha = 1.0f, double beta = 0.0f, bool reassignNodes = true, bool hillClimb = true)
     : this(overlaps, k, weighted, graphGen, alpha, beta, reassignNodes, hillClimb)
 {
     _data = data;
 }
Exemplo n.º 10
0
 public TransportDataset(AbstractDataset dataset) => this.dataset = dataset;