That is sufficient, and that achieves the purpose of visiting the graves. If the graves are far away and one visits them from all directions, that is OK.
Kitaab Majmoo’ Fataawa wa Maqaalaat Mutanawwi’ah li Samaahat al-Shaykh ‘Abd al-‘Azeez ibn ‘Abd-Allaah ibn Baaz (may Allaah have mercy on him), vol. 13, p. 335.
The shaykh (may Allaah have mercy on him) was also asked:
When visiting the graves, is it prescribed for the visitor to go to the particular grave that he wants to visit?
He (may Allaah have mercy on him) answered:
It is sufficient for him (to say salaams) at the first graves he comes to, but if he wants to go to the grave of the person that he wants to visit and say salaams to him, then that is OK.