(g, filter_out_types=set())
Get the last edge of the graph or an empty edge if there is non

    :param g: a graph as a dictionary
    :param filter_out_types: a set fo edge types to filter out, if not empty the last edge of the specified type is returned
    :return: an edge as a dictionary
    >>> get_graph_last_edge({'edgeSet': [{'right':[4,5,6]}, {'right':[8], 'type': 'iclass'}], 'entities': []}) ==\
    {'right': [8], 'type': 'iclass'}
    True
    >>> get_graph_last_edge({'edgeSet': [{'right':[4,5,6], 'type': 'direct'}, {'right':[8], 'type': 'iclass'}], 'entities': []}, filter_out_types={'iclass'})
    {'right': [4, 5, 6], 'type': 'direct'}
    >>> get_graph_last_edge({'edgeSet': [], 'entities': []}, filter_out_types={'iclass', 'v-structure', 'reverse', 'class'})
    {}
    >>> get_graph_last_edge({'edgeSet': [{'right':[4,5,6], 'type': 'reverse'}], 'entities': []}, filter_out_types={'iclass', 'v-structure', 'reverse', 'class'})
    {}
    >>> get_graph_last_edge({'edgeSet': [{'right':[4,5,6]}], 'entities': []}, filter_out_types={'iclass', 'v-structure', 'reverse', 'class'})
    {'right': [4, 5, 6]}
Get the last edge of the graph or an empty edge if there is non
Get the last edge of the graph or an empty edge if there is non
def get_graph_last_edge(g, filter_out_types=set()):
    """
    Get the last edge of the graph or an empty edge if there is non

    :param g: a graph as a dictionary
    :param filter_out_types: a set fo edge types to filter out, if not empty the last edge of the specified type is returned
    :return: an edge as a dictionary
    >>> get_graph_last_edge({'edgeSet': [{'right':[4,5,6]}, {'right':[8], 'type': 'iclass'}], 'entities': []}) ==\
    {'right': [8], 'type': 'iclass'}
    True
    >>> get_graph_last_edge({'edgeSet': [{'right':[4,5,6], 'type': 'direct'}, {'right':[8], 'type': 'iclass'}], 'entities': []}, filter_out_types={'iclass'})
    {'right': [4, 5, 6], 'type': 'direct'}
    >>> get_graph_last_edge({'edgeSet': [], 'entities': []}, filter_out_types={'iclass', 'v-structure', 'reverse', 'class'})
    {}
    >>> get_graph_last_edge({'edgeSet': [{'right':[4,5,6], 'type': 'reverse'}], 'entities': []}, filter_out_types={'iclass', 'v-structure', 'reverse', 'class'})
    {}
    >>> get_graph_last_edge({'edgeSet': [{'right':[4,5,6]}], 'entities': []}, filter_out_types={'iclass', 'v-structure', 'reverse', 'class'})
    {'right': [4, 5, 6]}
    """
    if 'edgeSet' not in g or len(g["edgeSet"]) == 0:
        return {}
    if len(filter_out_types) == 0:
        return g["edgeSet"][-1] if 'edgeSet' in g and g["edgeSet"] else {}
    else:
        for i in range(len(g["edgeSet"]) - 1, -1, -1):
            edge = g["edgeSet"][i]
            if edge.get("type") not in filter_out_types:
                return edge
        return {}
def get_graph_last_edge ( g , filter_out_types = set ( ) ) : if 'edgeSet' not in g or len ( g [ "edgeSet" ] ) == 0 : return { } if len ( filter_out_types ) == 0 : return g [ "edgeSet" ] [ - 1 ] if 'edgeSet' in g and g [ "edgeSet" ] else { } else : for i in range ( len ( g [ "edgeSet" ] ) - 1 , - 1 , - 1 ) : edge = g [ "edgeSet" ] [ i ] if edge . get ( "type" ) not in filter_out_types : return edge return { }