implement AG run using ST monad

I add an alternative implementation for running AGs on graphs using the
ST monad to track the mapping for inherited attributes.

Results: noticeable reduction in the overhead in the shared case;
increased overhead in the unshared case