The problem is to find the minimum mean weighted cycle of all existing cycles in a directed Graph (V, E) if it exits. Since the graph has non-negative edges so we cannot expect the weight of the cycle fall below zero .The method used for implementation is Dynamic Programming which stores an array of all the recursive steps since the problem have both optimal substructure and overlapping sub-problems.
Assumption: The graph is non- negative weighted and is strongly connected.
Step 1: The first step involves finding the dp[i][v] which is the minimum weight used for reaching a destination v from u defined as dp [i] [v] : = min(dp [i] [v] ,dp [i-1] [u] + weight(u,v)), for i in range of N(no of vertices). This is a greedy step to traverse only those edges which encounters minimum path length.
Step 2: max (dp [n ] [v]-dp [j] [v])/n-j j in range of (N) and v is the destination of the edge set .
Step 3: min (max (dp [n] [v]-dp [j] [v])/n-j)
The min is over all the edge sets to choose the minimum weighted cycles.
Key points:
Time Complexity: The algorithm runs in an O (VE) time where V is the number of vertices and E is the number of the edges.