def calculate_conditioners(g, feature_predecessors, num_features):
    """
    Calculates the conditioners (i.e. the feature that each feature is conditioned on) in the Chow-Liu tree
    defined by the predecessor map, feature_predecessors.
    """
    conditioners = [None] * num_features
    for target, source in feature_predecessors.iteritems():
        conditioners[target] = source
    return conditioners