adjacent table update

add the code the complete the adjacent table function