prime = prime + 1 if(isPrime(prime) == True): found = True return prime def comparenames (searchname, element): return (searchname == element['key']) if __name__ == "__main__" : graph = g.newGraph(7,comparenames,True) g.insertVertex (graph, 'Bogota') g.insertVertex (graph, 'Yopal') g.insertVertex (graph, 'Cali') g.insertVertex (graph, 'Medellin') g.insertVertex (graph, 'Pasto') g.insertVertex (graph, 'Barranquilla') g.insertVertex (graph, 'Manizales') g.insertVertex (graph, 'Cucuta') g.insertVertex (graph, 'Bucaramanga') g.addEdge (graph, 'Bogota', 'Yopal', 1 ) g.addEdge (graph, 'Bogota', 'Medellin', 1 ) g.addEdge (graph, 'Bogota', 'Pasto', 1 ) g.addEdge (graph, 'Bogota', 'Cali', 1 )
def insertVertex(graph, vertex): """ Inserta el vertice vertex en el grafo graph """ if (graph['type'] == "ADJ_LIST"): return alt.insertVertex(graph, vertex)