(g: SemanticGraph)
return new_graphs
Adds a new constraint edge to the graph.

    :param g: a semantic graph with a non-empty edge list
    :return: a list of new graphs
    >>> add_relation(SemanticGraph([Edge(leftentityid=QUESTION_VAR, rightentityid="Q76")], tokens=['first']))
    [SemanticGraph([Edge(0, ?qvar-None->Q76), Edge(1, ?qvar-None->MIN)], 0), SemanticGraph([Edge(0, ?qvar-None->Q76), Edge(1, ?qvar-None->MAX)], 0)]
    >>> add_relation(SemanticGraph())
    []
    >>> add_relation(SemanticGraph([Edge(leftentityid=QUESTION_VAR, rightentityid="Q76", qualifierentityid="MAX")]))
    []
Adds a new constraint edge to the graph.
Adds a new constraint edge to the graph .
def add_relation(g: SemanticGraph):
    """
    Adds a new constraint edge to the graph.

    :param g: a semantic graph with a non-empty edge list
    :return: a list of new graphs
    >>> add_relation(SemanticGraph([Edge(leftentityid=QUESTION_VAR, rightentityid="Q76")], tokens=['first']))
    [SemanticGraph([Edge(0, ?qvar-None->Q76), Edge(1, ?qvar-None->MIN)], 0), SemanticGraph([Edge(0, ?qvar-None->Q76), Edge(1, ?qvar-None->MAX)], 0)]
    >>> add_relation(SemanticGraph())
    []
    >>> add_relation(SemanticGraph([Edge(leftentityid=QUESTION_VAR, rightentityid="Q76", qualifierentityid="MAX")]))
    []
    """
    new_graphs = []
    if len(g.edges) > 0 and not any(e.temporal for e in g.edges):
        add_args = []
        sorting = 'MIN'
        if len(argmin_markers & set(g.tokens)) > 0:
            add_args = arg_relations['MIN']
            sorting = 'MIN'
        elif len(argmax_markers & set(g.tokens)) > 0:
            add_args = arg_relations['MAX']
            sorting = 'MAX'
        for rel in add_args:
            new_g = copy(g)
            new_g.edges.append(Edge(leftentityid=QUESTION_VAR, rightentityid=sorting, relationid=rel))
            new_graphs.append(new_g)
    return new_graphs
def add_relation ( g : SemanticGraph ) : new_graphs = [ ] if len ( g . edges ) > 0 and not any ( e . temporal for e in g . edges ) : add_args = [ ] sorting = 'MIN' if len ( argmin_markers & set ( g . tokens ) ) > 0 : add_args = arg_relations [ 'MIN' ] sorting = 'MIN' elif len ( argmax_markers & set ( g . tokens ) ) > 0 : add_args = arg_relations [ 'MAX' ] sorting = 'MAX' for rel in add_args : new_g = copy ( g ) new_g . edges . append ( Edge ( leftentityid = QUESTION_VAR , rightentityid = sorting , relationid = rel ) ) new_graphs . append ( new_g ) return new_graphs