I currently work on a problem where I want to try to find an algorithm which does the following: Given a square grid graph G and start node S and an end node E, where E and S in G, find a path P from S to E with maximum value and |P| <= k. If it makes it easier, one can possibly make G a DAG.
The grid cells are either 0 or 1.
As an example:
S--o--o--o
| : | |
o--o..o..o
: | : |
o--o--E--o
| : | |
o--o--o--o
S := "Starting State"
E := "Ending State"
- := "Edge value is 1"
. := "Edge value is 0"
Solution with k = 5 (from what I see)
S o o o
|
o--o o o
|
o o--E o
o o o o
S and E lie arbitrarily, so one cannot assume just down and right movement, but I can transform the graph to a DAG with some loss to optimality I assume.
Edge value is a cost, G is a grid graph where every node is connected to its four neighbours.
First of all, is this problem already known in literature? I did not find anything about it. Is it in NP or does someone has an idea for a fast algorithm? I asked the search engine of my choice, and somebody asked something maybe related to it on StackOverflow , but their problem description does not match 100%, since their goal is last row, where mine is a distinct node.