added code to retrieve adj list from DB