Since repetitions are allowed this can be solved in polynomial time by a slight variation of the Bellman-Ford algorithm. Let OPT(v,i) denote the optimal cost to reach v using i edges and let w(x,y) denote the weight between vertices x and y. Then we have the following recurrence:
OPT(v, i+1) = min { OPT(u, i) + w(u,v) }, over all edges (u,v).
This can be solved in a bottom up fashion in O(nm), where m is the number of edges. Here's the pseudocode.
function computeShortestPath (u, v, n):
foreach q in vertices:
OPT[q][0] = inf;
OPT[u][0] = 0;
for (i = 1; i <= n; i++):
foreach q in vertices:
OPT[q][i] = inf;
foreach (p,q) in edges:
OPT[q][i] = min(OPT[q][i], OPT[p][i-1] + w[p][q]);
return OPT[v][n];
Note that if repetitions aren't allowed the problem is a generalization of the Hamiltonian path problem which is NP-Hard.