1
$\begingroup$

Suppose we have a weighted, acyclic digraph, with positive and negative edge weights.

Is there an algorithm that determines whether there is a path of weight zero between vertices A and B? The Bellman-Form algorithm finds the path of smallest weight - is there another algorithm that determines the path of smallest absolute value weight?

Thanks, Charles

$\endgroup$
4
  • $\begingroup$ What weights are allowable? Integers between -16 and 16? Arbitrary rational or real numbers? Something in between? (If there is a minimum gap between path weights, it might make the problem easier.) $\endgroup$ Mar 11, 2012 at 20:18
  • $\begingroup$ The weights are integers in the interval [-c,c] for some integer constant c. $\endgroup$ Mar 11, 2012 at 20:23
  • $\begingroup$ If it's a finite graph, then of course there's an algorithm, exhaustive search. Perhaps your question is whether there is a more efficient algorithm? $\endgroup$ Mar 11, 2012 at 23:03
  • $\begingroup$ Yes, it's a finite graph, so exhaustive search would work. I'm looking for something more efficient. Thanks, Charles $\endgroup$ Mar 12, 2012 at 2:55

1 Answer 1

6
$\begingroup$

It is NP-complete if $c$ is not specified. For a set of numbers $m_1,\ldots,m_t$ make a digraph with vertices $v_0,v_1,\ldots,v_t$. From $v_{i+1}$ to $v_i$ put two edges, of length $m_i$ and $-m_i$, for each $i$. A path of zero length from $v_0$ to $v_t$ corresponds to a partition of $m_1,\ldots,m_t$ into two sets of equal size, which is a well known NP-complete problem (called PARTITION).

$\endgroup$
3
  • $\begingroup$ That still leaves the question of whether any practical algorithms exist, at least to find "small" absolute values. There is the obvious convex relaxation, but it is not clear it works at all... $\endgroup$
    – Igor Rivin
    Mar 12, 2012 at 4:35
  • $\begingroup$ for weights given in unary, one might suspect that there will be a dynamic programming algorithm... $\endgroup$ Mar 13, 2012 at 5:06
  • $\begingroup$ If the weights are integers of magnitude $O(c)$, then there is an $O(cnm)$ dynamic programming algorithm, where $m$ is the number of edges. For each vertex in topological order, determine which path lengths occur from the starting vertex to that vertex. It would be nice to know if faster is possible. $\endgroup$ Mar 13, 2012 at 6:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.