Does it make sense to write here `if (node->getID() != id_map[node->getID()]) continue;`?