added feature of edge weight approach. From the simple test result, it is not as supposed