public void Write_Writes_Out_The_Vna_File(string inFileName, string outFileName, int defaultNodeMapIndex, int defaultEdgeMapIndex, bool exportNodeData, bool exportEdgeData, bool isDirected)
        {
            var basicAdjListWriter = new VNABasicAdjListWriter();
            IBasicAdjList net = null;
            using (var reader = new VnaAdjListReader())
            {
                reader.File = Path.Combine(_dataDir, inFileName);
                reader.Read();
                net = reader.Network as IBasicAdjList;
            }

            string outputFile = Path.Combine(_testDir, outFileName);

            basicAdjListWriter.NodeIdentifierAttributeIndex = defaultNodeMapIndex;
            basicAdjListWriter.EdgeIdentifierAttributeIndex = defaultEdgeMapIndex;
            basicAdjListWriter.ExportNodeAttributes = exportNodeData;
            basicAdjListWriter.ExportEdgeAttributes = exportEdgeData;
            basicAdjListWriter.FileName = outputFile;
            basicAdjListWriter.InputNetwork = net;

            basicAdjListWriter.Write();

            bool exists = File.Exists(outputFile);
            Assert.True(exists);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creates and returns a writer.
        /// </summary>
        /// <param name="fileType">A <see cref="NetworkFileTypes"/> value specifying the intended output format.</param>
        /// <param name="network">The source INetwork to be written.</param>
        /// <returns>INetworkFileWriter</returns>
        public static INetworkFileWriter CreateWriter(NetworkFileTypes fileType, INetwork network)
        {
            INetworkFileWriter writer = null;

            if (network!=null)
            {
                switch (fileType)
                {
                    case NetworkFileTypes.Pajek_Net:
                        if (network is IBasicAdjList)
                            writer = new PajekBasicAdjListWriter();
                        break;
                    case NetworkFileTypes.GraphML:
                        if (network is IBasicAdjList)
                            writer = new GraphMlBasicAdjListWriter();
                        break;
                    case NetworkFileTypes.NetDraw_VNA:
                        if (network is IBasicAdjList)
                            writer = new VNABasicAdjListWriter();
                        break;
                    default:
                        writer = null;
                        break;
                }
            }

            return writer;
        }
Exemplo n.º 3
0
 public VnaBasicAdjListWriterFixture()
 {
     _testNetA = GetTestNetA();
     _testDir = Properties.Resources.TestDumpPath;
     if (!Directory.Exists(_testDir))
         Directory.CreateDirectory(_testDir);
     _bacisAdjListWriter = new VNABasicAdjListWriter();
 }