Graphs with given diameter maximizing the spectral radius