package util;
import core.Graphs.Graph;
import java.util.Random;
/**
* Nothing software.
*/
public class RandomGraphGenerator implements GraphGenerator {
@Override
public Object generate(int numberOfNodes) {
int[][] adjacencyMatrix = new int[numberOfNodes][numberOfNodes];
Random random = new Random();
for (int i = 0; i < numberOfNodes; i++) {
for (int j = i; j < numberOfNodes; j++) {
boolean value = random.nextBoolean();
if (value) {
adjacencyMatrix[i][j] = 1;
adjacencyMatrix[j][i] = 1;
} else {
adjacencyMatrix[i][j] = 0;
adjacencyMatrix[j][i] = 0;
}
}
adjacencyMatrix[i][i] = 0;
}
return new Graph(adjacencyMatrix);
}
}