(adj, max_prev_node=10, is_full=False)
return adj_output
:param adj: n*n, rows means time step, while columns are input dimension
    :param max_degree: we want to keep row number, but truncate column numbers
    :return:
def encode_adj(adj, max_prev_node=10, is_full=False):
    '''

    :param adj: n*n, rows means time step, while columns are input dimension
    :param max_degree: we want to keep row number, but truncate column numbers
    :return:
    '''
    if is_full:
        max_prev_node = adj.shape[0] - 1

    # pick up lower tri
    adj = np.tril(adj, k=-1)
    n = adj.shape[0]
    adj = adj[1:n, 0:n - 1]

    # use max_prev_node to truncate
    # note: now adj is a (n-1)*(n-1) matrix
    adj_output = np.zeros((adj.shape[0], max_prev_node))
    for i in range(adj.shape[0]):
        input_start = max(0, i - max_prev_node + 1)
        input_end = i + 1
        output_start = max_prev_node + input_start - input_end
        output_end = max_prev_node
        adj_output[i, output_start:output_end] = adj[i, input_start:input_end]
        adj_output[i, :] = adj_output[i, :][::-1]  # reverse order

    return adj_output
def encode_adj ( adj , max_prev_node = 10 , is_full = False ) : if is_full : max_prev_node = adj . shape [ 0 ] - 1 # pick up lower tri adj = np . tril ( adj , k = - 1 ) n = adj . shape [ 0 ] adj = adj [ 1 : n , 0 : n - 1 ] # use max_prev_node to truncate # note: now adj is a (n-1)*(n-1) matrix adj_output = np . zeros ( ( adj . shape [ 0 ] , max_prev_node ) ) for i in range ( adj . shape [ 0 ] ) : input_start = max ( 0 , i - max_prev_node + 1 ) input_end = i + 1 output_start = max_prev_node + input_start - input_end output_end = max_prev_node adj_output [ i , output_start : output_end ] = adj [ i , input_start : input_end ] adj_output [ i , : ] = adj_output [ i , : ] [ : : - 1 ] # reverse order return adj_output