alteracao na busca do melhor nodo.
change in the algorithm, use of recursivity to get the best weight