Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I have the following weights: I know these are all of the hamiltonian cycles: {1

ID: 3698958 • Letter: I

Question

I have the following weights:

I know these are all of the hamiltonian cycles:

{1, 2, 3, 4, 5,1}, {1, 2, 3, 5, 4,1}, {1, 2, 4, 3, 5,1}, {1, 2, 4, 5, 3,1},
{1, 2, 5, 3, 4, 1}, {1, 2, 5, 4, 3, 1}, {1, 3, 2, 4, 5, 1}, {1, 3, 2, 5, 4, 1},
{1, 3, 4, 2, 5, 1}, {1, 3, 4, 5, 2, 1}, {1, 3, 5, 2, 4, 1}, {1, 3, 5, 4, 2, 1},
{1, 4, 2, 3, 5, 1}, {1, 4, 2, 5, 3, 1}, {1, 4, 3, 2, 5, 1}, {1, 4, 3, 5, 2, 1},
{1, 4, 5, 2, 3, 1}, {1, 4, 5, 3, 2, 1}, {1, 5, 2, 3, 4, 1}, {1, 5, 2, 4, 3, 1},
{1, 5, 3, 2, 4, 1}, {1, 5, 3, 4, 2, 1}, {1, 5, 4, 2, 3, 1}, {1, 5, 4, 3, 2, 1}

How would I write code to use the brute-force method and assign weight to each path and then print the cheapest path and its corresponding cost? Code should be in mathematica

660 Va 49-06 Vi 2 01 16 2 0291 02543

Explanation / Answer

bool RhamCycle(bool graph[V][V])
{
int *path = new int[V];
for (int i = 0; i < V; i++)
path[i] = -1;

/* Let us put vertex 0 as the first vertex in the path. If there is
a Hamiltonian Cycle, then the path can be started from any point
of the cycle as the graph is undirected */
path[0] = 0;
if ( RhamCycleUtil(graph, path, 1) == false )
{
printf(" Solution does not exist");
return false;
}

printSolution(path);
return true;
}

Print the solution
void printSolution(int path[])
{
printf ("Solution Exists:"
" Following is one Hamiltonian Cycle ");
for (int i = 0; i < V; i++)
printf(" %d ", path[i]);

// Let us print the first vertex again to show the complete cycle
printf(" %d ", path[0]);
printf(" ");
}