The exact path length problem

  • Authors:
  • Matti Nykänen;Esko Ukkonen

  • Affiliations:
  • Department of Computer Science, University of Helsinki, P.O. Box 26, (Teollisuuskatu 23), 00014 Helsinki, Finland;Department of Computer Science, University of Helsinki, P.O. Box 26, (Teollisuuskatu 23), 00014 Helsinki, Finland

  • Venue:
  • Journal of Algorithms
  • Year:
  • 2002

Quantified Score

Hi-index 0.00

Visualization

Abstract

We study a problem related to finding shortest paths in weighted graphs. We ask whether or not there is a path between two nodes that has a given total cost k. The edge weights of the graph can be both positive and negative integers or even integer vectors. We show that many variants of this problem are NP-complete. We develop a pseudo-polynomial algorithm for (both positive and negative) integer weights. The running time of this algorithm is O(W2n3 + |k| min(|k|, W)n2), where n is the number of nodes in the graph, W is the largest absolute value of any edge weight, and k is the target cost. The algorithm is based on preprocessing the graph with a relaxation algorithm to eliminate the effects of weight sign alternations along a path. This preprocessing stage is applicable to other problems as well. For example, we show how to find the minimum absolute cost of any path between two given nodes in a graph with integer weights in O(W2n3) time.