Zero-weight cycle problem
In computer science and graph theory, the zero-weight cycle problem is the problem of deciding whether a directed graph with weights on the edges (which may be positive or negative or zero) has a cycle in which the sum of weights is 0.
A related problem is to decide whether the graph has a negative cycle, a cycle in which the sum of weights is less than 0. This related problem can be solved in polynomial time using the Bellman–Ford algorithm. If there is no negative cycle, then the distances found by the Bellman–Ford algorithm can be used, as in Johnson's algorithm, to reweight the edges of the graph in such a way that all edge weights become non-negative and all cycle lengths remain unchanged. With this reweighting, a zero-weight cycle becomes trivial to detect: it exists if and only if the zero-weight edges do not form a directed acyclic graph. Therefore, the special case of the zero-weight cycle problem, on graphs with no negative cycle, has a polynomial-time algorithm.[1]
In contrast, for graphs that contain negative cycles, detecting a simple cycle of weight exactly 0 is an NP-complete problem.[1] This is true even when the weights are integers of polynomial magnitude. In particular, there is a reduction from the Hamiltonian path problem, on an -vertex unweighted graph with specified starting and ending vertices and , to the zero-weight cycle problem on a weighted graph obtained by giving all edges of weight equal to one, and adding an additional edge from to with weight .[2]
References
[edit]- ^ a b Sanders, Peter; Schulz, Christian (2013), "Think Locally, Act Globally: Highly Balanced Graph Partitioning", in Bonifaci, Vincenzo; Demetrescu, Camil; Marchetti-Spaccamela, Alberto (eds.), Experimental Algorithms, 12th International Symposium, SEA 2013, Rome, Italy, June 5–7, 2013, Proceedings, Lecture Notes in Computer Science, vol. 7933, Springer, pp. 164–175, arXiv:1210.0477, doi:10.1007/978-3-642-38527-8_16, ISBN 978-3-642-38526-1
- ^ Kawase, Yasushi; Kobayashi, Yusuke; Yamaguchi, Yutaro (2015), "Finding a zero path in -labeled graphs" (PDF), RIMS Kôkyûroku, 1931: 148–160