On the geometric and the algebraic rank of graph manifolds