simplified graphs
This commit is contained in:
@@ -289,6 +289,7 @@ void prepare_graph(semisimple_type_t type, node_t *graph, edgelist_t **edgelists
|
||||
typedef struct {
|
||||
int rank;
|
||||
int order;
|
||||
int size; // the size of the graph; this can vary from the order if we take quotients beforehand
|
||||
const node_t *graph;
|
||||
int printstep;
|
||||
const char *alphabet;
|
||||
@@ -307,7 +308,7 @@ static int transitive_closure(const enumeration_info_t *info, signed char *level
|
||||
level[info->graph[head].opposite] = -current_level;
|
||||
queue_put(&queue, head);
|
||||
|
||||
for(int i = head + 1; level[i] != HEAD_MARKER && i < info->order; i++) { // everything which is right to the head and empty will not get marked in this or higher levels, so we can mark its opposite
|
||||
for(int i = head + 1; level[i] != HEAD_MARKER && i < info->size; i++) { // everything which is right to the head and empty will not get marked in this or higher levels, so we can mark its opposite
|
||||
if(level[i] == current_level) {
|
||||
is_slim = 0;
|
||||
break;
|
||||
@@ -342,11 +343,11 @@ static inline void output_thickening(const enumeration_info_t *info, signed char
|
||||
{
|
||||
// if printstep is set accordingly, write state to stderr
|
||||
if(is_slim && is_fat && info->printstep > 0 && (count + 1) % info->printstep == 0) {
|
||||
print_thickening(info->rank, info->order, level, current_level, info->alphabet, stderr);
|
||||
print_thickening(info->rank, info->size, level, current_level, info->alphabet, stderr);
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
else if(info->printstep < 0) {
|
||||
print_thickening(info->rank, info->order, level, current_level - !is_slim, info->alphabet, stderr);
|
||||
print_thickening(info->rank, info->size, level, current_level - !is_slim, info->alphabet, stderr);
|
||||
fprintf(stderr, " ");
|
||||
if(is_slim) {
|
||||
fprintf(stderr, "S");
|
||||
@@ -378,7 +379,7 @@ static long enumerate_tree(const enumeration_info_t *info, signed char *level, i
|
||||
|
||||
if(is_fat) {
|
||||
count++;
|
||||
fwrite(level, sizeof(signed char), info->order, info->outfile);
|
||||
fwrite(level, sizeof(signed char), info->size, info->outfile);
|
||||
} else {
|
||||
for(int i = head - 1; i >= 0; i--)
|
||||
if(level[i] == 0)
|
||||
@@ -388,14 +389,14 @@ static long enumerate_tree(const enumeration_info_t *info, signed char *level, i
|
||||
|
||||
// clean up
|
||||
level[head] = 0;
|
||||
for(int i = 0; i < info->order; i++)
|
||||
for(int i = 0; i < info->size; i++)
|
||||
if(level[i] >= current_level && level[i] != HEAD_MARKER || level[i] <= -current_level)
|
||||
level[i] = 0;
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
long enumerate_balanced_thickenings(semisimple_type_t type, node_t *graph, const char *alphabet, FILE *outfile)
|
||||
long enumerate_balanced_thickenings(semisimple_type_t type, node_t *graph, int size, const char *alphabet, FILE *outfile)
|
||||
{
|
||||
// int rank, order;
|
||||
signed char *level;
|
||||
@@ -406,6 +407,7 @@ long enumerate_balanced_thickenings(semisimple_type_t type, node_t *graph, const
|
||||
|
||||
info.rank = coxeter_rank(type);
|
||||
info.order = coxeter_order(type);
|
||||
info.size = size;
|
||||
info.graph = graph;
|
||||
info.alphabet = (char*)alphabet;
|
||||
info.outfile = outfile;
|
||||
@@ -414,10 +416,16 @@ long enumerate_balanced_thickenings(semisimple_type_t type, node_t *graph, const
|
||||
if(getenv("PRINTSTEP"))
|
||||
info.printstep = atoi(getenv("PRINTSTEP"));
|
||||
|
||||
level = (signed char*)malloc(info.order*sizeof(int));
|
||||
memset(level, 0, info.order*sizeof(int));
|
||||
// the algorithm only works if the opposition pairing does not stabilize any element
|
||||
// if this happens, there can be no balanced thickenings
|
||||
for(int i = 0; i < info.size; i++)
|
||||
if(graph[i].opposite == i)
|
||||
return 0;
|
||||
|
||||
for(int i = info.order - 1; i >= 0; i--)
|
||||
level = (signed char*)malloc(info.size*sizeof(int));
|
||||
memset(level, 0, info.size*sizeof(int));
|
||||
|
||||
for(int i = info.size - 1; i >= 0; i--)
|
||||
count += enumerate_tree(&info, level, 1, i);
|
||||
|
||||
free(level);
|
||||
|
||||
Reference in New Issue
Block a user