He will appear at Edinburgh Sheriff Court on Monday.
Lothian and Borders Police praised the public response following an appeal for information into the assault.
The attack happened on a footpath near the red bridge in the Crewe Toll are of the city around 10pm on Wednesday 30th June. An appeal for witnesses was launched with officers particularly keen to speak to a man in his 60s who was walking a black dog and passed the suspect and the victim. The man contacted police and helped officers with their investigation.
Before the arrest was made, Detective Inspector Grant Dougall, who is leading the investigation thanked the local community for their assistance and urged anyone who may still have information to come forward. He said: ‘I am delighted that, as a result of our appeal, the man who was walking his dog in the area has been in touch and we are now carrying out various lines of enquiry to trace the individual responsible for this attack. ‘We will continue to engage with the public and have high-visibility patrols deployed throughout the area to speak with, and reassure the public as to any concerns they may have. ‘I would again stress that crimes of this nature remain extremely rare, but it is imperative that when they occur, we work closely with our communities to bring those responsible to justice. ‘Anyone who may still have information but has yet to contact police is urged to do so immediately.’