Exemple #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}");
            }
        }
Exemple #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}");
            }
        }