@uni_in_place_transformation<EOL>def expand_internal(universe: BELGraph, graph: BELGraph, edge_predicates: EdgePredicates = None) -> None:
edge_filter = and_edge_predicates(edge_predicates)<EOL>for u, v in itt.product(graph, repeat=<NUM_LIT:2>):<EOL><INDENT>if graph.has_edge(u, v) or not universe.has_edge(u, v):<EOL><INDENT>continue<EOL><DEDENT>rs = defaultdict(list)<EOL>for key, data in universe[u][v].items():<EOL><INDENT>if not edge_filter(universe, u, v, key):<EOL><INDENT>continue<EOL><DEDENT>rs[data[RELATION]].append((key, data))<EOL><DEDENT>if <NUM_LIT:1> == len(rs):<EOL><INDENT>relation = list(rs)[<NUM_LIT:0>]<EOL>for key, data in rs[relation]:<EOL><INDENT>graph.add_edge(u, v, key=key, **data)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>log.debug('<STR_LIT>', u, v)<EOL><DEDENT><DEDENT>
Edges between entities in the sub-graph that pass the given filters.

    :param universe: The full graph
    :param graph: A sub-graph to find the upstream information
    :param edge_predicates: Optional list of edge filter functions (graph, node, node, key, data) -> bool