forked from waynebhayes/BLANT
-
Notifications
You must be signed in to change notification settings - Fork 0
/
make-subcanon-maps.c
65 lines (56 loc) · 1.74 KB
/
make-subcanon-maps.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include <stdio.h>
#include <sys/file.h>
#include <sys/mman.h>
#include <unistd.h>
#include "misc.h"
#include "tinygraph.h"
#include "blant.h"
// Here we are allocating 256MB x sizeof(short int) = 512MB for the canon map.
//static short int K[maxBk] __attribute__ ((aligned (8192)));
static short int *K; // Allocating space dynamically
static int canon_list[MAX_CANONICALS];
int main(int argc, char* argv[]) {
int i, j, k;
k=atoi(argv[1]);
TINY_GRAPH* G = TinyGraphAlloc(k);
//Create k canon list
char BUF[BUFSIZ];
int numCanon = canonListPopulate(BUF, canon_list, NULL, k);
//Create canon map for k-1
K = mapCanonMap(BUF, K, k-1);
/*
For every canonical in canonical_list
create tinygraph
print canonical
For every induced subgraph of size k-1
get canonical from k-1
print decimal for canonical
print newline
*/
TINY_GRAPH *g = NULL;
TSET induceTSET = TSET_NULLSET;
int Gint = 0;
int tsetBit;
for (i = 0; i < numCanon; i++) {
int canonical = canon_list[i];
BuildGraph(G, canonical);
printf("%d ", canonical);
//Reset induceTSET
for (j = 0; j < k; j++) {
induceTSET = TSET_NULLSET;
for (tsetBit = 0; tsetBit < k; tsetBit++) {
induceTSET <<= 1;
if (tsetBit != j)
induceTSET |= 1;
}
g = TinyGraphInduced(g, G, induceTSET);
Gint = TinyGraph2Int(g, k-1);
printf("%d ", K[Gint]);
}
printf("\n");
}
assert(g && G);
TinyGraphFree(g);
TinyGraphFree(G);
return 0;
}