From 41680b38937f71c0ebf6a1e8a9c99b80735b1298 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Fuhry?= Date: Fri, 26 May 2023 00:18:40 +0200 Subject: [PATCH] quick fix --- src/Graph.java | 9 +++++++-- src/Matrix.java | 6 ++++-- src/TestMatrix.java | 2 +- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/Graph.java b/src/Graph.java index fef94a6..83117f9 100644 --- a/src/Graph.java +++ b/src/Graph.java @@ -17,6 +17,11 @@ public class Graph { public static void main(String[] args) {} + public Graph(int rowLength, int columnLength) { + + + } + public Graph(String file) { adjazenzMatrix = new Matrix(file); calculateDistanzMatrix(); @@ -29,7 +34,7 @@ public class Graph { } public void calculateDistanzMatrix() { - distanzMatrix = new Matrix(adjazenzMatrix.getRowLength(), adjazenzMatrix.getColumnLength()); + distanzMatrix = new Matrix(adjazenzMatrix.getRowLength(), adjazenzMatrix.getColumnLength(), false); Matrix potenzMatrix = adjazenzMatrix; for(int columnIndex=0; columnIndex < distanzMatrix.getColumnLength(); columnIndex++) { @@ -58,7 +63,7 @@ public class Graph { } public void calculateWegMatrix() { - wegMatrix = new Matrix(adjazenzMatrix.getRowLength(), adjazenzMatrix.getColumnLength()); + wegMatrix = new Matrix(adjazenzMatrix.getRowLength(), adjazenzMatrix.getColumnLength(), false); Matrix potenzMatrix = adjazenzMatrix; for(int columnIndex=0; columnIndex < wegMatrix.getColumnLength(); columnIndex++) { diff --git a/src/Matrix.java b/src/Matrix.java index 86fd612..5216579 100644 --- a/src/Matrix.java +++ b/src/Matrix.java @@ -15,11 +15,13 @@ public class Matrix { readCSV(file); } - public Matrix(int rowLength, int columnLength) { + public Matrix(int rowLength, int columnLength, boolean random) { matrix = new int[rowLength][columnLength]; this.rowLength = rowLength; this.columnLength = columnLength; - randomAdjazenzMatrix(); + if(random) { + randomAdjazenzMatrix(); + } } public Matrix(int[][] matrix) { diff --git a/src/TestMatrix.java b/src/TestMatrix.java index 7e8b04a..fef242a 100644 --- a/src/TestMatrix.java +++ b/src/TestMatrix.java @@ -13,7 +13,7 @@ public class TestMatrix { scalarProduct = matrix.multiply(matrix); System.out.println("\nScalarProduct A²: \n" + scalarProduct); - Matrix bruh = new Matrix(100, 100); + Matrix bruh = new Matrix(100, 100, true); System.out.println(bruh); } }