19namespace layer1_foundations {
20namespace graph_theory {
81 f_has_print_current_choice_function =
FALSE;
82 call_back_print_current_choice = NULL;
83 print_current_choice_data = NULL;
146 for (i = 0; i <
n; i++) {
159 std::string &label,
int n,
160 int f_has_adj_list,
int *adj_list_coded,
182 cout <<
"clique_finder::init " <<
label <<
" n=" <<
n
190 cout <<
"clique_finder::init before delinearize_adjacency_list" << endl;
194 cout <<
"clique_finder::init before after delinearize_adjacency_list" << endl;
201 cout <<
"clique_finder::init pt_list allocated" << endl;
205 cout <<
"clique_finder::init pt_list_inv allocated" << endl;
223 for (i = 0; i <
n; i++) {
233 cout <<
"clique_finder::init finished" << endl;
244 cout <<
"clique_finder::init_restrictions" << endl;
247 if (restrictions[h * 3] == -1) {
250 i = restrictions[h * 3 + 0];
251 r = restrictions[h * 3 + 1];
252 m = restrictions[h * 3 + 2];
254 cout <<
"clique_finder::init_restrictions "
255 "i >= target_size" << endl;
261 cout <<
"clique_finder::init_restrictions level "
262 << i <<
" congruent " << r <<
" mod " << m << endl;
265 cout <<
"clique_finder::init_restrictions done" << endl;
278 int *point_list_ordered;
281 point_list_ordered =
NEW_int(nb);
282 for (i = 0; i < nb; i++) {
283 point_list_ordered[i] = point_list[i];
287 for (i = 0; i <
n; i++) {
290 for (i = 0; i <
n; i++) {
306 int nb_old, i, nb_new;
307 int pt1, pt2, pt, pass, f_go;
308 unsigned long int counter_save;
309 int my_verbose_level;
317 if ((
counter & ((1 << 23) - 1)) == 0) {
318 my_verbose_level = 1;
323 int f_v = (my_verbose_level >= 1);
324 int f_vv = (my_verbose_level >= 2);
328 cout <<
"clique_finder::backtrack_search : ";
330 cout <<
" nb_sol=" <<
solutions.size() <<
" starting" << endl;
339 cout <<
"clique_finder::backtrack_search "
340 "depth == target_depth" << endl;
347 for (j = 0; j < depth; j++) {
383 if (f_v || (
counter % print_interval) == 0) {
390 cout <<
" : # active points from previous level is "
411 cout <<
"clique_finder::backtrack_search : ";
413 cout <<
" first pass" << endl;
425 for (i = 0; i < nb_old; i++) {
445 for (i = 0; i < nb_old; i++) {
468 cout <<
" : pass 2: ";
481 for (i = 0; i < nb_old; i++) {
483 if (d >= target_depth - depth - 1) {
491 cout <<
" : pass " << pass
493 <<
" eliminated, d=" << d
494 <<
" is less than target_depth - depth - 1 = "
495 << target_depth - depth - 1 << endl;;
496 degree_of_point_verbose(i, nb_old);
504 cout <<
" : pass " << pass <<
": ";
509 }
while (nb_new < nb_old);
518 cout <<
"after " << pass <<
" passes: nb_points = "
526 cout <<
" before call_back_after_reduction" << endl;
528 (*call_back_after_reduction)(
this, depth,
532 cout <<
" after call_back_after_reduction" << endl;
540 int reduced_nb_points;
544 cout <<
" before call_back_find_candidates" << endl;
554 cout <<
" after call_back_find_candidates nb_candidates="
565 cout <<
"candidate set of size "
631 cout <<
"before call_back_add_point" << endl;
635 cout <<
"after call_back_add_point" << endl;
642 cout <<
" : considering clique ";
645 cout <<
" depth = " << depth <<
" nb_old="
669 cout <<
"before call_back_delete_point" << endl;
671 (*call_back_delete_point)(
this, depth,
674 cout <<
"after call_back_delete_point" << endl;
683 cout <<
"backtrack_search : ";
685 cout <<
" nb_sol=" <<
solutions.size() <<
" done" << endl;
692 int nb_old, i, nb_new;
693 int pt1, pt2, pt, pass, f_go;
694 unsigned long int counter_save;
695 int my_verbose_level;
703 if ((
counter & ((1 << 17) - 1)) == 0) {
709 int f_v = (my_verbose_level >= 1);
710 int f_vv = (my_verbose_level >= 2);
714 cout <<
"solve_decision_problem : ";
716 cout <<
" nb_sol=" <<
solutions.size() <<
" starting" << endl;
749 if (f_v || (
counter % print_interval) == 0) {
756 cout <<
" : # active points from previous level is "
779 for (i = 0; i < nb_old; i++) {
799 for (i = 0; i < nb_old; i++) {
816 cout <<
" : pass 2: ";
829 for (i = 0; i < nb_old; i++) {
831 if (d >= target_depth - depth - 1) {
839 cout <<
" : pass " << pass
840 <<
": suspicious point "
842 <<
" eliminated, d=" << d
843 <<
" is less than target_depth - depth - 1 = "
844 << target_depth - depth - 1 << endl;;
845 degree_of_point_verbose(i, nb_old);
853 cout <<
" : pass " << pass <<
": ";
858 }
while (nb_new < nb_old);
867 cout <<
"after " << pass <<
" passes: "
868 "nb_points = " << nb_new << endl;
873 (*call_back_after_reduction)(
this, depth,
882 int reduced_nb_points;
893 cout <<
"candidate set of size "
933 cout <<
"before call_back_add_point" << endl;
935 (*call_back_add_point)(
this, depth,
938 cout <<
"after call_back_add_point" << endl;
945 cout <<
" : considering clique ";
948 cout <<
" depth = " << depth <<
" nb_old="
967 cout <<
"before call_back_delete_point" << endl;
969 (*call_back_delete_point)(
this, depth,
972 cout <<
"after call_back_delete_point" << endl;
981 cout <<
"solve_decision_problem : ";
983 cout <<
" nb_sol=" <<
solutions.size() <<
" done" << endl;
989 static int *nb_old, *nb_new;
990 static int *pt1, *pt2, *pt, *pass, *f_go;
991 static unsigned long int *counter_save;
993void clique_finder::backtrack_search_not_recursive(
int verbose_level)
1016 counter_save[depth] =
counter;
1020 cout <<
"clique_finder::backtrack_search : ";
1022 cout <<
" nb_sol=" <<
solutions.size() <<
" starting" << endl;
1031 cout <<
"clique_finder::backtrack_search "
1032 "depth == target_depth" << endl;
1039 for (j = 0; j < depth; j++) {
1060 goto continuation_point;
1065 goto continuation_point;
1075 if (f_v || (
counter % print_interval) == 0) {
1082 cout <<
" : # active points from previous level is "
1103 cout <<
"clique_finder::backtrack_search : ";
1105 cout <<
" first pass" << endl;
1117 for (i = 0; i < nb_old[depth]; i++) {
1119 if (pt2[depth] > pt1[depth]) {
1126 nb_new[depth] = nb_old[depth];
1133 nb_old[depth] = nb_new[depth];
1137 for (i = 0; i < nb_old[depth]; i++) {
1152 nb_new[depth] = nb_old[depth];
1160 cout <<
" : pass 2: ";
1173 for (i = 0; i < nb_old; i++) {
1175 if (d >= target_depth - depth - 1) {
1183 cout <<
" : pass " << pass
1184 <<
": suspicious point "
1186 <<
" eliminated, d=" << d
1187 <<
" is less than target_depth - depth - 1 = "
1188 << target_depth - depth - 1 << endl;;
1189 degree_of_point_verbose(i, nb_old);
1197 cout <<
" : pass " << pass <<
": ";
1202 }
while (nb_new < nb_old);
1211 cout <<
"after " << pass[depth] <<
" passes: "
1212 "nb_points = " << nb_new[depth] << endl;
1219 cout <<
" before call_back_after_reduction" << endl;
1221 (*call_back_after_reduction)(
this, depth,
1225 cout <<
" after call_back_after_reduction" << endl;
1234 int reduced_nb_points;
1238 cout <<
" before call_back_find_candidates" << endl;
1248 cout <<
" after call_back_find_candidates "
1259 cout <<
"candidate set of size "
1282 if (f_has_print_current_choice_function) {
1283 (*call_back_print_current_choice)(
this, depth,
1305 f_go[depth] =
FALSE;
1326 cout <<
"before call_back_add_point" << endl;
1328 (*call_back_add_point)(
this, depth,
1331 cout <<
"after call_back_add_point" << endl;
1338 cout <<
" : considering clique ";
1341 cout <<
" depth = " << depth <<
" nb_old=" << nb_old << endl;
1345 f_go[depth] =
FALSE;
1355 goto entrance_point;
1370 cout <<
"before call_back_delete_point" << endl;
1372 (*call_back_delete_point)(
this, depth,
1375 cout <<
"after call_back_delete_point" << endl;
1382 goto continuation_point;
1396 cout <<
"backtrack_search : ";
1398 cout <<
" nb_sol=" <<
solutions.size() <<
" done" << endl;
1420 cout <<
"written file " <<
fname_tree <<
" of size "
1430 cout <<
"clique_finder::get_solutions nb_sol = " <<
nb_sol <<
" clique_sz=" << clique_sz << endl;
1438 cout <<
"clique_finder::get_solutions we did not store the solutions" << endl;
1443 cout <<
"clique_finder::get_solutions nb_sol != solutions.size()" << endl;
1448 for (i = 0; i <
solutions.size(); i++) {
1455 cout <<
"clique_finder::get_solutions done" << endl;
1463 cout <<
"Suspicious points: ";
1464 for (i = 0; i <
n; i++) {
1483 for (i = 0; i < size; i++) {
1496 int i, a, b, cnt = 0;
1498 for (i = 0; i < size; i++) {
1506 for (i = 0; i < size; i++) {
1523 unsigned long int counter_save,
unsigned long int counter)
1525 cout <<
"node " <<
counter <<
" at depth " << depth <<
" : ";
1527 cout <<
" nb_sol=" <<
solutions.size() <<
" ";
1535 unsigned long int counter_save,
unsigned long int counter)
1537 cout <<
"node " <<
counter <<
" at depth " << depth <<
" : ";
1550 for (i = 0; i < depth; i++) {
1554 if (i < depth - 1) {
1569 int nb_points,
int verbose_level)
1579 int f_second =
FALSE;
1645 a = (*call_back_is_adjacent)(
this, i, j, 0);
1646 adjacency[i *
n + j] = a;
1647 adjacency[j *
n + i] = a;
1663 *
fp_tree <<
"# " << depth <<
" ";
1664 for (i = 0; i < depth; i++) {
1680 for (i = 0; i < depth; i++) {
1686 for (i = 0; i < depth; i++) {
1695 for (i = 0; i < depth; i++) {
1709 if (i < 0 || i >=
n) {
1710 cout <<
"clique_finder::s_ij addressing error, i = "
1711 << i <<
", n = " <<
n << endl;
1714 if (j < 0 || j >=
n) {
1715 cout <<
"clique_finder::s_ij addressing error, j = "
1716 << j <<
", n = " <<
n << endl;
1727 else if (f_has_bitmatrix) {
1728 return bitvector_s_i(bitmatrix_adjacency, i *
n + j);
1748 cout <<
"clique_finder::s_ij we don't have a matrix" << endl;
1761 cout <<
"clique_finder::delinearize_adjacency_list" << endl;
1764 for (i = 0; i <
n; i++) {
1766 for (j = 0; j <
n; j++) {
1771 for (i = 0; i <
n; i++) {
1772 for (j = i + 1; j <
n; j++) {
1780 cout <<
"clique_finder::delinearize_adjacency_list "
1781 "we don't have bitvector or adjacency list" << endl;
1793 cout <<
"clique_finder::delinearize_adjacency_list done" << endl;
a collection of combinatorial functions
long int ij2k_lint(long int i, long int j, long int n)
compact storage of 0/1-data as bitvectors
void set_print(std::ostream &ost, int *v, int len)
void copy(int *from, int *to, long int len)
a collection of functions related to sorted vectors
int int_vec_search(int *v, int len, int a, int &idx)
void int_vec_heapsort(int *v, int len)
void int_vec_swap_points(int *list, int *list_inv, int idx1, int idx2)
a statistical analysis of data consisting of single integers
void init(int *data, int data_length, int f_second, int verbose_level)
void print(int f_backwards)
parameters that control the clique finding process
int f_has_print_current_choice_function
void(* call_back_print_current_choice)(clique_finder *CF, int depth, void *user_data, int verbose_level)
int f_decision_nodes_only
void * print_current_choice_data
void swap_point(int idx1, int idx2)
void init_suspicious_points(int nb, int *point_list)
int degree_of_point(int depth, int i, int nb_points)
int * point_is_suspicious
unsigned long int counter
int is_adjacent(int depth, int i, int j)
int f_has_row_by_row_adjacency_matrix
data_structures::bitvector * Bitvec_adjacency
void backtrack_search(int depth, int verbose_level)
void * call_back_clique_found_data1
void print_suspicious_points()
char ** row_by_row_adjacency_matrix
void degree_of_point_statistic(int depth, int nb_points, int verbose_level)
void log_position(int depth, unsigned long int counter_save, unsigned long int counter)
void print_set(int size, int *set)
void init(clique_finder_control *Control, std::string &label, int n, int f_has_adj_list, int *adj_list_coded, int f_has_bitvector, data_structures::bitvector *Bitvec_adjacency, int verbose_level)
void * call_back_clique_found_data2
void log_choice(int depth)
int(* call_back_is_adjacent)(clique_finder *CF, int pt1, int pt2, int verbose_level)
void delinearize_adjacency_list(int verbose_level)
void write_entry_to_tree_file(int depth, int verbose_level)
int(* call_back_find_candidates)(clique_finder *CF, int current_clique_size, int *current_clique, int nb_pts, int &reduced_nb_pts, int *pt_list, int *pt_list_inv, int *candidates, int verbose_level)
void get_solutions(int *&Sol, long int &nb_solutions, int &clique_sz, int verbose_level)
void log_position_and_choice(int depth, unsigned long int counter_save, unsigned long int counter)
unsigned long int decision_step_counter
void(* call_back_delete_point)(clique_finder *CF, int current_clique_size, int *current_clique, int pt, int verbose_level)
int solve_decision_problem(int depth, int verbose_level)
clique_finder_control * Control
void(* call_back_clique_found)(clique_finder *CF, int verbose_level)
void open_tree_file(std::string &fname_base)
void print_suspicious_point_subset(int size, int *set)
std::deque< std::vector< int > > solutions
void init_restrictions(int *restrictions, int verbose_level)
void(* call_back_add_point)(clique_finder *CF, int current_clique_size, int *current_clique, int pt, int verbose_level)
void init_point_labels(int *pt_labels)
void(* call_back_after_reduction)(clique_finder *CF, int depth, int nb_points, int verbose_level)
a collection of functions related to file io
long int file_size(std::string &fname)
data_structures::int_vec * Int_vec
#define Int_vec_zero(A, B)
#define Int_vec_copy(A, B, C)
orbiter_kernel_system::orbiter_session * Orbiter
global Orbiter session
the orbiter library for the classification of combinatorial objects