/***********************************************************************/ /* The following code computes alt. paths for metabolic conversions via*/ /* Johnson's algorithm for enumerating cycles in a directed graph. */ /* This program requires one input file containing information on the */ /* directed graph we are analyzing: the first line contains the total */ /* number of vertices separated by a space from the total number of */ /* edges of the graph. the other lines specify */ /* the edges b.m.o. the starting vertex (first column), the ending */ /* vertex (second column) and the weight of the edge (third column). */ /* The output consists in the cycle distribution of the graph and */ /* various (1-,2-,3-point) marginal distributions derived form this. */ /***********************************************************************/ #include #include #include typedef unsigned long long RANDOM_TYPE; #define NUM_VERTICES_MAX 200000 #define NUM_EDGES_MAX (NUM_VERTICES_MAX*3) #define B_SPACE 10000 #define MAX_STACK_DEPTH B_SPACE /* NUM_EDGES is the number of oriented edges */ /* the number of oriented edges is 2*NUM_EDGES */ #define MYRAND64A myrand64a = (6364136223846793005UL * myrand64a) #define MASSIMO_RAND64 0XFFFFFFFFFFFFFFFFUL RANDOM_TYPE myrand64a = 578991; double inv_massimo_rand64 = 1.0L / (double)MASSIMO_RAND64; typedef int MY_VERTEX; typedef int MY_INT; FILE *f_ver; char filename[200]; double averageNumEdges; long NUM_VERTICES, numVerticesRead, NUM_EDGES, i_sample; long lengthOne = 0; int NUM_SAMPLES, connectivity; float fconnectivity; unsigned long long num_circuits; MY_VERTEX num_vertices_now, num_edges_now, max_vertex; MY_VERTEX vertices_of_edge_list0[NUM_EDGES_MAX][2]; MY_VERTEX vertices_of_edge_list[NUM_EDGES_MAX][2]; MY_VERTEX tedge_first_of_vertex[NUM_VERTICES_MAX]; MY_VERTEX tedge_last_of_vertex[NUM_VERTICES_MAX]; MY_VERTEX vertices_of_b_list[B_SPACE]; MY_VERTEX tvertex_b_next_of_tvertex[B_SPACE]; MY_VERTEX tvertex_b_former_of_tvertex[B_SPACE]; MY_VERTEX tvertex_b_first_of_vertex[NUM_VERTICES_MAX]; MY_VERTEX tvertex_b_last_of_vertex[NUM_VERTICES_MAX]; MY_VERTEX tvertex_b_first_of_empty, tvertex_b_last_of_empty; MY_VERTEX num_b_empty, num_b[B_SPACE], num_tot_b; MY_VERTEX startVertexConnection[NUM_VERTICES_MAX]; MY_VERTEX endVertexConnection[NUM_VERTICES_MAX]; MY_VERTEX numberVertexConnection[NUM_VERTICES_MAX]; MY_VERTEX maxOccupied; MY_VERTEX my_stack[MAX_STACK_DEPTH], stack_depth; unsigned long long vertex_marginal[NUM_VERTICES_MAX], edge_marginal[NUM_EDGES_MAX]; int adjacency[100][100]; int vertices_of_original_edges[2000][2]; long double edge_weight[2000]; long double tot_weighted_cycles; long double weighted_vertex_marginal[1000], weighted_edge_marginal[2000]; long double edge_adjacency_marginal[2000][2000]; char blocked[NUM_VERTICES_MAX]; MY_VERTEX this_circuit_vertex; unsigned long long his_circuits[NUM_VERTICES_MAX+2]; #define EMPTY_VERTEX -1 #define MY_FIRST -2 #define MY_LAST -3 #define EMPTY_TVERTEX -4 #define NO_VERTEX -5 #define MY_FALSE 0 #define MY_TRUE 1 #define MY_DEBUG #undef MY_DEBUG #define MY_DEBUG2 #undef MY_DEBUG2 #define PRUNING #undef PRUNING #define WRITE_GRAPH #undef WRITE_GRAPH #define LOCAL_HYS #undef LOCAL_HYS #define MY_TEST_RANDOM #undef MY_TEST_RANDOM #define FIX_RAN #undef FIX_RAN #define ER_P_RAN #undef ER_P_RAN #define ER_N_RAN #undef ER_N_RAN #define PRUNING #define ER_N_RAN #ifdef LOCAL_HYS unsigned long long numberCircuits[NUM_VERTICES_MAX+2]; #endif void read_params(int argc, char *argv[]); void my_init(void); void my_end(void); void my_init_inside(void); void my_init_ran(void); void my_printout(void); void chop_vertices(MY_VERTEX v_min); void read_vertices_from_edges_dat(void); void pruneItUp(void); int check_and_set_vertices_of_edge_list(MY_VERTEX v_min); void init_b_list_to_empty(void); void print_b_list(void); void add_to_b_list(MY_VERTEX v1, MY_VERTEX v2); void erase_from_b_list(MY_VERTEX v1, MY_VERTEX v2); void test_add_erase_b(void); void init_stack(void); void print_stack(void); void print_stack_debug(void); void print_stack_gt_two_plus(MY_VERTEX v); void push_stack(MY_VERTEX v); MY_VERTEX pop_stack(void); void find_circuits(void); void unblock(MY_VERTEX u); char circuit(MY_VERTEX v); void my_init_marginals(void); void adjust_marginal(MY_VERTEX v); void compute_ranking(void); /**********************************************************************/ int main(int argc, char **argv ){ read_params(argc, argv); my_init(); for(i_sample=0; i_sample1) { for (l=0;argv[1][l]!='\0';l++) filename[l]=argv[1][l]; filename[l]='\0'; fflush(stdout); } else { printf("# Usage: \n"); exit(0); } } /***********************************************************************/ void my_end(void){ //printf("AVERAGE NUM (UNORIENTED) EDGES %lg\n", //averageNumEdges/(double)NUM_SAMPLES); } /***********************************************************************/ void my_init_ran(void){ printf("# Please input num vertices\n"); fflush(stdout); scanf("%ld",&numVerticesRead); printf("# num vertices is %ld\n",numVerticesRead); fflush(stdout); NUM_VERTICES = numVerticesRead; printf("# Please input num connectivity (long int)\n"); fflush(stdout); scanf("%d",&connectivity); printf("# connectivity is %d\n",connectivity); printf("# Please input num connectivity (float)\n"); fflush(stdout); scanf("%f",&fconnectivity); printf("# connectivity is %f\n",fconnectivity); fflush(stdout); } /***********************************************************************/ void my_init(void){ NUM_SAMPLES=1; averageNumEdges = 0.0; } /***********************************************************************/ void my_init_inside(void){ int i; for(i=0; i0){ t2+=his_circuits[i]; printf ("# [ L %d ]= %llu\n", i, his_circuits[i]); } } for(i=2; i0){ fflush(stdout); tot_cyc+=his_circuits[i]; } } printf("# TOT %lld %lld\t%lld %3.5Le\n", (t2+his_circuits[2]), t2, tot_cyc, tot_weighted_cycles); #ifdef LOCAL_HYS for(i=0; i0){ printf("LOCAL S %d I %d N %llu \n", i_sample, i, numberCircuits[i]); } fflush(stdout); } #endif for(i=0; i=B_SPACE){ printf("abort unblock sos_n too large\n"); exit(-9); } sos_v[sos_n]=w; sos_n++; if(tw==tlast)break; } for(si=0;si2){ tot_weighted_cycles+=weight_cycle; for(i=0; ; i++){ if(i==stack_depth){ edge=adjacency[previous_vertex][v]; edge_marginal[edge]++; weighted_edge_marginal[edge]+=weight_cycle; edge_adjacency_marginal[previous_edge][edge]+=weight_cycle; return; } vertex_marginal[my_stack[i]]++; weighted_vertex_marginal[my_stack[i]]+=weight_cycle; if (i!=0){ edge=adjacency[previous_vertex][my_stack[i]]; if (i!=1){ edge_adjacency_marginal[previous_edge][edge]+=weight_cycle; } else { previous_edge=adjacency[my_stack[stack_depth-1]][v]; edge_adjacency_marginal[previous_edge][edge]+=weight_cycle; } edge_marginal[edge]++; weighted_edge_marginal[edge]+=weight_cycle; previous_edge=edge; } previous_vertex=my_stack[i]; } } else { return; } } /***********************************************************************/ void compute_ranking() { int i, j, temp_rank, nb_vertex_rank; int temp_edge1, temp_edge2; long double temp_marg; int *vertex_ranking, *edge_ranking, *edge_adjacency_ranking; int nb_edge_adjacency; struct { long double marginal; int edge1; int edge2; } *weighted_edge_adjacency_marginal; vertex_ranking=calloc(NUM_VERTICES,sizeof(int)); edge_ranking=calloc(NUM_EDGES,sizeof(int)); nb_vertex_rank=0; for(i=0;ii; j--) { if (weighted_vertex_marginal[j-1]i; j--) { if (weighted_edge_marginal[j-1]0.){ nb_edge_adjacency++; } } if (edge_adjacency_marginal[i][i]>0.){ printf("ERROR: edge_adjacency_marginal[%d][%d] %3.7Le != 0\n", i, i, edge_adjacency_marginal[i][i]); exit(-9); } } weighted_edge_adjacency_marginal=calloc(nb_edge_adjacency,(sizeof(long double)+2*sizeof(int))); nb_edge_adjacency=0; for(i=0;i0.){ weighted_edge_adjacency_marginal[nb_edge_adjacency].marginal=edge_adjacency_marginal[i][j]; weighted_edge_adjacency_marginal[nb_edge_adjacency].edge1=i; weighted_edge_adjacency_marginal[nb_edge_adjacency].edge2=j; nb_edge_adjacency++; } edge_adjacency_ranking=calloc(nb_edge_adjacency,sizeof(int)); for(i=0;ii; j--){ if (weighted_edge_adjacency_marginal[j-1].marginal=B_SPACE-1)my_op = -1; // printf("%g %d %d %d\n",fr, v1,v2,my_op); if(my_op==0){add_to_b_list(v1,v2);np++;} if(my_op==-1){erase_from_b_list(v1,v2);nm++;} num_test++; if(num_test>=10000000){ print_b_list(); printf("np %d nm %d nt %d\n",np,nm,num_test); break; } } } /***********************************************************************/ void erase_from_b_list(MY_VERTEX v1, MY_VERTEX v2){ MY_VERTEX tvertex_to_erase, tv, tfirst, tlast; MY_VERTEX tv_x, tv_x1, tv_x2, tv_q; tfirst = tvertex_b_first_of_vertex[v1]; tlast = tvertex_b_last_of_vertex[v1]; /********************************************/ #ifdef MY_DEBUG if(v2==v1){ printf("abort v2 must be different from v1 in add_to_b_list\n"); exit(-9); } if((v1>=NUM_VERTICES) || (v2>=NUM_VERTICES)){ printf("v1 = %d OR v2 = %d too large in erase_from_b_list\n",v1,v2); exit(-9); } if((tlast==EMPTY_TVERTEX) || (tfirst==EMPTY_TVERTEX) || (num_b[v1]==0)){ #ifdef MY_TEST_RANDOM return; /* ============================================= */ #endif printf("abort empty vertex in erase_from_b_list v1 %d v2 %d f %d l %d\n", v1,v2,tlast,tfirst); exit(-9); } #endif /********************************************/ tvertex_to_erase = EMPTY_TVERTEX; for(tv=tfirst;;tv=tvertex_b_next_of_tvertex[tv]){ if(vertices_of_b_list[tv]==v2){tvertex_to_erase=tv; break;} if(tv==tlast){break;} } if(tvertex_to_erase == EMPTY_TVERTEX){ #ifdef MY_TEST_RANDOM return; /* ============================================= */ #endif printf("abort erase_from_b_list v %d to be removed not in list of %d\n", v2,v1); exit(-9); } /* now four different cases */ if( (tvertex_b_former_of_tvertex[tvertex_to_erase] != MY_FIRST) && (tvertex_b_next_of_tvertex[tvertex_to_erase] != MY_LAST) ){ /* x1 o x2 , E: q L ==> x1 x2 , E: q o L*/ tv_x1 = tvertex_b_former_of_tvertex[tvertex_to_erase]; tv_x2 = tvertex_b_next_of_tvertex[tvertex_to_erase]; tv_q = tvertex_b_last_of_empty; tvertex_b_next_of_tvertex[tv_x1] = tv_x2; tvertex_b_next_of_tvertex[tv_q] = tvertex_to_erase; tvertex_b_next_of_tvertex[tvertex_to_erase] = MY_LAST; tvertex_b_former_of_tvertex[tv_x2] = tv_x1; tvertex_b_former_of_tvertex[tvertex_to_erase] = tv_q; /* here in v1 we are not first, not last */ tvertex_b_last_of_empty = tvertex_to_erase; }else if( (tvertex_b_next_of_tvertex[tvertex_to_erase]== MY_LAST) && (tvertex_b_former_of_tvertex[tvertex_to_erase] != MY_FIRST) ){ /* x o L , E: q L ==> x L , E: q o L*/ tv_x = tvertex_b_former_of_tvertex[tvertex_to_erase]; tv_q = tvertex_b_last_of_empty; tvertex_b_next_of_tvertex[tv_x] = MY_LAST; tvertex_b_next_of_tvertex[tv_q] = tvertex_to_erase; tvertex_b_next_of_tvertex[tvertex_to_erase] = MY_LAST; tvertex_b_former_of_tvertex[tvertex_to_erase] = tv_q; /* here in v1 we are not last but not first*/ tvertex_b_last_of_empty = tvertex_to_erase; tvertex_b_last_of_vertex[v1] = tv_x; }else if( (tvertex_b_next_of_tvertex[tvertex_to_erase]!= MY_LAST) && (tvertex_b_former_of_tvertex[tvertex_to_erase] == MY_FIRST) ){ /* F o x , E: q L ==> F x , E: q o L*/ tv_x = tvertex_b_next_of_tvertex[tvertex_to_erase]; tv_q = tvertex_b_last_of_empty; tvertex_b_next_of_tvertex[tv_q] = tvertex_to_erase; tvertex_b_next_of_tvertex[tvertex_to_erase] = MY_LAST; tvertex_b_former_of_tvertex[tv_x] = MY_FIRST; tvertex_b_former_of_tvertex[tvertex_to_erase] = tv_q; /* here in v1 we are not first but not last*/ tvertex_b_last_of_empty = tvertex_to_erase; tvertex_b_first_of_vertex[v1] = tv_x; }else if( (tvertex_b_next_of_tvertex[tvertex_to_erase]== MY_LAST) && (tvertex_b_former_of_tvertex[tvertex_to_erase] == MY_FIRST) ){ /* F o L , E: q L ==> NOTHING , E: q o L*/ tv_q = tvertex_b_last_of_empty; tvertex_b_next_of_tvertex[tv_q] = tvertex_to_erase; tvertex_b_former_of_tvertex[tvertex_to_erase] = tv_q; /* here in v1 we are both first and last */ tvertex_b_last_of_empty = tvertex_to_erase; tvertex_b_first_of_vertex[v1] = EMPTY_TVERTEX; tvertex_b_last_of_vertex[v1] = EMPTY_TVERTEX; }else{ printf("abort erase_from_b_list unkown tvertex case\n"); exit(-9); } num_tot_b--; num_b[v1]--; num_b_empty++; vertices_of_b_list[tvertex_to_erase] = EMPTY_VERTEX; } /***********************************************************************/ void add_to_b_list(MY_VERTEX v1, MY_VERTEX v2){ MY_VERTEX tv, tfirst, tlast, tstore; tfirst = tvertex_b_first_of_vertex[v1]; tlast = tvertex_b_last_of_vertex[v1]; /********************************************/ #ifdef MY_DEBUG if(v2==v1){ printf("abort v2 must be different from v1 in add_to_b_list\n"); exit(-9); } if((v1>=NUM_VERTICES) || (v2>=NUM_VERTICES)){ printf("v1 OR v2 too large in add_to_b_list\n"); exit(-9); } if(tlast!=EMPTY_TVERTEX){ if(tfirst==EMPTY_TVERTEX){ printf("abort internal error 1A in add_to_b_list\n"); exit(-9); } } if(tfirst!=EMPTY_TVERTEX){ if(tlast==EMPTY_TVERTEX){ printf("abort internal error 1B in add_to_b_list\n"); exit(-9); } } if((num_b[v1]==0) && (tlast!=EMPTY_TVERTEX)){ printf("abort internal error 2 in add_b_to_list v1 %d num_b %d tlask %d\n", v1,num_b[v1],tlast); exit(-9); } #endif /********************************************/ if(tfirst!=EMPTY_TVERTEX){/*will check only if non-empty*/ for(tv=tfirst;;tv=tvertex_b_next_of_tvertex[tv]){ if(vertices_of_b_list[tv]==v2){ return; } if(tv==tlast)break; } } if(num_tot_b>=B_SPACE-1){ printf("not enough B_SPACE 1 __ %d %d %d\n",B_SPACE,num_tot_b,num_b_empty); exit(-9); } if(num_b_empty<2){ printf("not enough B_SPACE 2 __ %d %d %d\n",B_SPACE,num_tot_b,num_b_empty); exit(-9); } /* all that checked and done... */ tstore = tvertex_b_last_of_empty; if(tlast!=EMPTY_TVERTEX){ tvertex_b_next_of_tvertex[tlast] = tvertex_b_last_of_empty; } tvertex_b_next_of_tvertex [tvertex_b_former_of_tvertex [tvertex_b_last_of_empty]] = MY_LAST; tvertex_b_last_of_empty = tvertex_b_former_of_tvertex[tvertex_b_last_of_empty]; if(num_b[v1]>0){ tvertex_b_former_of_tvertex[tstore] = tvertex_b_last_of_vertex[v1]; } if(num_b[v1]==0){ tvertex_b_former_of_tvertex[tstore] = MY_FIRST; tvertex_b_first_of_vertex[v1] = tstore; } tvertex_b_last_of_vertex[v1] = tstore; vertices_of_b_list[tstore] = v2; num_tot_b++; num_b_empty--; num_b[v1]++; } /***********************************************************************/ void print_b_list(void){ long i, norm, norm2, norm3; MY_VERTEX tv; printf("\n# *** HERE THE B-LIST ***\n"); norm = 0; norm2 = 0; norm3 = 0; for(i=0; i0){ if(tvertex_b_former_of_tvertex[tvertex_b_first_of_vertex[i]]!=MY_FIRST){ printf("abort print_b former(first)!=FIRST v %ld tfirst %d former %d\n", i, tvertex_b_first_of_vertex[i], tvertex_b_former_of_tvertex[tvertex_b_first_of_vertex[i]]); exit(-9); } if(tvertex_b_next_of_tvertex[tvertex_b_last_of_vertex[i]]!=MY_LAST){ printf("abort in print_b former(last)!=LAST v %ld \n",i); exit(-9); } for(tv=tvertex_b_first_of_vertex[i];;tv=tvertex_b_next_of_tvertex[tv]){ norm2++; printf("# non empty FROM VERTEX %ld BOX %d TO VERTEX %d first %d last %d\n", i,tv,vertices_of_b_list[tv] ,tvertex_b_first_of_vertex[i], tvertex_b_last_of_vertex[i]); if(vertices_of_b_list[tv]==EMPTY_VERTEX){ printf("abort internal error in print_b_list EMPTY_VERTEX\n"); exit(-9); } if(tv==tvertex_b_last_of_vertex[i])break; } for(tv=tvertex_b_last_of_vertex[i];;tv=tvertex_b_former_of_tvertex[tv]){ norm3++; if(tv==tvertex_b_first_of_vertex[i])break; } } } norm+= num_b_empty; if(num_b_empty>0){ for(tv=tvertex_b_first_of_empty;;tv=tvertex_b_next_of_tvertex[tv]){ norm2++; printf("# empty BOX %d TO VERTEX %d first %d last %d\n",tv,vertices_of_b_list[tv],tvertex_b_first_of_empty,tvertex_b_last_of_empty); if(tv==tvertex_b_last_of_empty)break; } for(tv=tvertex_b_last_of_empty;;tv=tvertex_b_former_of_tvertex[tv]){ norm3++; if(tv==tvertex_b_first_of_empty)break; } } if(norm!=B_SPACE){ printf("abort norm != B_SPACE %ld %d\n",norm,B_SPACE); exit(-9); } if(norm2!=B_SPACE){ printf("abort norm2 != B_SPACE %ld %d\n",norm,B_SPACE); exit(-9); } if(norm3!=B_SPACE){ printf("abort norm3 != B_SPACE %ld %d\n",norm,B_SPACE); exit(-9); } } /***********************************************************************/ void init_b_list_to_empty(void){ long i; tvertex_b_first_of_empty = 0; tvertex_b_last_of_empty = B_SPACE-1; num_b_empty = B_SPACE; for(i=0; i=v_min) && (vertices_of_edge_list0[i][1]>=v_min)){ num_edges_now++; vertices_of_edge_list[j][0] = vertices_of_edge_list0[i][0]; vertices_of_edge_list[j][1] = vertices_of_edge_list0[i][1]; if(vertices_of_edge_list[j][0]>=max_vertex){ max_vertex = vertices_of_edge_list[j][0]; } j++; } } #ifdef MY_DEBUG printf(" ** DBG CHOPCHOP %d ** max_vertex %d \n", v_min, max_vertex); #endif for(i=num_edges_now;ii){ vertices_of_edge_list0[j][0]--; } if(vertices_of_edge_list0[j][1]>i){ vertices_of_edge_list0[j][1]--; } } NUM_VERTICES--; break; } } if(flag0 == 0){ for(j=i; jj){ startVertexConnection[k] --; } if(endVertexConnection[k]>j){ endVertexConnection[k] --; } } maxOccupied--; for(j=0; j<=maxOccupied; j++){ if((vertices_of_edge_list0[j][0]==mySecond) && (vertices_of_edge_list0[j][1]==i) ){ break; } } for(k=j; kj){ startVertexConnection[k] --; endVertexConnection[k] --; } } maxOccupied--; NUM_EDGES--; } if((flag0==1) && (flag1==1))break; } #ifdef WRITE_GRAPH #ifdef PRUNING for (i=0; i= NUM_EDGES_MAX){ printf("select vertices abort too large NUM_EDGES %ld NUM_EDGES_MAX %d\n", NUM_EDGES,NUM_EDGES_MAX); exit(-9); } if(NUM_VERTICES >= NUM_VERTICES_MAX){ printf("select vertices abort too large NUM_VERTICES %ld NUM_VERTICES_MAX %d\n", NUM_VERTICES,NUM_VERTICES_MAX); exit(-9); } for(i=0;ii; j--) { if (vertices_of_edge_list0[j-1][0]>vertices_of_edge_list0[j][0]) { temp_first=vertices_of_edge_list0[j-1][0]; vertices_of_edge_list0[j-1][0]=vertices_of_edge_list0[j][0]; vertices_of_edge_list0[j][0]=temp_first; temp_second=vertices_of_edge_list0[j-1][1]; vertices_of_edge_list0[j-1][1]=vertices_of_edge_list0[j][1]; vertices_of_edge_list0[j][1]=temp_second; } } } for(i=0; i<(NUM_EDGES-1); i++) { for (j=(NUM_EDGES-1); j>i; j--) { if ((vertices_of_edge_list0[j-1][0]==vertices_of_edge_list0[j][0]) && (vertices_of_edge_list0[j-1][1]>vertices_of_edge_list0[j][1])) { temp_second=vertices_of_edge_list0[j-1][1]; vertices_of_edge_list0[j-1][1]=vertices_of_edge_list0[j][1]; vertices_of_edge_list0[j][1]=temp_second; } } } } /***********************************************************************/ int check_and_set_vertices_of_edge_list(MY_VERTEX v_min){ long i, j; chop_vertices(v_min); for(i=0; i0){ tedge_first_of_vertex[vertices_of_edge_list[0][0]] = 0; tedge_last_of_vertex[max_vertex] = num_edges_now-1; } for(i=1; ivertices_of_edge_list[i-1][0]){ if((vertices_of_edge_list[i-1][0]>=NUM_EDGES) || (vertices_of_edge_list[i-1][0]>=NUM_EDGES)){ } tedge_last_of_vertex[vertices_of_edge_list[i-1][0]] = i-1; tedge_first_of_vertex[vertices_of_edge_list[i][0]] = i; } } #if ( (defined MY_DEBUG) || (defined MY_DEBUG2 ) ) for(i=0; itedge_first_of_vertex[i]){ for(j=tedge_first_of_vertex[i]+1; j<=tedge_last_of_vertex[i]; j++){ if(vertices_of_edge_list[j][0]==vertices_of_edge_list[j-1][0]){ if(vertices_of_edge_list[j][1]<=vertices_of_edge_list[j-1][1]){ printf("ABORT check_and_set_vertices_of_edge_list" " problem in [1] i %ld j %ld tf %d tl %d vj-1 %d vj %d\n", i, j, tedge_first_of_vertex[i], tedge_last_of_vertex[i], vertices_of_edge_list[j-1][1], vertices_of_edge_list[j][1]); printf("E_F %d E_L %d\n", tedge_first_of_vertex[i],tedge_last_of_vertex[i]); exit(-9); } } } } } return num_edges_now; }