"ranking_order_matched": order_matched })) pagerank_df[ "frov_speed_up"] = pagerank_df["nx_pr_time"] / pagerank_df["frov_pr_time"] print(pagerank_df) # -------- bfs demo -------- source = 1 distance = 4 frov_bfs_time = [] nx_bfs_time = [] result_matched = [] for i in range(len(frov_graph)): start_time = time.time() frov_res = fnx.descendants_at_distance(frov_graph[i], source, distance) frov_bfs_time.append(round(time.time() - start_time, 4)) #print(list(frov_res)[:5]) start_time = time.time() nx_res = nx.descendants_at_distance(nx_graph[i], source, distance) nx_bfs_time.append(round(time.time() - start_time, 4)) #print(list(nx_res)[:5]) result_matched.append("Yes" if len(frov_res - nx_res) == 0 else "No") bfs_df = pd.DataFrame( OrderedDict({ "dataset": list(input_graph_files.keys()), "frov_bfs_time": frov_bfs_time, "nx_bfs_time": nx_bfs_time,
DATASET = "input/data" src = 50 distance = 1 #FROVEDIS try: argvs = sys.argv argc = len(argvs) if (argc < 2): print( 'Please give frovedis_server calling command as the first argument \n(e.g. "mpirun -np 2 /opt/nec/frovedis/ve/bin/frovedis_server")' ) quit() FrovedisServer.initialize(argvs[1]) frov_graph = fnx.read_edgelist(DATASET, nodetype=np.int32, delimiter=' ') fres = fnx.descendants_at_distance(frov_graph, src, distance) FrovedisServer.shut_down() except Exception as e: print("status=Exception: " + str(e)) sys.exit(1) #NetworkX try: nx_graph = nx.read_edgelist(DATASET, nodetype=np.int32, delimiter=' ') nres = nx.descendants_at_distance(nx_graph, src, distance) except Exception as e: print("status=Exception: " + str(e)) sys.exit(1) print(fres) print(nres)
#G.debug_print() print("Frovedis BFS edges: ", list(fnx.bfs_edges(G, source, depth_limit=depth))) print("NetworkX BFS edges: ", list(nx.bfs_edges(G_nx, source, depth_limit=depth))) print("Edges in Frovedis bfs_tree: ", fnx.bfs_tree(G, source, depth_limit=depth).number_of_edges()) print("Edges in NetworkX bfs_tree: ", nx.bfs_tree(G_nx, source, depth_limit=depth).number_of_edges()) print("Frovedis bfs_predecessors: ", list(fnx.bfs_predecessors(G, source, depth_limit=depth))) print("NetworkX bfs_predecessors: ", list(nx.bfs_predecessors(G_nx, source, depth_limit=depth))) print("Frovedis bfs_successors: ", list(fnx.bfs_successors(G, source, depth_limit=depth))) print("NetworkX bfs_successors: ", list(nx.bfs_successors(G_nx, source, depth_limit=depth))) print("Frovedis descendants at distance:", fnx.descendants_at_distance(G, source, distance=depth)) print("NetworkX descendants at distance:", nx.descendants_at_distance(G_nx, source, distance=depth)) # clean-up at the server side G.release() FrovedisServer.shut_down()