void CalcDistHeAtoms(void) { int i,j; double coor[3]; for (i = 0; i < NCLUSTERS; i++) { for (j = 0; j < 3; j++) coor[j] = clusCOM[i][j]; DistFromLineEdge(i, coor); FindMinDistance(i); } fclose(heliuminput); }
int main(){ int n; printf("\nEnter the number of nodes in graph : "); scanf("%d",&n); GNode* graph=CreateGraph(n); int i,source,dest,weight; int E; int* inOrder=(int*)malloc(sizeof(int)*n); for(i=0;i<n;i++){ inOrder[i]=0; } printf("\nenter the num of edges : "); scanf("%d",&E); for(i=0;i<E;i++){ printf("\nEnter source destionation and weight..."); scanf("%d %d %d",&source,&dest,&weight); AddVertex(graph,source,dest,weight); inOrder[dest]++; } printf("\nPress enter to traverse adjacency List\n"); getch(); TraverseAdjList(graph); getch(); int sourceNode; printf("\nenter source node : "); scanf("%d",&sourceNode); int* distance=(int*)malloc(sizeof(int)*n); for(i=0;i<n;i++){ distance[i]=INT_MAX; } FindMinDistance(graph,distance,sourceNode); printf("\nMin distance array \n"); getch(); for(i=0;i<n;i++){ printf("%d ",distance[i]); } return 0; }