fix edge_search() and take it back to o(lgn) from o(n)