Make IdGraph ensuring __id index just once.

This to prevent performance impact when using
IdGraph frequently, for example when wrapping
transaction instance.