added NTH function
pregel refactoring, added worker queues and corresponding algorithm