: Assuming the existence of an algorithm for computing the optimal loopless path between two given nodes in a network when considering a general cost function, in this paper a deviation algorithm for enumerating K optimal loopless paths is proposed. It is also presented an adaptation of this algorithm, in order to determine the K optimal paths, possibly containing cycles. Finally it is shown that the complexity order of this algorithm, when considering a worst-case analysis, is O(Kn c(n)), where c(n) stands for the number of performed operations to determine the optimal (loopless) path between a given pair of nodes in a network with n nodes. Keywords: network, path, loopless path, optimal path, paths ranking. 1 Introduction The enumeration of the K shortest paths is a well-known optimization problem whose purpose is to rank K paths between a given pair of nodes in a network by non-decreasing order of their costs, where the cost value of a path is the summation of all path's arcs cos..