diff --git a/statgen/Makefile b/statgen/Makefile index 03d56af..5536912 100644 --- a/statgen/Makefile +++ b/statgen/Makefile @@ -3,7 +3,7 @@ PROJECT=STATGEN CC=gcc CFLAGS=-c -Wall -fPIC LDFLAGS=-lm -SOURCES=main.c coords.c int2str.c messages.c stat_print.c stat_select.c stat_sort.c summary_stat.c +SOURCES=main.c coords.c graph.c int2str.c messages.c stat_print.c stat_select.c stat_sort.c summary_stat.c OBJECTS=$(SOURCES:.c=.o) EXECUTABLE=statgen diff --git a/statgen/graph.c b/statgen/graph.c new file mode 100644 index 0000000..a582b8a --- /dev/null +++ b/statgen/graph.c @@ -0,0 +1,144 @@ +/* Library for graph structure analyze + * Usage: + * graph_analyze (N, connect, max_depth) + */ + +#include +#include +#include + + +int check_cycle (const int N, const int *matrix) +// function to return number of cycles +{ + int cycle, i, j; +/* cycle - number of cycle + */ + + cycle = 0; + for (i=0; i N) + depth = N; + else + depth = max_depth; + n_cycle = (int *) malloc ((max_depth-2) * sizeof (int)); + + tail = check_tail (N, matrix); + cycle = check_cycle (N, matrix); + if (cycle > 0) + for (i=0; i +// prototype +int graph_analyze (const int, const int *, const int, char *); + + int printing_agl (const char *input, const char *output, const int *connect, const int num_mol, const int *true_label_mol, const int *num_mol_agl, const int *agl, const int *stat, int *type_agl) @@ -24,10 +28,10 @@ int printing_agl (const char *input, const char *output, const int *connect, * type_agl - massive of numbers of aglomerate types */ { - int i, iso, j, k, p, type, *label_matrix, **matrix; + char iso[256]; + int i, j, k, *label_matrix, *matrix; FILE *f_out; /* iso - isomorphic graph in database - * type - number of cycle in aglomerates * label_matrix - massive of indexes of molecule * matrix - connectivity graph * f_out - output file @@ -47,13 +51,10 @@ int printing_agl (const char *input, const char *output, const int *connect, if (num_mol_agl[i] > 0) { // creating connectivity graph - matrix = (int **) malloc (num_mol_agl[i] * sizeof (int *)); + matrix = (int *) malloc (num_mol_agl[i] * num_mol_agl[i] * sizeof (int)); for (j=0; j