added graph search function