示例#1
0
def print_carga_de_datos_info(catalog, elemets):

    print("Cargando información de los archivos ....")
    print_separador_gigante()
    print("Se ha cargado un total de " +
          str(gr.numEdges(catalog["connections"])) +
          " de conexiones entre arcos")
    print("Se ha cargado un total de " +
          str(gr.numVertices(catalog["connections"])) +
          " landing points conectados")
    print("Se ha cargado un total de " +
          str(controller.mpsize(catalog["info_countries"])) + " paises")
    print_separador_sensillo()
    print(("primer landing point cargado").upper())
    print_separador_sensillo()
    primer_elemeto = elemets[1][1]
    print("-identificador: " + str(primer_elemeto["landing_point_id"]))
    print("-nombre: " + str(primer_elemeto["name"]))
    print("-latitud: " + str(primer_elemeto["latitude"]))
    print("-longitud: " + str(primer_elemeto["longitude"]))
    print_separador_sensillo()
    elemento_final = elemets[1][2]
    print(("La ultimo landing point cargado:").upper())
    print_separador_sensillo()
    print("-identificador: " + str(elemento_final["landing_point_id"]))
    print("-nombre: " + str(elemento_final["name"]))
    print("-latitud: " + str(elemento_final["latitude"]))
    print("-longitud: " + str(elemento_final["longitude"]))
    print_separador_gigante()
示例#2
0
def totalConnections(analyzer):
    """
    Retorna el total arcos del grafo
    """
    return gr.numEdges(analyzer['connections'])

    return analyzer
示例#3
0
def req1(datos, a, b):
    clusteres = gr.numEdges(datos['cables'])
    try:
        p = gr.getEdge(datos['cables'], a, b)
    except:
        p = "los  landing point no se encuentran en el mismo clúster"

    return (clusteres, p)
示例#4
0
def req4(catalog):

    grafo = catalog["connections"]

    initSearch = prim.initSearch(grafo)
    search = prim.prim(grafo, initSearch, "Washington, D.C.")
    mst = gr.newGraph(datastructure="ADJ_LIST",
                      size=3000,
                      directed=False,
                      comparefunction=compareIds)

    landing_points = mp.newMap(numelements=1249,
                               maptype="PROBING",
                               loadfactor=0.3)
    vertices = mp.keySet(search["marked"])

    for vertice in lt.iterator(vertices):

        lp = vertice.split("|")[0]
        mp.put(landing_points, lp, None)
        gr.insertVertex(mst, vertice)

    listaArcos = mp.keySet(search["edgeTo"])
    pesoTotal = 0

    for verticeB in lt.iterator(listaArcos):

        verticeA = mp.get(search["edgeTo"], verticeB)["value"]["vertexA"]
        peso = mp.get(search["edgeTo"], verticeB)["value"]["weight"]
        gr.addEdge(mst, verticeA, verticeB, peso)

        pesoTotal += peso

    dfsSearch = dfs.DepthFirstSearch(mst, "Washington, D.C.")
    maxArcos = 0
    arcos = None

    for vertice in lt.iterator(vertices):
        pathTo = dfs.pathTo(dfsSearch, vertice)

        if pathTo:

            numArcos = lt.size(pathTo)

            if numArcos > maxArcos:

                maxArcos = numArcos
                arcos = pathTo

    numLanding_points = gr.numEdges(mst) + 1

    return numLanding_points, pesoTotal, arcos
def crearsecuencia(strupa,LI,LF):
    i=LI
    lista=[]
    while i <= gr.numEdges(strupa["uniones"]) and i<LF:
        lista.append(str(i))
        if 45 not in i:
            i=i+15
        elif 24 not in i and 45 in i:
            i=i+100
            i=i-45
        elif 24 in i and 45 in i:
            i=0
    return lista
示例#6
0
def sacar_info(analyzer):
    vertices = gr.numVertices(analyzer['Arcos'])
    arcos = gr.numEdges(analyzer['Arcos'])
    paises = mp.keySet(analyzer["paises_nombre"])
    Num_paises = lt.size(paises)
    landings = mp.valueSet(analyzer['landing_points'])
    landing = lt.firstElement(landings)
    ciudades = mp.valueSet(analyzer['countries'])
    ciudad = lt.lastElement(ciudades)
    poblacion = ciudad["Population"]
    usuarios = ciudad["Internet users"]

    return vertices, arcos, Num_paises, landing, poblacion, usuarios
示例#7
0
def cargar(analyzer):
    
    landingpointsfile = cf.data_dir + "landing_points.csv"
    input_file = csv.DictReader(open(landingpointsfile, encoding="utf-8"),
                                delimiter=",")
    for point in input_file:
        model.addLandingPoint(analyzer,point)


    connectionsfile = cf.data_dir + "connections.csv"
    input_file = csv.DictReader(open(connectionsfile, encoding="utf-8"),delimiter=",")
    for connection in input_file:
        model.addLP_cable(analyzer, connection)
 
    countriesfile = cf.data_dir + "countries.csv"
    input_file = csv.DictReader(open(countriesfile, encoding="utf-8"),
                                delimiter=",")
    for country in input_file:
        model.addCountry(analyzer,country)

    countriesfile2 = cf.data_dir + "countries.csv"
    input_file = csv.DictReader(open(countriesfile2, encoding="utf-8"),
                                delimiter=",")
    for country2 in input_file:
        model.addCapital_V_E(analyzer,country2)
    
    model.edges_same_lp(analyzer)
    
  
    
    num_lps = mp.size(analyzer["landing_points"])
    num_conexiones = gr.numEdges(analyzer["connections_distance"])
    num_paises = mp.size(analyzer["countries"])

  
    return num_lps,num_conexiones,num_paises
示例#8
0
def InfoCatalog(analyzer):
    sizeCountries = lt.size(mp.keySet(analyzer['countriesInfo']))
    totLandingPoints = lt.size(mp.keySet(analyzer['LandingPointI']))
    totConections = gr.numEdges(analyzer['connectionsDistance'])
    return sizeCountries, totLandingPoints, totConections
def totalConexiones(analyzer):
    """
    Retorna el numero de arcos entre landing points
    """
    cont = gr.numEdges(analyzer['connections'])
    return cont
def totalConnections(citibike):
    graph = citibike["graph"]
    return gr.numEdges(graph)
示例#11
0
def thread_cycle():
    while True:
        printMenu()
        inputs = input('Seleccione una opción para continuar\n>')
        if int(inputs[0]) == 1:
            print("Cargando información de los archivos ....")
            catalog = controller.loadData(connectionsfile, landingpointsfile,
                                          countriesfile)

            lps = lt.firstElement(mp.keySet(catalog["landingpoints"]))
            lp_info = mp.get(catalog["landingpoints"], lps)['value']['info']
            lp_infos = mp.get(catalog["landingpoints"],
                              lps)['value']['lstcables']

            print("Cantidad de Landing Points: ",
                  mp.size(catalog["landingpoints"]))
            print("Cantidad de conexiones entre Landing Points: ",
                  gr.numEdges(catalog["internet_graph"]))
            print("Cantidad de paises: ", mp.size(catalog["countries"]))

            lps = lt.firstElement(mp.keySet(catalog["landingpoints"]))
            lp_info = mp.get(catalog["landingpoints"], lps)['value']['info']
            print('Primer landingpoint')
            print("Landing point id: ", lp_info['landing_point_id'], "id: ",
                  lp_info['id'], "name: ", lp_info['name'], "latitude: ",
                  lp_info['latitude'], "Longitude: ", lp_info["longitude"])

            countries = lt.firstElement(mp.keySet(catalog["countries"]))
            country_info = mp.get(catalog["countries"], countries)['value']
            print('Primer pais')
            print('CountryName: ', country_info['CountryName'], "Population: ",
                  country_info['Population'], "Internet users: ",
                  country_info['Internet users'])

        elif int(inputs[0]) == 2:
            lp1 = input('Ingrese el nombre del primer landing point: ')
            lp2 = input('Ingrese el nombre del segundo landing point: ')

            optionTwo(catalog, lp1, lp2)

        elif int(inputs[0]) == 3:
            optionThree(catalog)

        elif int(inputs[0]) == 4:
            country_1 = input('Ingrese el primer país: ')
            country_2 = input('Ingrese el segundo país: ')

            optionFour(catalog, country_1, country_2)

        elif int(inputs[0]) == 5:
            optionFive(catalog)

        elif int(inputs[0]) == 6:
            landingpoint = input('Ingrese el landinpoint: ')
            optionSix(catalog, landingpoint)

        elif int(inputs[0]) == 7:
            optionSeven(catalog)

        elif int(inputs[0]) == 8:
            optionEight(catalog)

        else:
            sys.exit(0)
    sys.exit(0)
示例#12
0
def totalConnections(analyzer):
    return gr.numEdges(analyzer['graph'])
def numEdges(graph):
    return gr.numEdges(graph)
示例#14
0
 tracemalloc.start()
 start_time = getTime()
 start_memory = getMemory()
 #***************************************
 analyzer = controller.loadData(cont, filename, filename2, filename3)
 #**************************************
 stop_memory = getMemory()
 stop_time = getTime()
 tracemalloc.stop()
 delta_time = round(stop_time - start_time, 2)
 delta_memory = round(deltaMemory(start_memory, stop_memory), 2)
 #-------------------------------------------------
 print("El numero de landing points es de: " +
       str(gr.numVertices(analyzer['connections'])))
 print("El total de conexiones entre landing points es de: " +
       str((gr.numEdges(analyzer['connections']))))
 print("El total de paises es de: " +
       str(mp.size(analyzer['countries'])))
 interno = me.getValue(mp.get(analyzer['landing'], '3316'))
 nombre = me.getValue(mp.get(interno, 'name'))
 longitud = me.getValue(mp.get(interno, 'longitude'))
 latitud = me.getValue(mp.get(interno, 'latitude'))
 print('El primer landing point cargado es: codigo: 3316  nombre: ' +
       nombre + '  longitud: ' + longitud + '  latitud: ' + latitud)
 pais = lt.getElement(mp.keySet(analyzer['countries']), -1)
 interno2 = me.getValue(mp.get(analyzer['countries'], pais))
 poblacion = me.getValue(mp.get(interno2, 'Population'))
 usuarios = me.getValue(mp.get(interno2, 'Internet users'))
 print('El último país cargado es ' + pais + ' con una población de ' +
       poblacion + ' y ' + usuarios + ' usuarios de internet.')
 print("Tiempo [ms]:", delta_time)
示例#15
0
pointFile = 'landing_points.csv'
connectFile = 'connections.csv'
countryFile = 'countries.csv'
"""
Menu principal
"""
while True:
    printMenu()
    inputs = input('Seleccione una opción para continuar\n')
    if int(inputs[0]) == 1:
        analyzer = controller.init()
        print("\nCargando información de los archivos...")
        analyzer = controller.loadData(analyzer, pointFile, connectFile,
                                       countryFile)
        LPs = gr.numVertices(analyzer['cables'])
        ARCs = gr.numEdges(analyzer['cables'])
        vertex = lt.firstElement(gr.vertices(analyzer['cables']))
        infoV = me.getValue(mp.get(analyzer['landingPoints'], vertex))
        last = lt.lastElement(mp.keySet(analyzer['paises']))
        infoL = mp.get(analyzer['paises'], last)
        infoL = infoL['value']
        print(infoL)
        print(f'El número total de Landing Points es {YELLOW}{LPs}{END}.')
        print(f'El número total de conexiones es {YELLOW}{ARCs}{END}.')
        print(
            f'En primer Landing Point tiene el identificador {YELLOW}{vertex}{END}.\nNombre: {YELLOW}{infoV[2]}{END}.\nID: {YELLOW}{infoV[1]}{END}.\
        \nLatitud: {YELLOW}{infoV[0][1]}{END}.\nLongitud: {YELLOW}{infoV[0][0]}{END}.'
        )
        print(
            f'El último país cargado es: {YELLOW}{last}{END}. \nPoblación: {YELLOW}{infoL[2]}{END}. \nUsuarios de internet: {YELLOW}{infoL[1]}{END}.'
        )
示例#16
0
def totalConnections(Inite):
    return gr.numEdges(Inite["Graph"])
示例#17
0
def totalEdges(analyzer):
    return gr.numEdges(analyzer['communityAreas'])
示例#18
0
def totalcables(datos):
    return gr.numEdges(datos['cables'])
示例#19
0
def totalRoutes(analyzer):
    """
    Retorna el total arcos del grafo
    """
    return gr.numEdges(analyzer['graph'])
示例#20
0
def num_edges(graph):
    return gr.numEdges(graph["graph"])
def totalConnections(bikes):
    """
    Retorna el total arcos del grafo
    """
    return gr.numEdges(bikes["grafo"])
def totalConnections(taxis):
    """
    Retorna el total arcos del grafo
    """
    return gr.numEdges(taxis['graph'])
示例#23
0
def totalConnections(analyzer):
    return gr.numEdges(analyzer['cables'])
示例#24
0
def TotalDeArcos(analyzer):
    return gr.numEdges(analyzer["graph"])
示例#25
0
def numConnections(citibike):
    """
    Retorna el número de conexiones (arcos)
    entre estaciones.
    """
    return gr.numEdges(citibike['graph'])
示例#26
0
def totalConnectionsLP(analyzer):
    return gr.numEdges(analyzer['connections'])
示例#27
0
def totalArcs(analyzer):
    "Retorna elnúmero de Arcos"
    return gr.numEdges(analyzer["connections"])
示例#28
0
def totalConnections(catalog):

    return gr.numEdges(catalog['connections'])
示例#29
0
def totalConnections(citibike):
    """
    Retorna el total arcos del grafo
    """
    return gr.numEdges(citibike['graph'])
示例#30
0
def buscar_arcos(graph):
    return gr.numEdges(graph['grafo'])