def _compute_ANN_row(tree, x):
    """
    For a given survival tree and a feature vector, traverse down the tree to
    find the feature vector's adaptive nearest neighbors.

    Parameters
    ----------
    tree : dictionary
        Tree node of a decision tree. We traverse down the tree taking branches
        that depend on the given feature vector's values.

    x : 1D numpy array, shape = [n_features]
        Feature vector.

    Returns
    -------
    output : 1D numpy array
        Training subject indices that are the adaptive nearest neighbors of the
        input feature vector.
    """
    if 'train_indices' in tree:
        return tree['train_indices']

    if x[tree['feature']] <= tree['threshold']:
        return _compute_ANN_row(tree['left'], x)
    else:
        return _compute_ANN_row(tree['right'], x)