8 #define THRESH 0.0000001
11 static char nodes
[NODES
][NLEN
]; /* vertex names */
14 /* find network protein */
15 static int id(char *s
)
18 for (i
= 0; i
< nnodes
; i
++)
19 if (!strcmp(nodes
[i
], s
))
24 /* find protein id; insert it if not there */
25 static int id_def(char *s
)
30 strcpy(nodes
[idx
], s
);
35 static void readnetwork(FILE *fin
)
37 char s1
[NLEN
], s2
[NLEN
];
39 while (fscanf(fin
, "%s %s %lf", s1
, s2
, &w
) == 3) {
45 static void queries(int sz
)
50 for (i
= 0; i
< sz
; i
++) {
52 idx
= rand() % nnodes
;
55 printf("\%s\t", nodes
[idx
]);
60 static void printhelp(void)
62 printf("usage: genrq -s size -n count\n\n");
64 printf("\t-s size \tthe number of proteins in each query\n");
65 printf("\t-n count \tthe number of queries to generate\n");
69 int main(int argc
, char *argv
[])
74 for (i
= 1; i
< argc
; i
++) {
75 if (argv
[i
][0] != '-' || argv
[i
][1] == 'h') {
79 if (argv
[i
][1] == 'n')
80 count
= atoi(argv
[i
][2] ? argv
[i
] + 2 : argv
[++i
]);
81 if (argv
[i
][1] == 's')
82 size
= atoi(argv
[i
][2] ? argv
[i
] + 2 : argv
[++i
]);
85 for (i
= 0; i
< count
; i
++)