#include #include "thickenings.h" #include "queue.h" int main(int argc, const char *argv[]) { semisimple_type_t type; node_t *graph; int *leftbuf, *rightbuf; edgelist_t *edgelists; int *words; int rank, order; int *reduced, *group; int current; queue_t queue; char alphabet[] = "abcdefghijklmnopqrstuvwxyz"; char buffer[1024]; int left = ~0x01; // 1111 1110 int right = ~0x01; // 1111 1101 type.n = 1; type.factors = (simple_type_t*)malloc(type.n*sizeof(simple_type_t)); type.factors[0].series = 'B'; type.factors[0].rank = 4; rank = coxeter_rank(type); order = coxeter_order(type); graph = (node_t*)malloc(order*sizeof(node_t)); leftbuf = (int*)malloc(rank*order*sizeof(int)); rightbuf = (int*)malloc(rank*order*sizeof(int)); for(int i = 0; i < order; i++) { graph[i].left = &leftbuf[i*rank]; graph[i].right = &rightbuf[i*rank]; } prepare_graph(type, graph, &edgelists, &words); reduced = (int*)malloc(order*sizeof(int)); group = (int*)malloc(order*sizeof(int)); for(int i = 0; i < order; i++) { group[i] = -1; reduced[i] = i; } // step 1: group for(int i = 0; i < order; i++) { if(group[i] != -1) continue; queue_init(&queue); queue_put(&queue, i); while((current = queue_get(&queue)) != -1) { if(group[current] != -1) continue; group[current] = i; for(int j = 0; j < rank; j++) { if(left & (1 << j)) queue_put(&queue, graph[current].left[j]); if(right & (1 << j)) queue_put(&queue, graph[current].right[j]); } } } // step 2: find minimum for(int i = 0; i < order; i++) if(graph[i].wordlength < graph[reduced[group[i]]].wordlength) reduced[group[i]] = i; // step 3: assign minimum to all for(int i = 0; i < order; i++) reduced[i] = reduced[group[i]]; for(int i = 0; i < order; i++) if(reduced[i] == i) { if(i == 0) printf("1 "); else printf("%s ", alphabetize(graph[i].word, graph[i].wordlength, alphabet, buffer)); } printf("\n"); free(type.factors); free(graph); free(edgelists); free(words); free(reduced); free(group); free(leftbuf); free(rightbuf); return 0; }