Let the target function received the index along with the nodes