Correctly compare relations with shared origin.

The previous implementation did not handle comparing relation sets that shared one endpoint, but not the other. If either endpoint was shared, the comparison function returned true, that the relations were the same. Now it will check to make sure that both endpoints, instead of just one, are shared.
For index 0 we compare the whole endpoint object, for index 1 just the name?
I see it preexisted, but what's the reason for that? A comment would be great.