'Constructs and returns a child-to-parents map for the given
parent-to-children map.
Arguments:
parent_to_children_map ({parent:[children]}) - A
dictionary of parent to a list of its children.  If a
node does not have any children, its value should be [].
Returns:
{child:[parents]} - A dictionary of child to a list of its
parents. If a node does not have any parents, its value
will be [].'

@staticmethod
def get_child_to_parents_map(parent_to_children_map):

    result = defaultdict(list)
    for (parent, children) in parent_to_children_map.iteritems():
        for child in children:
            result[child].append(parent)
    return result
