annotate louvain/main_random.cpp @ 0:1d1b9e1b2e2f draft

Uploaded
author petr-novak
date Thu, 19 Dec 2019 10:24:45 -0500
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
1d1b9e1b2e2f Uploaded
petr-novak
parents:
diff changeset
1 using namespace std;
1d1b9e1b2e2f Uploaded
petr-novak
parents:
diff changeset
2
1d1b9e1b2e2f Uploaded
petr-novak
parents:
diff changeset
3 char *outfile = NULL;
1d1b9e1b2e2f Uploaded
petr-novak
parents:
diff changeset
4
1d1b9e1b2e2f Uploaded
petr-novak
parents:
diff changeset
5 int
1d1b9e1b2e2f Uploaded
petr-novak
parents:
diff changeset
6 main(int argc, char **argv) {
1d1b9e1b2e2f Uploaded
petr-novak
parents:
diff changeset
7 srand(time(NULL)+getpid());
1d1b9e1b2e2f Uploaded
petr-novak
parents:
diff changeset
8
1d1b9e1b2e2f Uploaded
petr-novak
parents:
diff changeset
9 int n = atoi(argv[1]);
1d1b9e1b2e2f Uploaded
petr-novak
parents:
diff changeset
10 int degree = atoi(argv[2]);
1d1b9e1b2e2f Uploaded
petr-novak
parents:
diff changeset
11
1d1b9e1b2e2f Uploaded
petr-novak
parents:
diff changeset
12 for (unsigned int i=0 ; i<n ; i++) {
1d1b9e1b2e2f Uploaded
petr-novak
parents:
diff changeset
13 for (unsigned int j=0 ; j<n ; j++) {
1d1b9e1b2e2f Uploaded
petr-novak
parents:
diff changeset
14 int r = rand()%n;
1d1b9e1b2e2f Uploaded
petr-novak
parents:
diff changeset
15 if (r<degree)
1d1b9e1b2e2f Uploaded
petr-novak
parents:
diff changeset
16 cout << i << " " << j << endl;
1d1b9e1b2e2f Uploaded
petr-novak
parents:
diff changeset
17 }
1d1b9e1b2e2f Uploaded
petr-novak
parents:
diff changeset
18 }
1d1b9e1b2e2f Uploaded
petr-novak
parents:
diff changeset
19 }