예제 #1
0
def match(gw, track, debug=False):
    dag_rds = create_dag_rds(gw, track)
    if dag_rds is None:
        # print 'failed creating DAG',
        return None
    dag = dag_rds['dag']
    rds = dag_rds['rds']
    vote_dict = voting(dag, rds)

    p_dag = path_from_vote(dag, vote_dict, rds)

    if p_dag is None:
        # print 'failed finding path in DAG',
        return None
    es = cdagm.pdag2es(dag, p_dag)
    if es is None:
        # print 'failed generating edge list in Graph'
        return None
    p = cp.new_path_from_es(gw, track.tid, es)
    if p is None:
        # print 'failed creating Path instance'
        return None
    if debug:
        global gdag
        gdag = dag.copy()
        global gpag
        gpdag = list(p_dag)
        global ges
        ges = list(es)
    return p
예제 #2
0
def match(gw, track, debug=False):
    dag = create_dag(gw, track)
    if dag is None:
        print 'failed creating DAG',
        return None
    # p_dag = cdagm.longest_path_dag(dag, init_weight_with, combine_weight_with)
    p_dag = cdagm.shortest_path_dag(dag, init_weight_with, combine_weight_with)
    if p_dag is None:
        print 'failed finding path in DAG',
        return None
    es = cdagm.pdag2es(dag, p_dag)
    if es is None:
        print 'failed generating edge list in Graph'
        return None
    p = cp.new_path_from_es(gw, track.tid, es)
    if p is None:
        print 'failed creating Path instance'
        return None

    update_ways_weight(p, track)
    # update_ways_weight_proj(p, track)

    if debug:
        global gdag
        gdag = dag.copy()
        global gpag
        gpdag = list(p_dag)
        global ges
        ges = list(es)
    return p
예제 #3
0
def match(gw, track, debug = False):
    dag_rds = create_dag_rds(gw, track)
    if dag_rds is None:
        # print 'failed creating DAG',
        return None
    dag = dag_rds['dag']
    rds = dag_rds['rds']
    vote_dict = voting(dag, rds)
    
    p_dag = path_from_vote(dag, vote_dict, rds)


    if p_dag is None:
        # print 'failed finding path in DAG',
        return None
    es = cdagm.pdag2es(dag, p_dag)
    if es is None:
        # print 'failed generating edge list in Graph'
        return None
    p = cp.new_path_from_es(gw, track.tid, es)
    if p is None:
        # print 'failed creating Path instance'
        return None
    if debug:
        global gdag
        gdag = dag.copy()
        global gpag
        gpdag = list(p_dag)
        global ges
        ges = list(es)
    return p
def match(gw, track, debug = False):
    dag = create_dag(gw, track)
    if dag is None:
        print 'failed creating DAG',
        return None
    # p_dag = cdagm.longest_path_dag(dag, init_weight_with, combine_weight_with)
    p_dag = cdagm.shortest_path_dag(dag, init_weight_with, combine_weight_with)
    if p_dag is None:
        print 'failed finding path in DAG',
        return None
    es = cdagm.pdag2es(dag, p_dag)
    if es is None:
        print 'failed generating edge list in Graph'
        return None
    p = cp.new_path_from_es(gw, track.tid, es)
    if p is None:
        print 'failed creating Path instance'
        return None

    update_ways_weight(p, track)
    # update_ways_weight_proj(p, track)

    if debug:
        global gdag
        gdag = dag.copy()
        global gpag
        gpdag = list(p_dag)
        global ges
        ges = list(es)
    return p
예제 #5
0
def match(gw, track, debug = False):
    try:
        dag = create_dag(gw, track)
        if dag is None:
            print 'failed creating DAG',
            return None
        p_dag = cdagm.longest_path_dag(dag, init_weight_with, combine_weight_with)
        if p_dag is None:
            print 'failed finding path in DAG',
            return None
        es = cdagm.pdag2es(dag, p_dag)
        if es is None:
            print 'failed generating edge list in Graph'
            return None
        p = cp.new_path_from_es(gw, track.tid, es)
        if p is None:
            print 'failed creating Path instance'
            return None
    except:
        return None
    return p