From 4b3b2e0d0434e6f0cb77288cd99c9ae40340cf86 Mon Sep 17 00:00:00 2001 From: Kuzivanov Sergey <43182277+SergeyKuz1001@users.noreply.github.com> Date: Sun, 8 Dec 2019 12:04:23 +0300 Subject: [PATCH] Delete GenerateMatrix.cs --- Task02/GenerateMatrix.cs | 59 ---------------------------------------- 1 file changed, 59 deletions(-) delete mode 100644 Task02/GenerateMatrix.cs diff --git a/Task02/GenerateMatrix.cs b/Task02/GenerateMatrix.cs deleted file mode 100644 index 5d9056e..0000000 --- a/Task02/GenerateMatrix.cs +++ /dev/null @@ -1,59 +0,0 @@ -using System; -using System.IO; - -namespace Task02 -{ - public class GenerateMatrix - { - static int Whole = 1000000; - - public static void Execute(int n, int m, int minWeight, int maxWeight) - { - GeneralResources.n = n; - GeneralResources.graphMatrix = new int[n, n]; - Random random = new Random(); - int partAmountEdgesFromMax = (int)((long)m * Whole / (n * (n - 1) / 2)); - m = 0; - for (int i = 0; i < n; i++) - { - for (int j = i + 1; j < n; j++) - { - if (random.Next(Whole) < partAmountEdgesFromMax) - { - int weight = random.Next(minWeight, maxWeight); - GeneralResources.graphMatrix[i, j] = GeneralResources.graphMatrix[j, i] = weight; - m++; - } - else - { - GeneralResources.graphMatrix[i, j] = GeneralResources.graphMatrix[j, i] = GeneralResources.INF; - } - } - } - - GeneralResources.graphListEdges = new (int, int, int)[m]; - int k = 0; - for (int i = 0; i < n; i++) - { - for (int j = i + 1; j < n; j++) - { - if (GeneralResources.graphMatrix[i, j] != GeneralResources.INF) - { - GeneralResources.graphListEdges[k] = (GeneralResources.graphMatrix[i, j], i, j); - k++; - } - } - } - - StreamWriter foutMatrix = new StreamWriter("matrix.txt"); - foutMatrix.Write($"{n} {m}\n"); - for (k = 0; k < m; k++) - { - foutMatrix.Write($"{GeneralResources.graphListEdges[k].Item2 + 1} " + - $"{GeneralResources.graphListEdges[k].Item3 + 1} " + - $"{GeneralResources.graphListEdges[k].Item1}\n"); - } - foutMatrix.Close(); - } - } -}