quick fix
This commit is contained in:
parent
2de0ac5a02
commit
41680b3893
@ -17,6 +17,11 @@ public class Graph {
|
|||||||
|
|
||||||
public static void main(String[] args) {}
|
public static void main(String[] args) {}
|
||||||
|
|
||||||
|
public Graph(int rowLength, int columnLength) {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public Graph(String file) {
|
public Graph(String file) {
|
||||||
adjazenzMatrix = new Matrix(file);
|
adjazenzMatrix = new Matrix(file);
|
||||||
calculateDistanzMatrix();
|
calculateDistanzMatrix();
|
||||||
@ -29,7 +34,7 @@ public class Graph {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void calculateDistanzMatrix() {
|
public void calculateDistanzMatrix() {
|
||||||
distanzMatrix = new Matrix(adjazenzMatrix.getRowLength(), adjazenzMatrix.getColumnLength());
|
distanzMatrix = new Matrix(adjazenzMatrix.getRowLength(), adjazenzMatrix.getColumnLength(), false);
|
||||||
Matrix potenzMatrix = adjazenzMatrix;
|
Matrix potenzMatrix = adjazenzMatrix;
|
||||||
|
|
||||||
for(int columnIndex=0; columnIndex < distanzMatrix.getColumnLength(); columnIndex++) {
|
for(int columnIndex=0; columnIndex < distanzMatrix.getColumnLength(); columnIndex++) {
|
||||||
@ -58,7 +63,7 @@ public class Graph {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void calculateWegMatrix() {
|
public void calculateWegMatrix() {
|
||||||
wegMatrix = new Matrix(adjazenzMatrix.getRowLength(), adjazenzMatrix.getColumnLength());
|
wegMatrix = new Matrix(adjazenzMatrix.getRowLength(), adjazenzMatrix.getColumnLength(), false);
|
||||||
Matrix potenzMatrix = adjazenzMatrix;
|
Matrix potenzMatrix = adjazenzMatrix;
|
||||||
|
|
||||||
for(int columnIndex=0; columnIndex < wegMatrix.getColumnLength(); columnIndex++) {
|
for(int columnIndex=0; columnIndex < wegMatrix.getColumnLength(); columnIndex++) {
|
||||||
|
@ -15,11 +15,13 @@ public class Matrix {
|
|||||||
readCSV(file);
|
readCSV(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Matrix(int rowLength, int columnLength) {
|
public Matrix(int rowLength, int columnLength, boolean random) {
|
||||||
matrix = new int[rowLength][columnLength];
|
matrix = new int[rowLength][columnLength];
|
||||||
this.rowLength = rowLength;
|
this.rowLength = rowLength;
|
||||||
this.columnLength = columnLength;
|
this.columnLength = columnLength;
|
||||||
randomAdjazenzMatrix();
|
if(random) {
|
||||||
|
randomAdjazenzMatrix();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Matrix(int[][] matrix) {
|
public Matrix(int[][] matrix) {
|
||||||
|
@ -13,7 +13,7 @@ public class TestMatrix {
|
|||||||
scalarProduct = matrix.multiply(matrix);
|
scalarProduct = matrix.multiply(matrix);
|
||||||
System.out.println("\nScalarProduct A²: \n" + scalarProduct);
|
System.out.println("\nScalarProduct A²: \n" + scalarProduct);
|
||||||
|
|
||||||
Matrix bruh = new Matrix(100, 100);
|
Matrix bruh = new Matrix(100, 100, true);
|
||||||
System.out.println(bruh);
|
System.out.println(bruh);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user