River Formation Dynamics (RFD) is an heuristic method similar to Ant Colony Optimization (ACO). In fact, RFD can be seen as a gradient version of ACO, based on copying how water forms rivers by eroding the ground and depositing sediments. As water transforms the environment, altitudes of places are dynamically modified, and decreasing gradients are constructed. The gradients are followed by subsequent drops to create new gradients, reinforcing the best ones. By doing so, good solutions are given in the form of decreasing altitudes. We apply this method to solve two NP-complete problems, namely the problems of finding a minimum distances tree and finding a minimum spanning tree in a variable-cost graph. We show that the gradient orientation of RFD makes it specially suitable for solving these problems, and we compare our results with those given by ACO.