Fixed a copy paste errors and filtered out all edges with form (x,x)

Before, there were edges in this form (x,x) included but they shouldn't be included.