public void TransitiveClousureTest() { bool[,] array0 = new bool[, ] { { true, true, false, false }, { false, true, true, false }, { true, false, true, false }, { false, false, true, true } }; bool[,] array1 = new bool[, ] { { true, true, true, false }, { true, true, true, false }, { true, true, true, false }, { true, true, true, true } }; Matrix <Boolean> origin = new Matrix <Boolean>(4, 4); Matrix <Boolean> expected = new Matrix <Boolean>(4, 4); for (int i = 0; i < array0.GetLength(0); i++) { for (int j = 0; j < array0.GetLength(1); j++) { origin[i, j] = new Boolean(array0[i, j]); expected[i, j] = new Boolean(array1[i, j]); } } Matrix <Boolean> result = TransitiveClosureProcessor.Process(origin); Assert.AreEqual(expected, result); }
static void Main(string[] args) { string input1, input2, output; Console.WriteLine("Hello! What would you like to do?\n"); Console.WriteLine("1. Compute Natural Number Matrix Product"); Console.WriteLine("2. Get a Transitive Clousure Graph of a Boolean Matrix"); Console.WriteLine("3. Compute APSP for Natural Matrix"); switch (Console.ReadLine()) { case "1": Console.WriteLine("Enter paths to the matrixes"); input1 = Console.ReadLine(); input2 = Console.ReadLine(); Console.WriteLine("Enter output filename"); output = Console.ReadLine(); Matrix <NaturalNumber> m1 = MatrixReader <NaturalNumber> .Read(input1), m2 = MatrixReader <NaturalNumber> .Read(input2); MatrixWriter <NaturalNumber> .Write(m1 *m2, output); break; case "2": Console.WriteLine("Enter paths to the matrix"); input1 = Console.ReadLine(); Console.WriteLine("Enter output filename"); output = Console.ReadLine(); Matrix <Boolean> boo = MatrixReader <Boolean> .Read(input1); PdfGenerator.Generate(boo, TransitiveClosureProcessor.Process(boo), output); break; case "3": Console.WriteLine("Enter paths to the matrix"); input1 = Console.ReadLine(); Console.WriteLine("Enter output filename"); output = Console.ReadLine(); Matrix <NaturalNumber> natural = MatrixReader <NaturalNumber> .Read(input1); MatrixWriter <NaturalNumber> .Write(FloydWarshallProcessor <NaturalNumber> .Process(natural), output); break; } Console.WriteLine(@"output is generated in ..\Task2\CSharp\MatrixProcessor\bin\Debug\netcoreapp3.1"); }