Example #1
0
def keySet(map):
    """
    Retorna una lista con todas las llaves de la tabla de hash

    Args:
        map: El map
    Returns:
        lista de llaves
    Raises:
        Exception
    """
    if (map['type'] == 'CHAINING'):
        return cht.keySet(map)
    else:
        return pht.keySet(map)
def rutasPorResistencia(bikes, initialStation, Limit):
    LimitPaths = lt.newList("ARRAY_LIST")
    shortParths = minimumCostPaths(bikes, initialStation)
    stations = shortParths["paths"]['visited']
    desIterator = it.newIterator(ph.keySet(stations))
    while it.hasNext(desIterator):
        eachdesination = it.next(desIterator)
        shortParth = minimumCostPath(shortParths, eachdesination)
        while not stack.isEmpty(shortParth):
            eachPath = stack.pop(shortParth)
            if int(eachPath["weight"]) <= Limit:
                lt.addLast(
                    LimitPaths, {
                        "Initial Station": eachPath['vertexA'],
                        "Final Station": eachPath['vertexB'],
                        "Time": eachPath['weight']
                    })
    return (LimitPaths)
Example #3
0
def accidentes_en_un_rango(analyzer, initialDate, finalDate):
    lst = om.values(analyzer["fechas_accidente"], initialDate, finalDate)
    lstiterator = it.newIterator(lst)
    severidades = {}
    total = 0
    while (it.hasNext(lstiterator)):
        lstdate = it.next(lstiterator)
        tabla = lstdate["fecha_del_accidente"]
        keys = pr.keySet(tabla)
        itera = it.newIterator(keys)
        while (it.hasNext(itera)):
            lstk = it.next(itera)
            parej = m.get(tabla, lstk)
            valu = me.getValue(parej)
            size = lt.size(valu["lista_de_accidentes"])
            if lstk in severidades:
                severidades[lstk] += size
            else:
                severidades[lstk] = size
            total += size
    sever = mayor_valor(severidades)
    return (total, sever)