If I want to compute the shortest path between two points in a directed graph, I can use the Dijkistra algorithm. But what if I want to compute the longest path?
If the weights on the graph are bounded, then I guess I can use Djkstra to the graph with weights $M-c_i$, where $M = \max_i c_i$.
Is this correct? What if the weights are not bound? What can I do then?
You cant replace the weights with $M-c_i$ because that favors routes with fewer steps. An example is a graph where there are two ways to go from a to b, a direct route with length 10 and a route via c with length 10+1. You suggest to replace this with a shortest path problem where the choice is between a direct route with length 0 and a route via c with length 0+9. This results in the wrong answer (direct route).
Longest path is an NP-hard problem, see wikipedia. For acyclyc graphs you can just replace the lengths $c_i$ with $-c_i$ and use a shortest path algorithm that can deal with negative lengths.