Skip to content

Commit

Permalink
#4 added contains method
Browse files Browse the repository at this point in the history
still eneds testing
  • Loading branch information
MuellMark committed Jul 7, 2023
1 parent a558c17 commit 7ab6271
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
16 changes: 15 additions & 1 deletion Java Code/edgeStorageArrays.java
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ public boolean isCirculantLabeling(){
boolean isCir = true;

if(!allEdgesDegree4()) isCir=false;
ArrayList<int[]> cycles = getCycles();
//Needs method to get the cycle
//Needs method to check said cycle
return isCir;
Expand All @@ -164,13 +165,18 @@ public ArrayList<int[]> getCycles(){
//Will keep track of possibleNums to avoid repeating
ArrayList<Integer> possibleNums = new ArrayList<>();
for(int i=1;i<size();i++) possibleNums.add(i);
getCyclesRecur(1,possibleNums,cycles);
getCyclesRecur(3,possibleNums,cycles);

return cycles;
}

private void getCyclesRecur(int currentEdge, ArrayList<Integer> possibleNums,
ArrayList<int []> cycles){
if(possibleNums.size()==0){
if(contains(edges[currentEdge][0],1) ||contains(edges[currentEdge][1],1)){
System.out.println("what");
}
}
//Base case, when possiblenums is empty
//Recur case, check for all possible next moves, remove it from possiblenum,
//Move the current to that edge and call the method again.
Expand Down Expand Up @@ -295,4 +301,12 @@ public void writeToFileForVisualization(FileWriter myWriter){
e.printStackTrace();
}
}

private boolean contains(int[] arr,int num){
boolean contain = false;
for(int i=1;i<=arr[0];i++){
if(arr[i]==num) contain=true;
}
return contain;
}
}
2 changes: 1 addition & 1 deletion Java Code/generateGraphs.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public static void main(String[]args){
// 1 = isDDMLabeling()
// 2 = isDDMLabelingIncludeZeroes()
// 3 = isCirculantLabeling()
int methodSelect = 1;
int methodSelect = 3;

// Stores all possible combinations for all recurssive calls
ArrayList<edgeStorageArrays> allCombos = new ArrayList<>();
Expand Down

1 comment on commit 7ab6271

@MuellMark
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#35

Please sign in to comment.