Ejemplo n.º 1
0
def get_edges_interaccount(source_graph: Graph, inter_account_edges: List[Edge], node: Node, ignored_nodes: List[Node]) -> List[Edge]:
    """Given a Node, the Graph it belongs to, a list of inter-account Edges, and a list of Nodes to skip, this returns
    any Edges where the Node is the source element as long as the destination element isn't included in the skipped Nodes.

    If the given node is an admin, those Edge objects get generated and returned.
    """

    result = []

    for outbound_edge in node.get_outbound_edges(source_graph):
        if outbound_edge.destination not in ignored_nodes:
            result.append(outbound_edge)

    for inter_account_edge in inter_account_edges:
        if inter_account_edge.source == node and inter_account_edge.destination not in ignored_nodes:
            result.append(inter_account_edge)

    return result
Ejemplo n.º 2
0
def get_edges_with_node_source(graph: Graph, node: Node, ignored_nodes: List[Node]) -> List[Edge]:
    """Returns a list of nodes that are the destination of edges from the given graph where source of the edge is the
    passed node.
    """
    return [x for x in node.get_outbound_edges(graph) if x.source not in ignored_nodes]