Graphs with three distict eigenvalues and largest eigenvalue less than 8