Compare existing nodes and relationships by id.

valueOf doesn't work here because it's always new objects that are
being added.