import os import sys import numpy as np myPath = os.path.dirname(os.path.abspath(__file__)) sys.path.insert(0, myPath + '/../') from graph.Graph import Graph from algorithms.floyd_warshall import * from algorithms.quinca import * sources = [1, 2, 3, 0, 4, 1, 2, 1, 3] targets = [0, 0, 0, 4, 0, 2, 1, 3, 1] graph = Graph(sources, targets) graph.print_r() print("Insert Worst Edge") #graph.draw() graph.insert_worst_edge() graph.print_r() print(graph.last_edge_updated)
from algorithms.abm import * sources = [0, 0, 1, 2, 2, 3] targets = [1, 2, 2, 3, 4, 4] weights = [2, 3, 2, 1, 3, 1] graph = Graph(sources, targets, weights) graph.print_r() dist = Dijkstra_apsp(graph) print("DONE") print(dist) print(graph.insert_worst_edge()) """ t = time() Even_Gazit(graph, dist.copy()) print( "Time: ", (time() - t) * 1000 ) #0.052452 t = time() Bfs_Truncated_With_Sources(graph, dist.copy()) print( "Time: ", (time() - t) * 1000 ) #0.18024 t = time() Quinca(graph, dist.copy()) print( "Time: ", (time() - t) * 1000 )