Fixed set_edges error

There was an error in set_edges, should be fixed.