Hello,
A Tutorial on implementation of AODV in NS-2 by Mubashir Hussain Rehmani is available on the following link:
http://www-npa.lip6.fr/~rehmani/aodv_v2.pdf
See section 5.3.2 "Functions for Routing Table Management"
Hope it helps.
Regards,Mohit P. Tahiliani