Zero-weight cycle problem

From HandWiki

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 [math]\displaystyle{ n }[/math]-vertex unweighted graph [math]\displaystyle{ G }[/math] with specified starting and ending vertices [math]\displaystyle{ s }[/math] and [math]\displaystyle{ t }[/math], to the zero-weight cycle problem on a weighted graph obtained by giving all edges of [math]\displaystyle{ G }[/math] weight equal to one, and adding an additional edge from [math]\displaystyle{ t }[/math] to [math]\displaystyle{ s }[/math] with weight [math]\displaystyle{ 1-n }[/math].[2]

References

  1. 1.0 1.1 Sanders, Peter; Schulz, Christian (2013), "Think Locally, Act Globally: Highly Balanced Graph Partitioning", in Bonifaci, Vincenzo; Demetrescu, Camil; Marchetti-Spaccamela, Alberto, Experimental Algorithms, 12th International Symposium, SEA 2013, Rome, Italy, June 5–7, 2013, Proceedings, Lecture Notes in Computer Science, 7933, Springer, pp. 164–175, doi:10.1007/978-3-642-38527-8_16 
  2. Kawase, Yasushi; Kobayashi, Yusuke; Yamaguchi, Yutaro (2015), "Finding a zero path in [math]\displaystyle{ \Z_3 }[/math]-labeled graphs", RIMS Kôkyûroku 1931: 148–160, https://core.ac.uk/download/pdf/81260488.pdf