Go to the documentation of this file.
55 "Usage: rw [options] <graph-file> <out-file>",
57 " Required parameters",
59 " The name of the file storing the transactions. The file is in ",
60 " Metis' graph format.",
62 " Optional parameters",
64 " Specifies the maximum number of iterations. [default: 100]",
67 " Specifies the follow-the-adjacent-links probability. [default: 0.80]",
70 " Specifies the error tollerance. [default: 1e-10]",
73 " Specifies the source of the personalized PR. [default: -1]",
76 " Specifies the number of test-vectors to compute. [default: -1]",
79 " Prints this message.",
85 " Usage: rw [options] <graph-file> <out-file>",
86 " use 'rw -help' for a summary of the options.",
103 int main(
int argc,
char *argv[])
125 prs = gk_fAllocMatrix(
params->ntvs,
mat->nrows, 0.0,
"main: prs");
129 for (
i=0;
i<
mat->nrows;
i++)
131 gk_fscale(
mat->nrows, 1.0/gk_fsum(
mat->nrows, prs[
j], 1), prs[
j], 1);
134 printf(
"tvs#: %zd; niters: %zd\n",
j, niter);
139 for (
i=0;
i<
mat->nrows;
i++) {
141 fprintf(fpout,
"%.4e ", prs[
j][
i]);
142 fprintf(fpout,
"\n");
146 gk_fFreeMatrix(&prs,
params->ntvs,
mat->nrows);
148 else if (
params->ppr != -1) {
152 pr = gk_fsmalloc(
mat->nrows, 0.0,
"main: pr");
157 printf(
"ppr: %d; niters: %zd\n",
params->ppr, niter);
161 for (
i=0;
i<
mat->nrows;
i++)
162 fprintf(fpout,
"%.4e\n", pr[
i]);
173 pr = gk_fsmalloc(
mat->nrows, 1.0/
mat->nrows,
"main: pr");
176 printf(
"pr; niters: %zd\n", niter);
180 for (
i=0;
i<
mat->nrows;
i++) {
181 for (jmax=
i, maxdiff=0.0,
j=
mat->rowptr[
i]; j<mat->rowptr[
i+1];
j++) {
182 if ((diff =
fabs(pr[
i]-pr[
mat->rowind[
j]])) > maxdiff) {
184 jmax =
mat->rowind[
j];
187 fprintf(fpout,
"%.4e %10zd %.4e %10d\n", pr[
i],
188 mat->rowptr[
i+1]-
mat->rowptr[
i], maxdiff, jmax+1);
208 printf(
"*******************************************************************************\n");
210 printf(
"Matrix Information ---------------------------------------------------------\n");
211 printf(
" input file=%s, [%d, %d, %zd]\n",
215 printf(
"Options --------------------------------------------------------------------\n");
216 printf(
" niter=%d, ntvs=%d, ppr=%d, lamda=%f, eps=%e\n",
220 printf(
"Performing random walks... ----------------------------------------------\n");
230 printf(
"Memory Usage Information -----------------------------------------------------\n");
233 printf(
"********************************************************************************\n");
284 printf(
"Illegal command-line option(s)\nUse %s -help for a summary of the options.\n", argv[0]);
290 printf(
"Unrecognized parameters.");
303 errexit(
"Only one of the -ppr and -ntvs options can be specified.\n");
char * gk_optarg
For communication arguments to the caller.
int gk_rw_PageRank(gk_csr_t *mat, float lamda, float eps, int max_niter, float *pr)
gk_csr_t * gk_csr_Read(char *filename, int format, int readvals, int numbering)
char * gk_strdup(char *orgstr)
Duplicates a string.
Array< double, 1, 3 > e(1./3., 0.5, 2.)
void gk_free(void **ptr1,...)
int main(int argc, char *argv[])
static char shorthelpstr[][100]
void errexit(char *f_str,...)
FILE * gk_fopen(char *, char *, const char *)
static const SmartProjectionParams params
The structure that stores the information about the command-line options.
int gk_optind
Index in ARGV of the next element to be scanned.
params_t * parse_cmdline(int argc, char *argv[])
void gk_csr_Free(gk_csr_t **mat)
size_t gk_GetMaxMemoryUsed()
static char helpstr[][100]
int gk_fexists(char *fname)
void print_final_info(params_t *params)
void print_init_info(params_t *params, gk_csr_t *mat)
int gk_getopt_long_only(int argc, char **argv, char *options, struct gk_option *long_options, int *opt_index)
Parse command-line arguments with only long options.
size_t gk_GetCurMemoryUsed()
void * gk_malloc(size_t nbytes, char *msg)
static struct gk_option long_options[]
gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:04:01