prevent duplicate edges