Refactored graph aggregation.