I have created some lakes, some of which have rivers. These rivers flow out into other lakes, or sometimes out to the ocean (which I have represented as a lake). For the purpose of the graphical world making sense, I now need to raise these lakes so that when they flow, they flow downhill. I'm now stuck on the algorithm for determining the heights.
I always have a reference to the ocean.
I can traverse this graph of lakes in either direction, despite the rivers having a direction assigned.
A lake can have more than one river flowing in and/or out.
There are no cycles in this graph of lakes.
I can ignore any lakes that don't have rivers, or separate graphs of lakes/rivers that don't flow out to the ocean.