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); } }