Search code examples
graphgraph-algorithmpath-finding

Searching for an atypical graph pathfinding algorithm


Graph structure

graph is oriented

each edge has an assigned value representing the cost of using this edge. The value can be positive or negative

Problem description

input: graph, starting node and initial value (I don't have a goal node)

both, nodes and edges can be used repeatedly

goal: change the initial value to zero by passing through the graph. The answer should be if it is possible to reach zero (exactly zero, without reaching a negative actual value in the process)

I don't need the final path as the result, just the information if it is possible is enough. I would be most interested in a name of algorithm that is designed for this problem.


Solution

  • It is clearly NP-Hard (subset-sum can be reduced to it by using an appropriate complete graph). Breadth-first search seems like a natural approach, though to get a decision-procedure out of it you would need to find an upper-bound on the length of the path.