示例#1
0
        /// <summary>
        /// Loads all vetices from a file.
        /// </summary>
        /// <param name="filename"> A file containing data of edges. </param>
        private void LoadEdges(string filename)
        {
            try
            {
                var reader    = new DataFileReader(filename);
                var processor = new EdgeListProcessor();
                processor.PassParameters(edgeTables, vertices);
                var creator = new CreatorFromFile <EdgeListHolder>(reader, processor);
                var result  = creator.Create();
                this.outEdges = result.outEdges;
                this.inEdges  = result.inEdges;
            }
            catch (Exception e)
            {
                throw new Exception($"Loading of the edges failed. File: {filename} / Error: {e.GetType()} {e.Message}. Try checking the format of the file and the order of the properties based on the scheme.");
            }

            if (this.outEdges == null || this.outEdges.Count == 0)
            {
                throw new ArgumentException($"{this.GetType()} Out edges of the graph are empty. Filename = {filename}");
            }
            if (this.inEdges == null || this.inEdges.Count == 0)
            {
                throw new ArgumentException($"{this.GetType()} In edges of the graph are empty. Filename = {filename}");
            }
        }
示例#2
0
        /// <summary>
        /// Loads all vetices from a file.
        /// </summary>
        /// <param name="filename"> A file containing data of vertices. </param>
        private void LoadVertices(string filename)
        {
            try
            {
                var reader    = new DataFileReader(filename);
                var processor = new VerticesListProcessor();
                processor.PassParameters(nodeTables);
                var creator = new CreatorFromFile <List <Vertex> >(reader, processor);
                this.vertices = creator.Create();
            }
            catch (Exception e)
            {
                throw new Exception($"Loading of the vertices failed. File: {filename} / Error: {e.GetType()} {e.Message}. Try checking the format of the file and the order of the properties based on the scheme.");
            }

            if (this.vertices == null || this.vertices.Count == 0)
            {
                throw new ArgumentException($"{this.GetType()}, vertices of the graph are empty. Filename = {filename}");
            }
        }
示例#3
0
        /// <summary>
        /// Loads table types from a file.
        /// </summary>
        /// <param name="filename"> A file containing definitions of tables. </param>
        /// <returns> A Dictionary of tables. </returns>
        private Dictionary <string, Table> LoadTables(string filename)
        {
            Dictionary <string, Table> tables = null;

            try
            {
                var reader    = new TableFileReader(filename);
                var processor = new TableDictProcessor();
                processor.PassParameters(labels);
                var creator = new CreatorFromFile <Dictionary <string, Table> >(reader, processor);
                tables = creator.Create();
            }
            catch (Exception e)
            {
                throw new Exception($"Loading of the tables failed. File: {filename} / Error: {e.GetType()} {e.Message}. Try checking the format of the file.");
            }

            if (tables == null || tables.Count == 0)
            {
                throw new ArgumentException($"{this.GetType()}, tables of the graph are empty. File: {filename}");
            }
            return(tables);
        }