def _all_dependencies(node, dg):
    """Gets all the dependencies for the passed in node.

    :param str node: The node to lookup dependencies for.
    :param dict dg: The graph to lookup.

    :return: Tuple of a list of pairs from parent to child dependencies and
        the list of direct_dependencies.
    :rtype: list[tuple[str, str]], list
    """
    visited = set()
    queue = [node]
    edges = []
    direct_dependencies = []
    while queue:
        current_node = queue.pop(0)
        if current_node in visited:
            continue
        visited.add(current_node)
        for child in dg[current_node]:
            if child not in visited:
                assert child != current_node
                edges.append((current_node, child))
                if current_node == node:
                    direct_dependencies.append(child)
                queue.append(child)

    return edges, direct_dependencies