Exemplo n.º 1
0
        public void GraphParsing_ShouldNotParseBadXml()
        {
            var    parsingService = GraphParsing.FromFileExtention(".xml");
            Action subject        = () => parsingService.ParseGraphContentFile(_xmlBadData, new GraphBuilder());

            subject.Should().Throw <GraphParsingException>();
        }
Exemplo n.º 2
0
        public void GraphParsing_ShouldCorrectlyParseXml()
        {
            var parsingService = GraphParsing.FromFileExtention(".xml");
            var result         = parsingService.ParseGraphContentFile(_xmlData, new GraphBuilder());

            result.Should().NotBeEmpty();
        }
Exemplo n.º 3
0
        public static void RunOnData(string graphPath, string resultDir)
        {
            var globalVectorType = GlobalVectorType.Sum;
            var epsilon          = new ThresholdEpsilon(10);
            var numOfNodes       = 2;
            var fileName         = $"SpectralGap__YoutubeGraph__Nodes_{numOfNodes}.csv";
            var resultPath       = Path.Combine(resultDir, fileName);
            var operations       = GraphParsing.ReadGraph(graphPath);
            var initGraph        = (GraphOperation.InitGraph)operations.First();
            var numOfVerices     = initGraph.NumOfVertices;

            using (var resultCsvFile = File.CreateText(resultPath))
            {
            }


            Process.Start(resultPath);
        }
Exemplo n.º 4
0
        private void DisplayGraphs(string fileName)
        {
            if (File.Exists(fileName))
            {
                var fileInfo = new FileInfo(fileName);

                try
                {
                    var parser = GraphParsing.FromFileExtention(fileInfo.Extension);
                    var graphs = parser.ParseGraphContentFile(File.ReadAllText(fileName), new GraphBuilder());

                    Graph.DrawGraph(graphs.ToList());
                }
                catch (Exception e)
                {
                    MessageBox.Show("Error: Unable to proceed with this file", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
            else
            {
                MessageBox.Show("Error: selected file does not exist!", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Exemplo n.º 5
0
        public void GraphParsing_ShouldCreateCorrectParsingService(string extention, Type correctType)
        {
            var parsingService = GraphParsing.FromFileExtention(extention);

            parsingService.Should().BeOfType(correctType);
        }