-
Notifications
You must be signed in to change notification settings - Fork 0
/
PrunerTournament
33 lines (27 loc) · 1.12 KB
/
PrunerTournament
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
public class Pruner {
// can be used to decide how many times this would be pruned. might make things faster to find clique.
//change filename!
public static int[][] prune(int[][] adjMatrix,int cliqueSize,int[] degreeOrder) {
for (int i = 0; i < adjMatrix.length; i++) {
int degrees = degreeOrder[i];
if(degrees < cliqueSize && degrees !=0 ){
System.out.println("the index " + i + "should be pruned");
for(int j =0;j<adjMatrix.length;j++){
adjMatrix[i][j] = 0;
adjMatrix[j][i] = 0;
}
}
}
int[] updatedDegrees = new int[adjMatrix.length];
for(int k = 0;k<updatedDegrees.length;k++) {
updatedDegrees[k] = ChromaticMethods.checkDegrees(adjMatrix, k);
}
for(int r =0;r<updatedDegrees.length;r++){
if(updatedDegrees[r] != 0 && updatedDegrees[r] <cliqueSize){
return prune(adjMatrix,cliqueSize,updatedDegrees);
}
}
System.out.println("pruning is done!");
return adjMatrix;
}
}