You need to remove the self-loops (they will never be used) and figure out which edge to use when processing parallel edges.