Added distnct to edge duplication.