jump represent 2D matrix to hold parent of node in jump matrix here we pass reference of 2D matrix so that the change made occur directly to the original matrix len is same as defined above n is total nodes in graph
def set_jump_pointer ( len , n ) : NEW_LINE INDENT global jump , node NEW_LINE for j in range ( 1 , len + 1 ) : NEW_LINE INDENT for i in range ( 0 , n ) : NEW_LINE INDENT jump [ node [ i ] ] [ j ] = jump [ jump [ node [ i ] ] [ j - 1 ] ] [ j - 1 ] NEW_LINE DEDENT DEDENT DEDENT