Optimizations for mapReduceTriplets and EdgePartition

1. EdgePartition now stores local vertex ids instead of global ids. This avoids hash lookups when looking up vertex attributes and aggregating messages.

2. Internal iterators in mapReduceTriplets are inlined into a while loop.

These optimizations were tested to provide a 21.4% speedup on PageRank (uk-2007-05 graph, 10 iterations, 16 r3.2xlarge machines, sped up from 513 s to 403 s).

Also fixes SPARK-4173.
it'd be great to do away with the closure here since this requires caller to understand the internals of EdgePartition. we can just have two boolean fields