/* Chad Brewbaker 2-25-2003 This program outputs the distance of every possible hamiltonian cycle in a graph from the standard form. Standard form is 1-2-3-4-5-6...-N-1 Distance is defined as the number of vertex transpositions needed to get from one cycle to another. Example 13245 takes one transposition (32)->(23) to get to normal form. Also 12345 is the same as 54321 (Flips) and 12345 is the same as 23451 (rotations). Trivaily there are n!/(2n) possible hamiltionian cycles in a given graph. ***TODO*** -Add permutation code to enumerate all cycles... -Simplify length by starting every array with 0. Should reduce things by a factor of n. */ #include int cycleList[10000][10]; int stdList[1000][10]; int goodArr[10]; /*does a dfs search as to which vertices should be swaped in order to achive a normal form*/ int DFSPass(int cycleIndex, int cycleLength,int standardIndex) { int i,j,k; int temp=0; int tempMax,max; int goodTmp1,goodTmp2; tempMax=max=0; /*Check to see if we are finished*/ for(i=0;iindex+1;j++) { for(k=0;k> cycleLength; if(cycleLength<3 || cycleLength>10) { cout <<"\nPlease input from 3-10 verticies\n"; return 1; } stdNum=createStandard(cycleLength); cycleNum=createCycleList(cycleLength); return 0; }