new random graph feature #6

Merged
AustrianToast merged 9 commits from dev into main 2023-05-26 12:41:13 +02:00
2 changed files with 21 additions and 4 deletions
Showing only changes of commit bbe304606a - Show all commits

View File

@ -11,6 +11,16 @@ public class Matrix {
public static void main(String[] args) {} public static void main(String[] args) {}
public Matrix(int rowLength, int columnLength, boolean random) {
if(!random) {
return;
}
matrix = new int[rowLength][columnLength];
this.rowLength = rowLength;
this.columnLength = columnLength;
randomAdjazenzMatrix();
}
public Matrix(String file) { public Matrix(String file) {
readCSV(file); readCSV(file);
} }

View File

@ -1,6 +1,11 @@
public class TestMatrix { public class TestMatrix {
public static void main(String[] args) { public static void main(String[] args) {
String pathToProgramRoot = "/home/rene/projects/Java/graphprogram"; test1();
test2();
}
public static void test1() {
String pathToProgramRoot = "";
Matrix matrix = new Matrix(pathToProgramRoot + "/csv/graph.csv"); Matrix matrix = new Matrix(pathToProgramRoot + "/csv/graph.csv");
Matrix scalarProduct; Matrix scalarProduct;
@ -12,8 +17,10 @@ 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); public static void test2() {
Matrix bruh = new Matrix(10, 10, true);
System.out.println(bruh); System.out.println(bruh);
} }
} }