From 71da6c72749074a30fbdc08b89c58958716eeaa2 Mon Sep 17 00:00:00 2001 From: Akif Date: Thu, 23 Jan 2020 21:01:21 -0800 Subject: [PATCH] update --- C Code/README.md | 15 ----- C Code/time_graph_gen.cc | 141 --------------------------------------- 2 files changed, 156 deletions(-) delete mode 100644 C Code/README.md delete mode 100644 C Code/time_graph_gen.cc diff --git a/C Code/README.md b/C Code/README.md deleted file mode 100644 index 8a2ad2f..0000000 --- a/C Code/README.md +++ /dev/null @@ -1,15 +0,0 @@ - - - -# Compile # - -```g++ time_graph_gen.cc -o time_graph_gen -O3``` - - -# Usage # - - -```./time_graph_gen ``` - -```./time_graph_gen ~/hetro_map_graphs/USA-road-t.CAL.gr 10 1895126 CAL_t.gr``` - diff --git a/C Code/time_graph_gen.cc b/C Code/time_graph_gen.cc deleted file mode 100644 index 72b40fa..0000000 --- a/C Code/time_graph_gen.cc +++ /dev/null @@ -1,141 +0,0 @@ -/* - Distributed Under the MIT license - Uses a Speculative Dijkstra Algorithm to find shortest path distances - Programs by Masab Ahmad (UConn) -*/ - -#include -#include -#include -#include -//#include "carbon_user.h" /*For the Graphite Simulator*/ -#include -#include -//#include "../../common/barrier.h" -//#include "barrier.h" -#include -#include -#include -#include - - -#define MAX 100000000 -#define INT_MAX 100000000 -#define BILLION 1E9 - -using namespace std; - -//Thread Argument Structure -typedef struct -{ - int tid; - int P; - int T; - int N; - pthread_barrier_t* barrier; -} thread_arg_t; - -//Edge Task Struct -struct task { - int node; - int dist; - bool operator<(const task& rhs) const - { - return dist > rhs.dist; - } -}; - - -int **edges; -int largest = 0; -double largest_d; -int *D; -int *D_temp; -thread_arg_t thread_arg[1024]; -pthread_t thread_handle[1024]; -std::priority_queue pq; - -int iter = 0; - -typedef struct neighbor_node{ - int neighbor; - int *weights; - int *time_instants; - int temporal_deg; -}neighbor_node; - -typedef struct graph_node_s { - int deg; - neighbor_node *neighbors; -} graph_node_t; - -graph_node_t *nodes; - -typedef struct node_s{ - int neighbor; - int weight; -}node_t; - -typedef struct edge_t{ - int weight; - int time; -}edge_t; - - -int main(int argc, char** argv) -{ - char *filename = argv[1]; - int temporal_edges = atoi(argv[2]); - int max_time = atoi(argv[3]); - int min_time = 0; //atoi(argv[4]); - char *outfile = argv[4]; - int number0,number1,weig; - - int step_size = (int)max_time/temporal_edges; - - FILE *file0; - int f0; - - multimap time_instants_map; - - file0 = fopen(filename,"r"); - if (!file0) { - printf ("Error: Unable to open input file '%s'\n",filename); - return 1; - } - int N, E; - char p; - char sp[2]; - f0 = fscanf(file0, "%c %s %d %d\n", &p, sp, &N, &E); - char a; - while(1){ - f0 = fscanf(file0, "%c %d %d %d\n", &a, &number0,&number1, &weig); - if(f0 == EOF) - break; - node_t curr_edge; - curr_edge.neighbor = number1; - curr_edge.weight = weig; - time_instants_map.insert({ number0, curr_edge }); - } - fclose(file0); - - printf("File Read\n"); - file0 = fopen(outfile,"w"); - if (!file0) { - printf ("Error: Unable to open input file '%s'\n",outfile); - return 1; - } - - for(auto it=time_instants_map.begin(); it!=time_instants_map.end(); it++) - { - for(int t=min_time; t<=max_time; t+=step_size) - { - node_t curr_edge = it->second; - fprintf(file0,"%d %d %d %d\n",it->first, curr_edge.neighbor, curr_edge.weight, t); - } - - } - fclose(file0); - -} -