h_t_idx_generator
Generates idx for all possible head -> tail node combinations excluding self-reference