class Vertex: def __init__(self): self.objloadata = LoadData() def recorrerDataFrame(self, dataF): for indiceF, fila in dataF.iterrows(): print(fila) def recorrerDictionary(self, clave): self.objloadata.upLoadData() listaAdyancen = self.objloadata.getBasesConexiones() print(listaAdyancen.keys()) aux = pd.DataFrame() if clave in listaAdyancen: aux = listaAdyancen.get(clave) print(type(aux)) self.recorrerDataFrame(aux) print('*******') else: print('Base o aeropuerto no existe')
def addNode(self): nodoBases = [' BASE1 ', ' BASE2 ', 'BASE3 '] for nodo in self.vertices: if nodo in nodoBases: self.gradoD.add_node(nodo) def drawGraph(self): self.gradoD.add_nodes_from(self.vertices) self.addArista() pos = nx.spring_layout(self.gradoD) plt.figure() nx.draw(self.gradoD, pos, edge_color = 'black', width = 1, linewidths =2, node_size= 1500 , node_color = 'purple', alpha= 0.7,ax=None) nx.draw_networkx_labels(self.gradoD,pos, labels= {node: node for node in self.gradoD.nodes()}, font_size=9, alpha=1, horizontalalignment='center',verticalalignment='center' ,ax=None) plt.show() objload = LoadData() objload.upLoadData() print(objload.getBasesConexiones()) objgrafo = Grafo(objload.getDataAirport(),objload.getBasesConexiones()) objgrafo.drawGraph()
def hormigas(): objload = LoadData() aux = objload.getBasesConexiones() print(aux) viajar();