adding algorithm for two hop feature generator