Successor graphs consist of nodes with an outdegree of 1.
Successor graph consists of one or more components, each of which contains one cycle and some paths that lead to it.
Precalculating Successor Paths
To compute the value , we can find it faster in instead of . We can use a similar idea of Binary Search and build the Table in , and then co
There is a similar idea used for Tree Query to find the -th ancestor of a node in time.
I don’t have the code.
Then, we can calculate for example: