Пример #1
0
        public void SetParam_InputFile()
        {
            var graphMLReader = new GraphMLAdjListReader();
            string file = Path.Combine(Environment.CurrentDirectory, _testFile);
            graphMLReader.SetParam(NetworkReaderParameterNames._INPUT_FILE, file);

            Assert.Equal(graphMLReader.File, file);
        }
Пример #2
0
        public void Read_Failure_When_NestedGraphs_In_InputFile(string testItemInput)
        {
            //Arrange
            GraphMLTestItem testItem = ReadTestItem(testItemInput);
            Assert.NotNull(testItem);

            GraphMLAdjListReader reader = new GraphMLAdjListReader();
            reader.File = Path.Combine(Properties.Resources.GraphML_TestDataPath, testItem.FileName);

            //Act, Assert
            var ex = Assert.Throws<InvalidOperationException>(() => reader.Read());
        }
Пример #3
0
        public static INetworkFileReader CreateReader(NetworkFileTypes fileType)
        {
            INetworkFileReader reader = null;

            if (fileType == NetworkFileTypes.UCINet_DL)
            {
                reader = new DLImporter();
            }
            else if (fileType == NetworkFileTypes.Pajek_Net)
            {
                reader = new NetFileReader();
            }
            else if (fileType == NetworkFileTypes.GraphML)
            {
                reader = new GraphMLAdjListReader();
            }
            return reader;
        }
Пример #4
0
        public static INetworkFileReader CreateReader(string file)
        {
            INetworkFileReader reader = null;

            string extension = Path.GetExtension(file);

            if (string.Compare(extension, BlueSpider.Blob.IO.Providers.Properties.Resources.Extension_UCINetDLFile, true) == 0)
            {
                reader = new DLImporter();
            }
            else if (string.Compare(extension, BlueSpider.Blob.IO.Providers.Properties.Resources.Extension_PajekNetFile, true) == 0)
            {
                reader = new NetFileReader();
            }
            else if (string.Compare(extension, BlueSpider.Blob.IO.Providers.Properties.Resources.Extension_GraphMLFile, true) == 0)
            {
                reader = new GraphMLAdjListReader();
            }

            return reader;
        }
Пример #5
0
        public void Read_FilesToAdjList(string testItemInput)
        {
            GraphMLTestItem testItem = ReadTestItem(testItemInput);
            Assert.NotNull(testItem);

            GraphMLAdjListReader reader = new GraphMLAdjListReader();
            reader.File = Path.Combine(Properties.Resources.GraphML_TestDataPath, testItem.FileName);
            reader.Read();

            IAdjList network = reader.NetworkAdjList;

            if (testItem.IsPassExpected)
            {
                Assert.NotNull(network);
                Assert.Equal(testItem.NetworkName, network.Name);
                Assert.Equal(testItem.NodeCount, network.NodeCount);
                Assert.Equal(testItem.EdgeCount, network.EdgeCount);
                Assert.Equal(testItem.IsDirected, network.IsDirected);
                Assert.Equal(testItem.NodeKeyCount, network.NodeAttributeCount);
                Assert.Equal(testItem.EdgeKeyCount, network.EdgeAttributeCount);
            }
        }