int main(int argc, char **argv) { char *netF; FILE *infile=NULL; struct node_gra *net=NULL, *giant=NULL; /* Command line parameters */ if (argc < 2) { printf("\nUse: getgiant net_file\n\n"); return; } netF = argv[1]; /* Build the network */ infile = fopen(netF, "r"); net = FBuildNetwork(infile, 0, 0, 0, 1); fclose(infile); /* Get the giant component and print it */ giant = GetLargestWeaklyConnectedSet(net, 10000000); FPrintNetAdjacencyList(stdout, giant, 0, 1); /* Finish */ RemoveGraph(net); RemoveGraph(giant); return 0; }
int main() { struct node_gra *net1=NULL, *net2=NULL, *netSum=NULL; FILE *inFile; double C, L; int wrong; /* ------------------------------------------------------------ Build the networks ------------------------------------------------------------ */ inFile = fopen("test.dat", "r"); net1 = FBuildNetwork(inFile, 0, 0, 0, 1); fclose(inFile); inFile = fopen("test_betw.dat", "r"); net2 = FBuildNetwork(inFile, 0, 0, 0, 1); fclose(inFile); /* ------------------------------------------------------------ Sum the networks ------------------------------------------------------------ */ netSum = AddTwoNetworks(net1, net2); /* ------------------------------------------------------------ Verify the results and done ------------------------------------------------------------ */ C = ClusteringCoefficient(netSum); L = AverageInverseDistance(netSum); RemoveGraph(net1); RemoveGraph(net2); RemoveGraph(netSum); wrong = 0; if (fabs(C - 0.428571) > 1e-6) { wrong = 1; fprintf(stderr, "C: %lf != 0.428571 \tWRONG!\n", C); } else { fprintf(stderr, "C: %lf == 0.428571 \tOK!\n", C); } if (fabs(L - 0.448485) > 1e-6) { wrong = 1; fprintf(stderr, "L: %lf != 0.448485 \tWRONG!\n", L); } else { fprintf(stderr, "L: %lf == 0.448485 \tOK!\n", L); } if (wrong == 0) return 0; else return 1; }
int main() { /* ---------------------------------------------------------------- Build the network---only use giant component ---------------------------------------------------------------- */ FILE *infile=NULL; struct node_gra *total_net=NULL; struct node_gra *net=NULL; struct node_gra *listcomponents[100]; int numcomp; infile = fopen("test.dat", "r"); total_net = FBuildNetwork(infile, 0, 0, 0, 1); fclose(infile); net = GetLargestStronglyConnectedSet(total_net, 100000); printf("A\n"); numcomp = GetAllConnectedSets(total_net,listcomponents); printf("%i\n",numcomp); /* ---------------------------------------------------------------- Output results ---------------------------------------------------------------- */ FPrintPajekFile("total.net", total_net, 0, 0, 1); FPrintPajekFile("giant.net", net, 0, 0, 1); /* ---------------------------------------------------------------- Free memory ---------------------------------------------------------------- */ RemoveGraph(total_net); RemoveGraph(net); return 0; }
int main(int argc, char **argv) { char *netF; FILE *infile=NULL; struct node_gra *net=NULL; struct node_gra *p=NULL; /* --------------------------------------------------------------------------- Command line parameters --------------------------------------------------------------------------- */ if (argc < 2) { printf("\nUse: betweenness.out net_file\n\n"); return -1; } netF = argv[1]; /* --------------------------------------------------------------------------- Build the network --------------------------------------------------------------------------- */ infile = fopen(netF, "r"); net = FBuildNetwork(infile, 0, 0, 0, 1); fclose(infile); /* --------------------------------------------------------------------------- Calculate betweenness --------------------------------------------------------------------------- */ CalculateNodeBetweenness(net); /* --------------------------------------------------------------------------- Output results and finish --------------------------------------------------------------------------- */ p = net; while ((p = p->next) != NULL) printf("%s %d %g\n", p->label, NodeDegree(p), p->dvar1); RemoveGraph(net); return 0; }
int main(int argc, char **argv) { char *netF; FILE *infile=NULL; FILE *outfile=NULL; struct node_gra *net=NULL; gsl_rng *rand_gen; double **newA; struct node_gra *p1, *p2; long int seed; char outFileName[200]; /* --------------------------------------------------------------------------- Command line parameters --------------------------------------------------------------------------- */ if (argc < 2) { printf("\nUse: only_degeneration_mb net_file seed\n\n"); return; } netF = argv[1]; seed = atoi(argv[2]); rand_gen = gsl_rng_alloc(gsl_rng_mt19937); gsl_rng_set(rand_gen, seed); /* --------------------------------------------------------------------------- Build the network --------------------------------------------------------------------------- */ infile = fopen(netF, "r"); net = FBuildNetwork(infile, 0, 0, 0, 1); fclose(infile); /* --------------------------------------------------------------------------- Get link reliabilities --------------------------------------------------------------------------- */ newA = GibbsLinkScoreMB_OD(net, 0.0, 10000, rand_gen, 'q'); /* --------------------------------------------------------------------------- Output --------------------------------------------------------------------------- */ strcpy(outFileName, netF); strcat(outFileName, ".scores"); outfile = fopen(outFileName, "w"); p1 = net; while ((p1 = p1->next) != NULL) { p2 = p1; while ((p2 = p2->next) != NULL) { fprintf(outfile, "%g %s %s\n", newA[p1->num][p2->num], p1->label, p2->label); } } fclose(outfile); /* --------------------------------------------------------------------------- Finish --------------------------------------------------------------------------- */ RemoveGraph(net); gsl_rng_free(rand_gen); return 0; }
int main() { // ---------------------------------------------------------------- // Initialize the random number generator // ---------------------------------------------------------------- gsl_rng *rand_gen; rand_gen = gsl_rng_alloc(gsl_rng_mt19937); gsl_rng_set(rand_gen, seed); // ---------------------------------------------------------------- // Build the network---only use giant component // ---------------------------------------------------------------- struct node_gra *total_net = NULL; struct node_gra *net = NULL; FILE *infile; infile = fopen("test.dat", "r"); total_net = FBuildNetwork(infile, 0, 0, 0, 1); fclose(infile); net = GetLargestStronglyConnectedSet(total_net, 100000); // ---------------------------------------------------------------- // Initialize the coclassification matrix // ---------------------------------------------------------------- int i, j; int **coclas; int S = CountNodes(net); coclas = allocate_i_mat(S, S); for (i=0; i<S; i++) for (j=0; j<S; j++) coclas[i][j] = 0; // ---------------------------------------------------------------- // Find the modules rep times and calculate coclassification matrix // ---------------------------------------------------------------- struct group *part = NULL; struct node_gra *p1 = NULL; struct node_gra *p2 = NULL; for (i=0; i<rep; i++) { fprintf(stderr, "Repetition %d\n", i+1); part = SACommunityIdent(net, 0.0, -1.0, 0.0, 0.10, S, // #modules 'r', // r=random initial conf 1, // 0=No collective moves 'n', // n=no output rand_gen); // Update coclas matrix // -------------------------------------------------------------- p1 = net; while ((p1 = p1->next) != NULL) { p2 = net; while ((p2 = p2->next) != NULL) { if (p1->inGroup == p2->inGroup) coclas[p1->num][p2->num] += 1; } } // Remove the partition // -------------------------------------------------------------- RemovePartition(part); part = NULL; } // ---------------------------------------------------------------- // Output results // ---------------------------------------------------------------- p1 = net; while ((p1 = p1->next) != NULL) { p2 = net; while ((p2 = p2->next) != NULL) { fprintf(stdout, "%s %s -1 -1 -1 -1 %lf\n", p1->label, p2->label, (double)coclas[p1->num][p2->num] / (double)rep); } } // ---------------------------------------------------------------- // Free memory // ---------------------------------------------------------------- RemoveGraph(total_net); RemoveGraph(net); free_i_mat(coclas,S); gsl_rng_free(rand_gen); return 0; }
int main() { FILE *infile=NULL; struct node_gra *net = NULL; int repeat = 1; gsl_rng *randGen; /* ------------------------------------------------------------ Build the network ------------------------------------------------------------ */ infile = fopen("test_graph1.dat", "r"); net = FBuildNetwork(infile, 0, 0, 0, 1); fclose(infile); FPrintPajekFile("graph1.net", net, 0, 0, 1); /* -------------------------------------------------------------- Initialize the random number generator -------------------------------------------------------------- */ randGen = gsl_rng_alloc(gsl_rng_mt19937); gsl_rng_set(randGen, 3333); /* ------------------------------------------------------------ Network properties ------------------------------------------------------------ */ double dtemp; int itemp; printf("S = %d\n", CountNodes(net)); dtemp = ClusteringCoefficient(net); if (fabs(dtemp - 0.1875) > EPS) return 1; else printf("C = %g\tOK\n", dtemp); printf("A = %g\n", Assortativity(net)); dtemp = AverageInverseDistance(net); if (fabs(dtemp - 19. / 45.) > EPS) { printf("P = %g\tWRONG!!\n", dtemp); return 1; } else printf("P = %g\tOK\n", dtemp); struct node_gra *n1 = net->next; struct node_gra *n2 = n1->next; struct node_gra *n4 = n2->next->next; struct node_gra *n5 = n4->next; struct node_gra *n8 = n5->next->next->next; dtemp = JaccardIndex(n1, n2); if (fabs(dtemp - 0.25) > EPS) return 1; else printf("J[1][2] = %g\tOK\n", dtemp); dtemp = JaccardIndex(n2, n4); if (fabs(dtemp - 0.50) > EPS) return 1; else printf("J[2][4] = %g\tOK\n", dtemp); dtemp = JaccardIndex(n5, n8); if (fabs(dtemp - 0.50) > EPS) return 1; else printf("J[5][8] = %g\tOK\n", dtemp); if ((itemp = CommonNeighbors(n1, n2)) != 1) return 1; else printf("C[1][2] = %d\tOK\n", itemp); if ((itemp = CommonNeighbors(n2, n4)) != 1) return 1; else printf("C[2][4] = %d\tOK\n", itemp); if ((itemp = CommonNeighbors(n5, n8)) != 2) return 1; else printf("C[5][8] = %d\tOK\n", itemp); /* ------------------------------------------------------------ Partition ------------------------------------------------------------ */ struct group *part = NULL; part = SACommunityIdent(net, 2. / CountNodes(net), 0.0, 0.995, 2.0, 2, 'o', 1, 'n', randGen); MapPartToNet(part, net); printf("M = %g\n", Modularity(part)); RemovePartition(part); /* ------------------------------------------------------------ Free memory ------------------------------------------------------------ */ RemoveGraph(net); gsl_rng_free(randGen); return 0; }
int main(int argc, char **argv) { long seed = 1111; FILE *inFile,*outFile; struct node_gra *net = NULL; struct node_gra *netran = NULL; struct node_gra *p = NULL; int S; int c; struct group *part = NULL; struct group *roles = NULL; int i,t1; int rep = 0; double realmod; double ranmodav, ranmodst; double *ranmodlis; double Tsched = 0.995, Tf = 0.0; double iterfac = 1.0; gsl_rng *rand_gen; char *netF; /* ------------------------------------------------------------ Prompt for user-defined parameters ------------------------------------------------------------ */ printf ("%d\n",argc); if (argc == 1) { printf("\n# Enter random number seed (POSITIVE integer): "); scanf("%d", &seed); printf("\n# Enter the name of the network file: "); scanf("%s", &netF); printf("\n# Enter iteration factor (recommended 1.0): "); scanf("%lf", &iterfac); printf("\n# Enter the cooling factor (recommended 0.950-0.995): "); scanf("%lf", &Tsched); printf("\n# Enter the number of randomizations: "); scanf("%d", &rep); } else { while ((c = getopt(argc, argv, "hf:s:i:c:r:")) != -1) switch (c) { case 'h': printf(USAGE ARGUMENTS); return -1; break; case 'f': netF = optarg; break; case 's': seed = atoi(optarg); break; case 'r': rep = atoi(optarg); break; case 'i': iterfac = atof(optarg); break; case 'c': Tsched = atof(optarg); break; } } ranmodlis = allocate_d_vec(rep); /* ------------------------------------------------------------ Initialize the random number generator ------------------------------------------------------------ */ rand_gen = gsl_rng_alloc(gsl_rng_mt19937); gsl_rng_set(rand_gen, seed); /* ------------------------------------------------------------ Build the network ------------------------------------------------------------ */ fprintf(stderr, "\n# Creating the network\n"); inFile=fopen(netF,"r"); net = FBuildNetwork(inFile, 0, 0, 0, 1); fclose(inFile); S = CountNodes(net); fprintf(stderr, "\n# The network has %d nodes\n", S); /* ------------------------------------------------------------ Find and print the modules ------------------------------------------------------------ */ fprintf(stderr, "\n# Starting the simulated annealing\n"); fprintf(stderr, "\n# 1/T\tM\tT\n"); part = SACommunityIdent(net, 2.0 / (double)S, Tf, Tsched, iterfac, 0, 'o', 1, 's', rand_gen); outFile = fopen("modules.dat", "w"); FPrintPartition(outFile, part, 0); realmod = Modularity(part); fprintf(outFile, "# Modularity = %g\n", realmod); fclose(outFile); FPrintPajekFile("network.net", net, 0, 0, 1); FPrintPajekPartitionFile("modules.clu", net); /* ------------------------------------------------------------ Calculate and print node properties ------------------------------------------------------------ */ outFile=fopen("node_prop.dat","w"); p = net; while ((p = p->next) != NULL) { fprintf(outFile,"%s %d %lf %lf\n", p->label, NodeDegree(p), ParticipationCoefficient(p), WithinModuleRelativeDegree(p, part)); } fclose(outFile); /* ------------------------------------------------------------ Find and print the roles ------------------------------------------------------------ */ fprintf(stderr, "\n# Finding node roles\n"); roles = CatalogRoleIdent(net, part); outFile = fopen("roles.dat","w"); FPrintPartition(outFile, roles, 0); fclose(outFile); MapPartToNet(roles, net); FPrintPajekPartitionFile("roles.clu", net); /* ------------------------------------------------------------ Calculate properties for the randomized graph ------------------------------------------------------------ */ ranmodav = 0.0; for (i=0; i<rep; i++) { fprintf(stderr, "\nRandomization %d\n", i+1); RemovePartition(part); if ( netran != NULL) RemoveGraph(netran); netran = RandomizeSymmetricNetwork(CopyNetwork(net), 100, rand_gen); part = SACommunityIdent(netran, 2.0 / (double)S, Tf, Tsched, iterfac, 0, 'o', 1, 'n', rand_gen); ranmodlis[i] = Modularity(part); ranmodav += ranmodlis[i]; } /* Average and standard deviation */ ranmodav /= (double)rep; ranmodst = 0.0; for (i=0; i<rep; i++) { ranmodst += (ranmodlis[i] - ranmodav) * (ranmodlis[i] - ranmodav); } ranmodst = sqrt(ranmodst / (double)rep); outFile = fopen("randomized_mod.dat", "w"); fprintf(outFile, "# M\tMrand\tsimga_Mrand\n"); fprintf(outFile, "%lf %lf %lf\n", realmod, ranmodav, ranmodst); fclose(outFile); /* ------------------------------------------------------------ Free memory ------------------------------------------------------------ */ gsl_rng_free(rand_gen); free_d_vec(ranmodlis); RemovePartition(part); RemovePartition(roles); RemoveGraph(net); if (netran != NULL) RemoveGraph(netran); return 0; }
main(int argc, char **argv) { FILE *outF, *inF; int rgm; int seed = 1111; int to_file = 0; int from_file = 0; struct binet *binet = NULL; struct group *part = NULL; struct group *roles_part = NULL; struct node_gra *projected = NULL; gsl_rng *randGen; double degree_based = 0; double Ti, Tf; double Ts = 0.97; double fac = 1.0; double modularity = 0; char fn_array[256]; char fno_array[256]; char *file_name; char *file_name_out; int invert = 0; int weighted = 0; int output_type = 0; extern char *optarg; extern int optind; int c; /* ------------------------------------------------------------ Arguments parsing ------------------------------------------------------------ */ if (argc == 1) { from_file = 1; to_file = 1; file_name = fn_array; file_name_out = fno_array; printf("\n# Enter random number seed (POSITIVE integer): "); scanf("%d", &seed); printf("\n# Enter the name of the network file: "); scanf("%s", &fn_array); printf("\n# Enter the name of the output file: "); scanf("%s", &fno_array); printf("\n# Enter iteration factor (recommended 1.0): "); scanf("%lf", &fac); printf("\n# Enter the cooling factor (recommended 0.950-0.995): "); scanf("%lf", &Ts); printf("\n# Find modules from first column (0) or second column (1): "); scanf("%d", &invert); printf("\n# Use the weighted (0) or weighted (1) modularity. (Edge weight is extracted from the third column): "); scanf("%d", &weighted); printf("\n# Use the strength (0) or degree (1) based role metrics: "); scanf("%d", °ree_based); printf("\n# Choose between tabular output (0), module partition (1) or roles partition (2):"); scanf("%d", &output_type);} else{ while ((c = getopt(argc, argv, "hwprmdf:s:i:c:o:")) != -1) switch (c) { case 'h': printf("\nUsage: bipartmod_cl [-f file] [-o file] [-s seed] [-i iter] [-c cool] [-pwmrh]\n" "\nIf no arguments are provided, the program will fallback in interactive mode.\n\n" "\t -f file: Name of the input network file (default: standard input)\n" "\t -o file: Name of the output file (default: standard output)\n" "\t -s seed: Random number seed (POSITIVE Integer, default 1111) \n" "\t -i iter: Iteration factor (recommended 1.0, default 1.0)\n" "\t -c cool: Cooling factor (recommended 0.950-0.995, default 0.97)\n " "\t -p : Find modules for the second column (default: first) \n" "\t -w : Read edge weights from the input's third column and uses the weighted modularity.\n" "\t -d : Use degree based role metrics (default: strength based metrics)" "\t -r : Output the roles partition rather than the default tabular output.\n" "\t -m : Output the modules partition rather than the default tabular output. \n" "\t -h : Display this message\n"); return -1; break; case 'f': from_file = 1; file_name = optarg; //printf("input set to %s \n", file_name); break; case 's': seed = atoi(optarg); //printf("seed set to %d \n", seed); break; case 'i': fac = atof(optarg); //printf("iteration factor set to %f \n", fac); break; case 'c': Ts = atof(optarg); //printf("cooling factor set to %f. \n", Ts); break; case 'p': invert = 1; //printf("Looking at second column.\n"); break; case 'm': output_type = 1; break; case 'r': output_type = 2; break; case 'o': to_file = 1; file_name_out = optarg; break; case 'w': weighted = 1; break; case 'd': degree_based = 1; break; } } /* ------------------------------------------------------------------ Initialize the random number generator ------------------------------------------------------------------ */ randGen = gsl_rng_alloc(gsl_rng_mt19937); gsl_rng_set(randGen, seed); /* ------------------------------------------------------------------ Build the network ------------------------------------------------------------------ */ if (from_file == 1) { inF = fopen(file_name, "r"); if (inF == NULL) { printf("ERROR: No such file or directory (%s). \n", file_name); return(1); } binet = FBuildNetworkBipart(inF, weighted, 0); fclose(inF); } else binet = FBuildNetworkBipart(stdin, weighted, 0); if (invert == 1) InvertBipart(binet); /* ------------------------------------------------------------------ Find the modules using the bipartite network ------------------------------------------------------------------ */ Ti = 1. / (double)CountNodes(binet->net1); Tf = 0.; if (weighted == 1){ part = SACommunityIdentBipartWeighted(binet, Ti, Tf, Ts, fac, 0, 'o', 1, 'm', randGen); } else{ part = SACommunityIdentBipart(binet, Ti, Tf, Ts, fac, 0, 'o', 1, 'm', randGen); } // Compute the role partition if we have to. // Note that the roles are computed (but not as a partition) // if the tabular output is selected (output_type==0). if (output_type == 2){ projected = ProjectBipart(binet); if (degree_based==1) part = CatalogRoleIdent(projected,part); else part = CatalogRoleIdentStrength(projected,part); } /* ------------------------------------------------------------ Output ------------------------------------------------------------ */ if (to_file == 1) { outF = fopen(file_name_out, "w"); if (outF == NULL) { printf("ERROR: Cannot write output (%s). \n", file_name_out); return(1); } if (output_type != 0){ // Partition-type output (a la Netcarto). FPrintPartition(outF, part, 0); modularity = Modularity(part); fprintf(outF, "# Modularity = %g\n", modularity); } else // Tabular output. FPrintTabNodesBipart(outF, binet, part, degree_based); fclose(outF); } else{ if (output_type != 0){ FPrintPartition(stdout, part, 0); modularity = Modularity(part); fprintf(stdout, "# Modularity = %g\n", modularity); } else FPrintTabNodesBipart(stdout, binet, part, degree_based); } // Free memory RemovePartition(part); RemoveBipart(binet); if (output_type == 2) RemoveGraph(projected); gsl_rng_free(randGen); }
/* ********************************************************************************************************* * RECEIVETASK ********************************************************************************************************* */ void ReceiveTask(void *pdata) { INT8U err; INT8U pos_x = 0, pos_y = 0; INT8U font_color; char *str_receiv; INT16U recev; float result; char avg[10]; char attention[2]; INT16U i = 0; ///used for row control char str_print[10]; INT16U number = 0; //used for calculating averages in receiving data. FILE* fp; char filename[25]; INT16U data_iter = 0; //data_iter/10 is the row and data_iter%10 is the col static INT16U times[10]; //used for count the times received static INT16U data[10]; //used for record all the data. static INT16U max[10]; static INT16U min[10]; static INT16U sumr[10]; pdata = pdata; memset(min,1000,sizeof(min)); //initialize the min array for (;;) { GetDate(filename); strcat(filename,"Rv.dat"); fp = fopen(filename, "a"); str_receiv = OSQPend(MSGQ,20,&err); //request message pos_x = i; i ++; i %= 10; if (pos_y/10 == 7) { pos_y = 0; PC_DispClrScr(DISP_FGND_BLACK + DISP_BGND_LIGHT_GRAY); TaskStartDispInit(); } PC_DispStr(5+6*pos_x, 10 + pos_y/10, str_receiv, DISP_FGND_BLACK + DISP_BGND_LIGHT_GRAY); fprintf(fp, "%s", str_receiv); recev = atoi(str_receiv); if (data_iter == 70) { data_iter = 0; } data[data_iter%10] = recev; PntIntNum((++ times[data_iter%10]),5+6*pos_x, 17); if (times[9] == 100) { TaskSuspend(); } max[data_iter%10] = (max[data_iter%10] < recev) ? recev : max[data_iter%10]; PntIntNum(max[data_iter%10],5+6*pos_x, 18); min[data_iter%10] = (min[data_iter%10] > recev) ? recev : min[data_iter%10]; PntIntNum(min[data_iter%10],5+6*pos_x, 19); sumr[data_iter%10] += recev; PntFltNum((float)sumr[data_iter%10]/(float)times[data_iter%10],5+6*pos_x,20); DrawGraph(sumr[data_iter%10]/times[data_iter%10], pos_x); data_iter ++; number += recev; result = (float)number/10.0; sprintf(avg,"%6.2f",result); attention[0] = Classify((unsigned int)result); attention[1] = 0; //the string ending strcat(avg,attention); font_color = 0x00 + ((*attention) - 'A'); PC_DispStr(68, 10 + pos_y/10, avg, font_color + DISP_BGND_LIGHT_GRAY); if (pos_y%10 == 9) { fprintf(fp, "%8s\n%6s",avg," "); memset(avg,0,sizeof(avg)); number = 0; RemoveGraph(); } OSTimeDlyHMSM(0, 0, 0, 100); pos_y ++; fclose(fp); } }
int main(int argc, char **argv) { long seed; char *netF; int method; FILE *inFile; struct node_gra *net = NULL; gsl_rng *rand_gen; int S, L; int nsteps; double step, damp; /* --------------------------------------------------------------------------- Command line parameters --------------------------------------------------------------------------- */ if (argc < 7) { printf("\nUse: netlayout.out net_file_name seed step(-1) nsteps damping(-1) 1(2d)/2(2dp)/3(3d)\n\n"); return -1; } netF = argv[1]; seed = atoi(argv[2]); step = atof(argv[3]); if (step < 0.0 ) step = 0.05; // Default step nsteps = atoi(argv[4]); damp = atof(argv[5]); if (damp < 0.0 ) damp = 0.05; // Default damping method = atoi(argv[6]); /* --------------------------------------------------------------------------- Initialize the random number generator --------------------------------------------------------------------------- */ rand_gen = gsl_rng_alloc(gsl_rng_mt19937); gsl_rng_set(rand_gen, seed); /* --------------------------------------------------------------------------- Build the network --------------------------------------------------------------------------- */ inFile=fopen(netF, "r"); net = FBuildNetwork(inFile, 0, 0, 0, 1); fclose(inFile); S = CountNodes(net); L = TotalNLinks(net, 1); /* --------------------------------------------------------------------------- Layout the graph --------------------------------------------------------------------------- */ if (method == 3) { MDGraphLayout3D(net, damp, step, nsteps, rand_gen, 0); } else if (method == 2) { MDGraphLayout2Dp(net, damp, step, nsteps, rand_gen, 0); } else { MDGraphLayout(net, damp, step, nsteps, rand_gen, 0); } /* --------------------------------------------------------------------------- Output coordinates --------------------------------------------------------------------------- */ PrintNodeCoordinates(stdout, net); /* --------------------------------------------------------------------------- Free memory --------------------------------------------------------------------------- */ RemoveGraph(net); gsl_rng_free(rand_gen); return 0; }