Example #1
0
def adjacents(graph, vertex):
    """
    Retorna una lista con todos los vertices adyacentes al vertice vertex
    Args:
        graph: El grafo sobre el que se ejecuta la operacion
        vertex: El vertice del que se quiere la lista
    Returns:
        La lista de adyacencias
    Raises:
        Exception
    """
    return gr.adjacents(graph, vertex)
Example #2
0
def fallas(analyzer,vertice):
    print(vertice)
    Lista=lt.newList()
    listi=lt.newList()
    
    #recorrer map con los landing points y decir que si vertice == [name:] entonces name=l[name]

    
    vertices=gr.vertices(analyzer['connections'])
    b=lit.newIterator(vertices)
    name=" "
    while lit.hasNext(b) and name== " ":
        c=lit.next(b)
        if "-" in c:
            h=c.split("-")
            if h[1]==vertice:
                name=c
                print("hola")
    
    edges=gr.adjacents(analyzer['connections'], name)

    b=lit.newIterator(edges)
    while lit.hasNext(b):
        c=lit.next(b)
        h=c.split("-")
        p=me.getValue(mp.get(analyzer['landingpoints'],h[0]))
        loc1=(float(p['latitude']),float(p['longitude']))
        minin=100000000
        landeA=0
        for country in (analyzer['countries']['table']['elements']):
           
            if country['key']!=None:
                land=me.getValue(mp.get(analyzer['countries'], country['key']))
                loc2=(float(land['CapitalLatitude']),float(land['CapitalLongitude']))
                dist=hs.haversine(loc1,loc2)
                if dist<minin:
                    minin=dist
                    print("si")
                    landeA=land['CountryName']
        if landeA !=0:
            lt.addLast(Lista, landeA)  
    return Lista