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.[src] 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.[src] This related problem can be solved in polynomial time using the Bellman–Ford algorithm.[src] 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.[src] 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.[src] Therefore, the special case of the zero-weight cycle problem, on graphs with no negative cycle, has a polynomial-time algorithm.[src] In contrast, for graphs that contain negative cycles, detecting a simple cycle of weight exactly 0 is an NP-complete problem.[src] This is true even when the weights are integers of polynomial magnitude.…[src]
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.[src] 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.[src] This related problem can be solved in polynomial time using the Bellman–Ford algorithm.[src] 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.[src] 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.[src] Therefore, the special case of the zero-weight cycle problem, on graphs with no negative cycle, has a polynomial-time algorithm.[src] In contrast, for graphs that contain negative cycles, detecting a simple cycle of weight exactly 0 is an NP-complete problem.[src] This is true even when the weights are integers of polynomial magnitude.[src] In particular, there is a reduction from the Hamiltonian path problem, on an n -vertex unweighted graph G with specified starting and ending vertices s and t , to the zero-weight cycle problem on a weighted graph obtained by giving all edges of G weight equal to one, and adding an additional edge from t to s with weight 1-n .[1]
17 sentences · 17 cited inline · 1 references stored
References
- Finding a zero path in . · retrieved 2026-02-05 · rev 1336954764
Cite this reference
MLA "Finding a zero path in ." 2026-02-05. https://en.wikipedia.org/w/index.php?oldid=1336954764. Accessed 25 November 2026.
Chicago "Finding a zero path in ." 2026-02-05. https://en.wikipedia.org/w/index.php?oldid=1336954764.
APA encyclopegia.org. (2026). Finding a zero path in . Retrieved November 25, 2026, from https://en.wikipedia.org/w/index.php?oldid=1336954764
Cite this article
MLA
"Zero-weight cycle problem." encyclopegia.org, 2026, https://encyclopegia.org/wiki/zero-weight-cycle-problem. Accessed 25 November 2026.
Chicago
"Zero-weight cycle problem." encyclopegia.org. Accessed November 25, 2026. https://encyclopegia.org/wiki/zero-weight-cycle-problem.
APA
encyclopegia.org. (2026). Zero-weight cycle problem. Retrieved November 25, 2026, from https://encyclopegia.org/wiki/zero-weight-cycle-problem
Accessed November 25, 2026 · CC BY-SA 4.0 · citation page · JSON