bi directional graph search