remove duplicated edges by using std::set