Esempio n. 1
0
 def test_dijkstra(self):
     print "Dijkstra"
     name = "graph3"
     p = "/Users/sacry/dev/uni/s3/WS1314/GKA/graphs/"+name+".graph"
     gp = GraphParser(p, name)
     g = gp.createGraph()
     l = graph_algorithms.shortestDijkstra(g, "y", "u", "d")
     shortest_path_as_names = map(lambda x: x.name(), l)
     self.assertEqual(["y","s","x","u"], shortest_path_as_names)
Esempio n. 2
0
 def test_graph_parser(self):
     print "Graph Parsing"
     name = "graph1"
     p = getcwd() + "/graphs/old/" + name + ".graph"
     gp = GraphParser(p, name)
     g = gp.createGraph()
     self.assertTrue(not g.empty())
     actual_neighbours = set(["Neumünster", "Bremen", "Berlin", "Hannover","Lüneburg","Lübeck"])
     expected_neighbours = g.neighbours("Hamburg")
     self.assertEqual(actual_neighbours, expected_neighbours)
     hamburg = g.vertice("Hamburg")
     self.assertTrue("Hamburg", hamburg.name())
     print g
Esempio n. 3
0
 def __init__(self):
     if Jaime.instance:
         raise Exception("Can't call to constructor with another instance created")
     
     self.tabs_widget = QTabWidget()
     self.view = QWebView()
     self.page = QWebPage()
     self.config = SafeConfigParser()        
     Logger.getLoggerFor(self.__class__)
     
     self.tabs_widget.insertTab(0,self.view,'label')
     self.tabs = {}        
     
     self.graph_file = None
     
     self.close_tab_timer = QTimer()
     self.close_tab_timer.setSingleShot(False)
     #cada 30 segundos se cierra un tab
     self.close_tab_timer.setInterval(10000)
     self.view.setPage(self.page)
     self.tabs['mainTab'] = self.view
     
     self.network_manager = CustomNetworkAccessManager.getInstance()        
     self.navigator = Navigator.getInstance()
     self.route_node = YahooRouteNode.getInstance()
     self.graph_parser = GraphParser.getInstance()        
     self.page.setNetworkAccessManager(self.network_manager)
Esempio n. 4
0
 def takeEntryPoint(self):        
     g = GraphParser.getInstance()
     for ax in self.axis:
         self.logger.info('Axis : %s' % ax)
         
     if g.entry_point:
         self.logger.info('Taking the entry point %s' % g.entry_point)
         self.last_url = QUrl(g.entry_point)
         inst =  Jaime.getInstance()
         inst.view.load(QUrl(g.entry_point))    
         return True
     
     self.logger.error("Can't take entry point, graph has't entry point")
     return False
Esempio n. 5
0
 def __init__(self):
     self.grap_name = 'Dafiti Checkout'
     self.graph_parser = GraphParser.getInstance()
Esempio n. 6
0
 def __init__(self):
     self.grap_name = 'Test graph'
     self.graph_parser = GraphParser.getInstance()
Esempio n. 7
0
        for ldbc_vert_1, ldbc_vert_2 in graph_parser.lines_in_edge_file():
            metis_vert_1, metis_vert_2 = metis_by_ldbc[
                ldbc_vert_1], metis_by_ldbc[ldbc_vert_2]

            rank_for_metis_vert_1 = rank_by_metis_vert[metis_vert_1]
            edge_files_ptrs[rank_for_metis_vert_1].write(
                f"{ldbc_vert_1} {ldbc_vert_2}\n")

            rank_for_metis_vert_2 = rank_by_metis_vert[metis_vert_2]
            edge_files_ptrs[rank_for_metis_vert_2].write(
                f"{ldbc_vert_2} {ldbc_vert_1}\n")

            if rank_for_metis_vert_1 != rank_for_metis_vert_2:
                part_data[rank_for_metis_vert_1].add(
                    f"{ldbc_vert_2} {rank_for_metis_vert_2 + WORKER_NODES_RANK_OFFSET}\n"
                )
                part_data[rank_for_metis_vert_2].add(
                    f"{ldbc_vert_1} {rank_for_metis_vert_1 + WORKER_NODES_RANK_OFFSET}\n"
                )

        for data, fp in zip(part_data, part_files_ptrs):
            for line in data:
                fp.write(line)


if __name__ == "__main__":
    args = parse_args()
    graph_parser = GraphParser(args.name)
    split_partitions(graph_parser, int(args.n_part))
Esempio n. 8
0
 def __init__(self):
     self.grap_name = 'Resource search on witness'
     self.graph_parser = GraphParser.getInstance()