예제 #1
0
def addConnection(citibike, origin, destination, duration):
    edge = gr.getEdge(citibike["graph"], origin, destination)
    if edge is None:
        gr.addEdge(citibike["graph"], origin, destination, duration)
    else:
        e.updateAverageWeight(edge, duration)
    return citibike
def addConnection(analyzer, CA1, CA2, startTime, TripDuration):
    edge = gr.getEdge(analyzer["graph"], CA1, CA2, startTime)
    if edge is None:
        gr.addEdge(analyzer["graph"], CA1, CA2, TripDuration, startTime)
    else:
        e.updateAverageWeight(analyzer["graph"], edge, TripDuration)
    return analyzer
def addConnection(citibike, origin, destination, duration, usertype, group):
    edge = gr.getEdge(citibike["graph"], origin, destination)
    if edge is None:
        gr.addEdge(citibike["graph"], origin, destination, duration)
    else:

        e.updateAverageWeight(citibike["graph"], edge, duration, destination)
        e.updateUserType(edge, usertype, group)
    return citibike
예제 #4
0
def addConnection(catalog, origin, destination, duration):
    """
    Adiciona un arco entre dos estaciones
    """
    edge = gr.getEdge(catalog['graph'], origin, destination)
    if edge is None:
        gr.addEdge(catalog['graph'], origin, destination, duration)
    else:
        e.updateAverageWeight(edge, duration)
    return catalog
예제 #5
0
def addConnection(analyzer, origin, destination, duration):
    """
    Adiciona un arco entre dos estaciones. Si el arco existe se actualiza su peso con el promedio.
    """
    edge = gr.getEdge(analyzer['connections'], origin, destination)
    if edge is None:
        gr.addEdge(analyzer['connections'], origin, destination, duration)
    else:
        e.updateAverageWeight(edge, duration)
    return analyzer
def addConnection(citibike, start, finish, duration):
    """
    Adiciona un arco entre dos estaciones
    """
    edge = gr.getEdge(citibike['graph'], start, duration)
    if edge is None:
        gr.addEdge(citibike['graph'], start, finish, duration)
    else:
        e.updateAverageWeight(edge, duration)
    return citibike
예제 #7
0
def addConnection(citibike, origin, destination, duration):
    """
    Adiciona un arco entre dos estaciones.
    Si el arco ya existe, se actualiza su peso promedio.
    """
    edge = gr.getEdge(citibike['graph'], origin, destination)
    if edge is None:
        gr.addEdge(citibike['graph'], origin, destination, duration)
    else:
        e.updateAverageWeight(edge, duration)
def Añadir_conexion(Taxis, origin, destination, duration):
    edge = gr.getEdge(Taxis["communityAreas"], origin, destination)
    if edge is None:
        splitOrig = origin.split(" - ")
        splitDest = destination.split(" - ")
        if splitOrig[0] != splitDest[0]:
            gr.addEdge(Taxis["communityAreas"], origin, destination, duration)
        else:
            pass
    else:
        ed.updateAverageWeight(edge, duration)
    return Taxis
예제 #9
0
def addConnection(analyzer, origin, destination, duration):
    edge = gr.getEdge(analyzer["communityAreas"], origin, destination)
    if edge is None:
        splitOrig = origin.split(" - ")
        splitDest = destination.split(" - ")
        if splitOrig[0] != splitDest[0]:
            gr.addEdge(analyzer["communityAreas"], origin, destination,
                       duration)
        else:
            pass
    else:
        ed.updateAverageWeight(edge, duration)
    return analyzer
예제 #10
0
def addConnection(analyzer, origin, destination, distance):
    """
    Adiciona un arco entre dos estaciones
    """
    edge = gr.getEdge(analyzer['connections'], origin, destination)
    if edge is None:
        gr.addEdge(analyzer['connections'], origin, destination, distance)
    else:  #actualizacion del peso de los arcos
        e.updateAverageWeight(edge, distance)

    #else:
    #    gr.updateAverageWeight (edge, distance)
    #    print ("Arco update " + str(origin) + "-->" + str(destination) + "count: " + str(edge['count']))
    return analyzer