13namespace layer1_foundations {
14namespace graph_theory {
26 std::string &fname_graph,
31 int f_v = (verbose_level >= 1);
32 std::string fname_draw;
36 cout <<
"graph_theory_domain::colored_graph_draw" << endl;
39 CG.
load(fname_graph, verbose_level - 1);
42 fname_draw.append(
"_graph");
45 cout <<
"graph_theory_domain::colored_graph_draw before CG.draw_partitioned" << endl;
55 cout <<
"graph_theory_domain::colored_graph_draw after CG.draw_partitioned" << endl;
58 cout <<
"graph_theory_domain::colored_graph_draw done" << endl;
65 int f_output_solution_raw,
66 int f_output_fname, std::string &output_fname,
69 int f_v = (verbose_level >= 1);
71 std::string fname_sol;
72 std::string fname_success;
75 cout <<
"colored_graph_all_cliques" << endl;
77 CG.
load(fname, verbose_level - 1);
79 fname_sol.assign(output_fname);
80 fname_success.assign(output_fname);
81 fname_success.append(
".success");
85 fname_sol.append(
"_sol.txt");
87 fname_success.append(
"_sol.success");
93 ofstream fp(fname_sol.c_str());
96 cout <<
"colored_graph_all_cliques "
97 "before CG.all_rainbow_cliques" << endl;
103 cout <<
"colored_graph_all_cliques "
104 "after CG.all_rainbow_cliques" << endl;
110 ofstream fp(fname_success);
111 fp <<
"success" << endl;
114 cout <<
"colored_graph_all_cliques done" << endl;
120 long int *list_of_cases,
int nb_cases,
121 std::string &fname_template, std::string &fname_sol,
122 std::string &fname_stats,
123 int f_split,
int split_r,
int split_m,
124 int f_prefix, std::string &prefix,
127 int f_v = (verbose_level >= 1);
129 int Search_steps = 0, Decision_steps = 0, Nb_sol = 0, Dt = 0;
131 char fname_tmp[2000];
134 cout <<
"colored_graph_all_cliques_list_of_cases" << endl;
137 ofstream fp(fname_sol.c_str());
138 ofstream fp_stats(fname_stats.c_str());
140 fp_stats <<
"i,Case,Nb_sol,Nb_vertices,search_steps,"
141 "decision_steps,dt" << endl;
142 for (i = 0; i < nb_cases; i++) {
144 if (f_split && ((i % split_m) == split_r)) {
151 c = list_of_cases[i];
153 cout <<
"colored_graph_all_cliques_list_of_cases case " << i
154 <<
" / " << nb_cases <<
" which is " << c << endl;
156 snprintf(fname_tmp, 2000, fname_template.c_str(), c);
158 fname.assign(prefix);
159 fname.append(fname_tmp);
162 fname.assign(fname_tmp);
164 CG->
load(fname, verbose_level - 2);
168 fp <<
"# start case " << c << endl;
178 fp_stats << i <<
"," << c <<
"," << Control->
nb_sol <<
"," << CG->
nb_points
183 Nb_sol += Control->
nb_sol;
188 fp << -1 <<
" " << Nb_sol <<
" " << Search_steps <<
" "
189 << Decision_steps <<
" " << Dt << endl;
190 fp_stats <<
"END" << endl;
193 cout <<
"colored_graph_all_cliques_list_of_cases "
194 "done Nb_sol=" << Nb_sol << endl;
200 int n,
int *Adj,
int verbose_level)
203 int f_v = (verbose_level >= 1);
207 cout <<
"save_as_colored_graph_easy" << endl;
209 fname.assign(fname_base);
210 fname.append(
".colored_graph");
217 CG->
save(fname, verbose_level);
222 cout <<
"save_as_colored_graph_easy Written file " << fname
223 <<
" of size " << Fio.
file_size(fname) << endl;
228 int nb_vertices,
int nb_colors,
int nb_colors_per_vertex,
229 long int *points,
int *point_color,
230 long int *data,
int data_sz,
234 int f_v = (verbose_level >= 1);
238 cout <<
"save_colored_graph" << endl;
239 cout <<
"save_colored_graph fname=" << fname << endl;
240 cout <<
"save_colored_graph nb_vertices=" << nb_vertices << endl;
241 cout <<
"save_colored_graph nb_colors=" << nb_colors << endl;
242 cout <<
"save_colored_graph nb_colors_per_vertex="
243 << nb_colors_per_vertex << endl;
248 ofstream fp(fname, ios::binary);
253 fp.write((
char*) &a,
sizeof(
int));
254 fp.write((
char*) &b,
sizeof(
int));
255 fp.write((
char*) &nb_vertices,
sizeof(
int));
256 fp.write((
char*) &nb_colors,
sizeof(
int));
257 fp.write((
char*) &nb_colors_per_vertex,
sizeof(
int));
258 fp.write((
char*) &data_sz,
sizeof(
int));
260 cout <<
"save_colored_graph before writing data" << endl;
262 for (i = 0; i < data_sz; i++) {
263 fp.write((
char*) &data[i],
sizeof(
long int));
265 for (i = 0; i < nb_vertices; i++) {
267 cout <<
"save_colored_graph before writing vertex " << i <<
" / " << nb_vertices << endl;
270 fp.write((
char*) &points[i],
sizeof(
long int));
274 fp.write((
char*) &a,
sizeof(
int));
276 for (j = 0; j < nb_colors_per_vertex; j++) {
277 fp.write((
char*) &point_color[i * nb_colors_per_vertex + j],
sizeof(
int));
281 cout <<
"save_colored_graph before writing bitvec" << endl;
286 cout <<
"save_colored_graph after writing bitvec" << endl;
291 cout <<
"save_colored_graph done" << endl;
296 int &nb_vertices,
int &nb_colors,
int &nb_colors_per_vertex,
297 long int *&vertex_labels,
int *&vertex_colors,
long int *&user_data,
302 int f_v = (verbose_level >= 1);
308 cout <<
"graph_theory_domain::load_colored_graph" << endl;
312 cout <<
"graph_theory_domain::load_colored_graph the file " << fname <<
" does not exist or is empty" << endl;
317 ifstream fp(fname, ios::binary);
320 fp.read((
char *) &a,
sizeof(
int));
325 cout <<
"graph_theory_domain::load_colored_graph detected new file format" << endl;
338 fp.read((
char *) &b,
sizeof(
int));
340 cout <<
"graph_theory_domain::load_colored_graph version=" << b << endl;
343 fp.read((
char *) &nb_vertices,
sizeof(
int));
344 fp.read((
char *) &nb_colors,
sizeof(
int));
345 fp.read((
char *) &nb_colors_per_vertex,
sizeof(
int));
347 cout <<
"graph_theory_domain::load_colored_graph nb_vertices=" << nb_vertices
348 <<
" nb_colors=" << nb_colors
349 <<
" nb_colors_per_vertex=" << nb_colors_per_vertex
354 L = ((
long int) nb_vertices * (
long int) (nb_vertices - 1)) >> 1;
357 bitvector_length = (L + 7) >> 3;
359 cout <<
"graph_theory_domain::load_colored_graph bitvector_length="
360 << bitvector_length << endl;
364 fp.read((
char *) &user_data_size,
sizeof(int));
366 cout <<
"graph_theory_domain::load_colored_graph user_data_size="
367 << user_data_size << endl;
369 user_data =
NEW_lint(user_data_size);
371 for (i = 0; i < user_data_size; i++) {
372 fp.read((
char *) &user_data[i],
sizeof(
long int));
375 vertex_labels =
NEW_lint(nb_vertices);
376 vertex_colors =
NEW_int(nb_vertices * nb_colors_per_vertex);
378 for (i = 0; i < nb_vertices; i++) {
379 fp.read((
char *) &vertex_labels[i],
sizeof(
long int));
380 for (j = 0; j < nb_colors_per_vertex; j++) {
381 fp.read((
char *) &vertex_colors[i * nb_colors_per_vertex + j],
sizeof(
int));
382 if (vertex_colors[i * nb_colors_per_vertex + j] >= nb_colors) {
383 cout <<
"graph_theory_domain::load_colored_graph" << endl;
384 cout <<
"vertex_colors[i * nb_colors_per_vertex + j] >= nb_colors" << endl;
385 cout <<
"vertex_colors[i * nb_colors_per_vertex + j]=" << vertex_colors[i * nb_colors_per_vertex + j] << endl;
386 cout <<
"i=" << i << endl;
387 cout <<
"j=" << j << endl;
388 cout <<
"nb_colors=" << nb_colors << endl;
392 Sorting.
int_vec_heapsort(vertex_colors + i * nb_colors_per_vertex, nb_colors_per_vertex);
393 for (j = 1; j < nb_colors_per_vertex; j++) {
394 if (vertex_colors[i * nb_colors_per_vertex + j - 1] == vertex_colors[i * nb_colors_per_vertex + j]) {
395 cout <<
"graph_theory_domain::load_colored_graph repeated color for vertex " << i <<
" : " << endl;
396 Int_vec_print(cout, vertex_colors + i * nb_colors_per_vertex, nb_colors_per_vertex);
406 cout <<
"graph_theory_domain::load_colored_graph detected old file format in file " << fname << endl;
412 cout <<
"graph_theory_domain::load_colored_graph old file format detected, using compatibility mode" << endl;
414 fp.read((
char *) &nb_colors,
sizeof(
int));
415 nb_colors_per_vertex = 1;
417 cout <<
"graph_theory_domain::load_colored_graph nb_vertices=" << nb_vertices
418 <<
" nb_colors=" << nb_colors
419 <<
" nb_colors_per_vertex=" << nb_colors_per_vertex
424 L = ((
long int) nb_vertices * (
long int) (nb_vertices - 1)) >> 1;
427 bitvector_length = (L + 7) >> 3;
429 cout <<
"graph_theory_domain::load_colored_graph bitvector_length="
430 << bitvector_length << endl;
434 fp.read((
char *) &user_data_size,
sizeof(int));
436 cout <<
"graph_theory_domain::load_colored_graph user_data_size="
437 << user_data_size << endl;
439 user_data =
NEW_lint(user_data_size);
441 for (i = 0; i < user_data_size; i++) {
442 fp.read((
char *) &a,
sizeof(
int));
446 vertex_labels =
NEW_lint(nb_vertices);
447 vertex_colors =
NEW_int(nb_vertices * nb_colors_per_vertex);
449 for (i = 0; i < nb_vertices; i++) {
450 fp.read((
char *) &a,
sizeof(
int));
451 vertex_labels[i] = a;
452 for (j = 0; j < nb_colors_per_vertex; j++) {
453 fp.read((
char *) &vertex_colors[i * nb_colors_per_vertex + j],
sizeof(
int));
454 if (vertex_colors[i * nb_colors_per_vertex + j] >= nb_colors) {
455 cout <<
"graph_theory_domain::load_colored_graph" << endl;
456 cout <<
"vertex_colors[i * nb_colors_per_vertex + j] >= nb_colors" << endl;
457 cout <<
"vertex_colors[i * nb_colors_per_vertex + j]=" << vertex_colors[i * nb_colors_per_vertex + j] << endl;
458 cout <<
"i=" << i << endl;
459 cout <<
"j=" << j << endl;
460 cout <<
"nb_colors=" << nb_colors << endl;
468 cout <<
"graph_theory_domain::load_colored_graph before allocating bitvector_adjacency" << endl;
478 cout <<
"graph_theory_domain::load_colored_graph done" << endl;
484 int *&Pijk,
int *&colors,
int &nb_colors,
int verbose_level)
488 int f_v = (verbose_level >= 1);
489 int f_vv = (verbose_level >= 2);
496 cout <<
"is_association_scheme" << endl;
498 N = (n * (n - 1)) / 2;
501 for (i = 0; i < n; i++) {
502 for (j = i + 1; j < n; j++) {
503 M1[k++] = color_graph[i * n + j];
507 cout <<
"N=" << N << endl;
508 cout <<
"k=" << k << endl;
517 colors[0] = color_graph[0];
523 cout <<
"colors (the 0-th color is the diagonal color): ";
529 int *M = color_graph;
530 int pijk, pijk1, u, v, w, u0 = 0, v0 = 0;
534 for (k = 0; k < C; k++) {
535 for (i = 0; i < C; i++) {
536 for (j = 0; j < C; j++) {
538 for (u = 0; u < n; u++) {
539 for (v = 0; v < n; v++) {
541 if (M[u * n + v] != colors[k])
545 for (w = 0; w < n; w++) {
548 if (M[u * n + w] != colors[i])
550 if (M[v * n + w] != colors[j])
574 cout <<
"not an association scheme" << endl;
575 cout <<
"k=" << k << endl;
576 cout <<
"i=" << i << endl;
577 cout <<
"j=" << j << endl;
578 cout <<
"u0=" << u0 << endl;
579 cout <<
"v0=" << v0 << endl;
580 cout <<
"pijk=" << pijk << endl;
581 cout <<
"u=" << u << endl;
582 cout <<
"v=" << v << endl;
583 cout <<
"pijk1=" << pijk1 << endl;
591 Pijk[i * C * C + j * C + k] = pijk;
599 cout <<
"it is an association scheme" << endl;
605 if (C == 3 && colors[1] == 0 && colors[2] == 1) {
608 k = Pijk[2 * C * C + 2 * C + 0];
609 lambda = Pijk[2 * C * C + 2 * C + 2];
610 mu = Pijk[2 * C * C + 2 * C + 1];
611 cout <<
"it is an SRG(" << n <<
"," << k <<
"," << lambda <<
","
612 << mu <<
")" << endl;
626 for (k = 0; k < C; k++) {
630 for (i = 0; i < C; i++) {
631 for (j = 0; j < C; j++) {
632 Mtx[i * C + j] = Pijk[i * C * C + j * C + k];
635 cout <<
"P^{(" << k <<
")}=(p_{i,j," << k <<
"})_{i,j}:" << endl;
643 int N,
int *first,
int *len,
int nb_parts,
int *&R,
646 int f_v = (verbose_level >= 1);
647 int I, J, i, j, f1, l1, f2, l2, r0 = 0, r;
650 cout <<
"compute_decomposition_of_graph_wrt_partition" << endl;
651 cout <<
"The partition is:" << endl;
659 R =
NEW_int(nb_parts * nb_parts);
661 for (I = 0; I < nb_parts; I++) {
664 for (J = 0; J < nb_parts; J++) {
667 for (i = 0; i < l1; i++) {
669 for (j = 0; j < l2; j++) {
670 if (Adj[(f1 + i) * N + f2 + j]) {
679 cout <<
"compute_decomposition_of_graph_"
680 "wrt_partition not tactical" << endl;
681 cout <<
"I=" << I << endl;
682 cout <<
"J=" << J << endl;
683 cout <<
"r0=" << r0 << endl;
684 cout <<
"r=" << r << endl;
689 R[I * nb_parts + J] = r0;
693 cout <<
"compute_decomposition_of_graph_wrt_partition done" << endl;
698 std::string &fname_base,
701 int f_partition,
int nb_row_parts,
int *row_part_first,
702 int nb_col_parts,
int *col_part_first,
int f_row_grid,
int f_col_grid,
704 int *M,
int m,
int n,
705 int f_has_labels,
int *labels,
708 int f_v = (verbose_level >= 1);
711 cout <<
"graph_theory_domain::draw_bitmatrix" << endl;
716 G.
init(fname_base, Draw_options, verbose_level - 1);
719 nb_col_parts, col_part_first, f_row_grid, f_col_grid,
720 f_bitmatrix, Bitmatrix, M, m, n,
721 f_has_labels, labels);
726 cout <<
"graph_theory_domain::draw_bitmatrix done" << endl;
733 int f_v = (verbose_level >= 1);
736 cout <<
"graph_theory_domain::list_parameters_of_SRG" << endl;
739 int v, v2, k, lambda, mu, cnt = 0;
740 int top, top2, bottom, b, tb;
744 for (v = 2; v <= v_max; v++) {
746 for (k = 1; k <= v2; k++) {
747 for (lambda = 0; lambda <= k; lambda++) {
748 for (mu = 1; mu <= k; mu++) {
749 if (k * (k - lambda - 1) != mu * (v - k - 1)) {
752 top = (v - 1) * (mu - lambda) - 2 * k;
754 bottom = (mu - lambda) * (mu - lambda) + 4 * (k - mu);
756 cout <<
"cnt=" << cnt <<
" v=" << v <<
" k=" << k
757 <<
" lambda=" << lambda <<
" mu=" << mu
758 <<
" top=" << top <<
" bottom=" << bottom << endl;
760 cout <<
"is ruled out by integrality condition" << endl;
765 int *primes, *exponents;
766 nb = NT.
factor_int(bottom, primes, exponents);
767 for (i = 0; i < nb; i++) {
768 if (
ODD(exponents[i])) {
773 cout <<
"bottom is not a square" << endl;
776 for (i = 0; i < nb; i++) {
780 for (i = 0; i < nb; i++) {
781 b *= NT.
i_power_j(primes[i], exponents[i]);
783 cout <<
"b=" << b << endl;
785 cout <<
"tb=" << tb << endl;
786 if (
ODD(v - 1 + tb)) {
787 cout <<
"is ruled out by integrality condition (2)" << endl;
790 if (
ODD(v - 1 - tb)) {
791 cout <<
"is ruled out by integrality condition (3)" << endl;
794 f = (v - 1 + tb) >> 1;
795 g = (v - 1 - tb) >> 1;
796 if (
ODD(lambda - mu + b)) {
797 cout <<
"r is not integral, skip" << endl;
800 if (
ODD(lambda - mu - b)) {
801 cout <<
"r is not integral, skip" << endl;
804 r = (lambda - mu + b) >> 1;
805 s = (lambda - mu - b) >> 1;
806 cout <<
"f=" << f <<
" g=" << g <<
" r=" << r <<
" s=" << s << endl;
810 L1 = (r + 1) * (k + r + 2 * r * s);
811 R1 = (k + r) * (s + 1) * (s + 1);
812 L2 = (s + 1) * (k + s + 2 * r * s);
813 R2 = (k + s) * (r + 1) * (r + 1);
816 cout <<
"is ruled out by Krein condition (1)" << endl;
820 cout <<
"is ruled out by Krein condition (2)" << endl;
829 cout <<
"graph_theory_domain::list_parameters_of_SRG done" << endl;
834 int n,
int verbose_level)
836 int f_v = (verbose_level >= 1);
839 cout <<
"graph_theory_domain::make_cycle_graph" << endl;
849 for (i = 0; i < N; i++) {
856 cout <<
"graph_theory_domain::make_cycle_graph done" << endl;
865 int n,
int q,
int verbose_level)
867 int f_v = (verbose_level >= 1);
870 cout <<
"graph_theory_domain::make_Hamming_graph" << endl;
890 for (i = 0; i < N; i++) {
892 for (j = i + 1; j < N; j++) {
908 cout <<
"graph_theory_domain::make_Hamming_graph done" << endl;
915 int n,
int k,
int s,
int verbose_level)
917 int f_v = (verbose_level >= 1);
920 cout <<
"graph_theory_domain::make_Johnson_graph" << endl;
939 for (i = 0; i < N; i++) {
941 for (j = i + 1; j < N; j++) {
957 cout <<
"graph_theory_domain::make_Johnson_graph done" << endl;
963 int q,
int verbose_level)
965 int f_v = (verbose_level >= 1);
968 cout <<
"graph_theory_domain::make_Paley_graph" << endl;
972 cout <<
"graph_theory_domain::make_Paley_graph q must be odd" << endl;
976 cout <<
"graph_theory_domain::make_Paley_graph q must be congruent to 1 modulo 4" << endl;
989 for (i = 0; i < q; i++) {
991 f_is_square[j] =
TRUE;
997 for (i = 0; i < q; i++) {
998 for (j = i + 1; j < q; j++) {
1000 if (f_is_square[a]) {
1012 cout <<
"graph_theory_domain::make_Paley_graph done" << endl;
1017 int q,
int verbose_level)
1019 int f_v = (verbose_level >= 1);
1022 cout <<
"graph_theory_domain::make_Schlaefli_graph" << endl;
1035 Gr->
init(n, k, F, verbose_level);
1043 cout <<
"graph_theory_domain::make_Schlaefli_graph done" << endl;
1048 int q,
int index,
int verbose_level)
1050 int f_v = (verbose_level >= 1);
1053 cout <<
"graph_theory_domain::make_Winnie_Li_graph" << endl;
1057 int i, j, h, u, p, k, co_index, q1, relative_norm;
1072 co_index = F->
e / index;
1074 if (co_index * index != F->
e) {
1075 cout <<
"graph_theory_domain::make_Winnie_Li_graph "
1076 "the index has to divide the field degree" << endl;
1081 k = (q - 1) / (q1 - 1);
1084 cout <<
"q=" << q << endl;
1085 cout <<
"index=" << index << endl;
1086 cout <<
"co_index=" << co_index << endl;
1087 cout <<
"q1=" << q1 << endl;
1088 cout <<
"k=" << k << endl;
1093 for (i = 0; i < index; i++) {
1098 cout <<
"graph_theory_domain::make_Winnie_Li_graph "
1099 "relative_norm=" << relative_norm << endl;
1104 for (i = 0; i < q; i++) {
1105 if (F->
power(i, relative_norm) == 1) {
1110 cout <<
"graph_theory_domain::make_Winnie_Li_graph "
1115 cout <<
"graph_theory_domain::make_Winnie_Li_graph "
1116 "found " << k <<
" norm-one elements:" << endl;
1122 for (i = 0; i < q; i++) {
1123 for (h = 0; h < k; h++) {
1139 cout <<
"graph_theory_domain::make_Winnie_Li_graph done" << endl;
1144 int n,
int k,
int q,
int r,
int verbose_level)
1146 int f_v = (verbose_level >= 1);
1149 cout <<
"graph_theory_domain::make_Grassmann_graph" << endl;
1166 Gr->
init(n, k, F, verbose_level);
1177 for (i = 0; i < N; i++) {
1181 for (j = i + 1; j < N; j++) {
1205 cout <<
"graph_theory_domain::make_Grassmann_graph done" << endl;
1211 int epsilon,
int d,
int q,
int verbose_level)
1213 int f_v = (verbose_level >= 1);
1216 cout <<
"graph_theory_domain::make_orthogonal_collinearity_graph" << endl;
1221 int n, a, nb_e, nb_inc;
1222 int c1 = 0, c2 = 0, c3 = 0;
1235 cout <<
"graph_theory_domain::make_orthogonal_collinearity_graph "
1236 "epsilon=" << epsilon <<
" n=" << n <<
" q=" << q << endl;
1242 cout <<
"graph_theory_domain::make_orthogonal_collinearity_graph "
1243 "number of points = " << N << endl;
1254 else if (epsilon == -1) {
1261 cout <<
"graph_theory_domain::make_orthogonal_collinearity_graph "
1262 "Gram matrix" << endl;
1267 if (f_list_points) {
1268 for (i = 0; i < N; i++) {
1269 F->Q_epsilon_unrank(v, 1, epsilon, n, c1, c2, c3, i, 0 );
1271 int_vec_print(cout, v, n + 1);
1272 j = F->Q_epsilon_rank(v, 1, epsilon, n, c1, c2, c3, 0 );
1273 cout <<
" : " << j << endl;
1281 cout <<
"graph_theory_domain::make_orthogonal_collinearity_graph "
1282 "allocating adjacency matrix" << endl;
1286 cout <<
"graph_theory_domain::make_orthogonal_collinearity_graph "
1287 "allocating adjacency matrix was successful" << endl;
1291 for (i = 0; i < N; i++) {
1293 for (j = i + 1; j < N; j++) {
1310 cout <<
"graph_theory_domain::make_orthogonal_collinearity_graph "
1311 "The adjacency matrix of the collinearity graph has been computed" << endl;
1321 cout <<
"graph_theory_domain::make_orthogonal_collinearity_graph done" << endl;
1326 int n,
int verbose_level)
1328 int f_v = (verbose_level >= 1);
1331 cout <<
"graph_theory_domain::make_non_attacking_queens_graph" << endl;
1343 for (n1 = 0; n1 < N; n1++) {
1346 for (n2 = n1 + 1; n2 < N; n2++) {
1355 if (j2 - j1 == i2 - i1) {
1358 if (j2 - j1 == i1 - i2) {
1361 Adj[n1 * N + n2] = 1;
1362 Adj[n2 * N + n1] = 1;
1367 cout <<
"graph_theory_domain::make_non_attacking_queens_graph done" << endl;
1373 std::string &fname,
int verbose_level)
1375 int f_v = (verbose_level >= 1);
1378 cout <<
"graph_theory_domain::make_disjoint_sets_graph" << endl;
1394 cout <<
"graph_theory_domain::make_disjoint_sets_graph N=" << N << endl;
1401 for (i = 0; i < N; i++) {
1402 for (j = i + 1; j < N; j++) {
1412 cout <<
"graph_theory_domain::make_disjoint_sets_graph done" << endl;
1421 int *Table,
int nb_sets,
int set_size,
1422 std::string &prefix_for_graph,
1426 int f_v = (verbose_level >= 1);
1427 long int i, j, k, cnt, N2, N2_100;
1430 cout <<
"graph_theory_domain::compute_adjacency_matrix" << endl;
1433 N2 = (nb_sets * (nb_sets - 1)) >> 1;
1435 cout <<
"graph_theory_domain::compute_adjacency_matrix N2=" << N2 << endl;
1437 N2_100 = (N2 / 100) + 1;
1444 cout <<
"graph_theory_domain::compute_adjacency_matrix "
1445 "after allocating adjacency bitvector" << endl;
1446 cout <<
"computing adjacency matrix:" << endl;
1450 for (i = 0; i < nb_sets; i++) {
1451 for (j = i + 1; j < nb_sets; j++) {
1456 p = Table + i * set_size;
1457 q = Table + j * set_size;
1459 while (u + v < 2 * set_size) {
1463 if (u == set_size) {
1466 else if (v == set_size) {
1469 else if (p[u] < q[v]) {
1476 if (u + v < 2 * set_size) {
1486 if ((k % N2_100) == 0) {
1487 cout <<
"i=" << i <<
" j=" << j <<
" " << k / N2_100 <<
"% done, k=" << k << endl;
1490 if ((k & ((1 << 21) - 1)) == 0) {
1491 cout <<
"i=" << i <<
" j=" << j <<
" k=" << k
1492 <<
" / " << N2 << endl;
1500 cout <<
"graph_theory_domain::compute_adjacency_matrix making a graph" << endl;
1514 CG->
init(nb_sets, 1 , 1 ,
1517 prefix_for_graph, prefix_for_graph,
1520 fname.assign(prefix_for_graph);
1521 fname.append(
"_disjointness.colored_graph");
1523 CG->
save(fname, verbose_level);
1525 cout <<
"Written file " << fname <<
" of size " << Fio.
file_size(fname) << endl;
1533 cout <<
"graph_theory_domain::compute_adjacency_matrix done" << endl;
1538 int *M,
int m,
int n,
1539 int *&Adj,
int verbose_level)
1542 int f_v = (verbose_level >= 1);
1547 cout <<
"graph_theory_domain::make_graph_of_disjoint_sets_from_rows_of_matrix" << endl;
1550 for (i = 0; i < m * m; i++) {
1554 for (i = 0; i < m; i++) {
1555 for (j = i + 1; j < m; j++) {
1557 M + i * n, M + j * n, n, n)) {
1568 cout <<
"graph_theory_domain::make_graph_of_disjoint_sets_from_rows_of_matrix done" << endl;
1573 int nb_pts,
int clique_sz,
int *&Sol,
long int &nb_sol,
1576 int f_v = (verbose_level >= 1);
1579 cout <<
"graph_theory_domain::all_cliques_of_given_size" << endl;
1582 int *adj_list_coded;
1587 int f_maxdepth =
FALSE;
1591 label.assign(
"all_cliques_of_given_size");
1593 n2 = (nb_pts * (nb_pts - 1)) >> 1;
1596 cout <<
"graph_theory_domain::all_cliques_of_given_size: "
1597 "computing adj_list_coded" << endl;
1598 for (i = 0; i < nb_pts; i++) {
1599 for (j = i + 1; j < nb_pts; j++) {
1600 adj_list_coded[h++] = Adj[i * nb_pts + j];
1615 cout <<
"graph_theory_domain::all_cliques_of_given_size: "
1616 "before C->init" << endl;
1620 TRUE, adj_list_coded,
1627 cout <<
"graph_theory_domain::all_cliques_of_given_size "
1628 "done with search, "
1629 "we found " << C->
solutions.size() <<
" solutions" << endl;
1634 cout <<
"graph_theory_domain::all_cliques_of_given_size "
1635 "before C->get_solutions" << endl;
1639 cout <<
"graph_theory_domain::all_cliques_of_given_size "
1640 "after C->get_solutions" << endl;
1642 if (sz != clique_sz) {
1643 cout <<
"graph_theory_domain::all_cliques_of_given_size "
1644 "sz != clique_sz" << endl;
1651 cout <<
"graph_theory_domain::all_cliques_of_given_size done" << endl;
various functions related to coding theory
int Hamming_distance(int *v1, int *v2, int n)
a collection of combinatorial functions
void unrank_k_subset(int rk, int *set, int n, int k)
long int generalized_binomial(int n, int k, int q)
long int int_n_choose_k(int n, int k)
matrices over GF(2) stored as bitvectors
compact storage of 0/1-data as bitvectors
void m_i(long int i, int a)
long int get_allocated_length()
void allocate(long int length)
a collection of functions related to sorted vectors
void int_vec_heapsort(int *v, int len)
int test_if_sets_are_disjoint(long int *set1, int sz1, long int *set2, int sz2)
int test_if_sets_are_disjoint_assuming_sorted(int *set1, int *set2, int sz1, int sz2)
void int_vec_intersect_sorted_vectors(int *v1, int len1, int *v2, int len2, int *v3, int &len3)
a statistical analysis of data consisting of single integers
void init(int *data, int data_length, int f_second, int verbose_level)
orthogonal_geometry::orthogonal_indexing * Orthogonal_indexing
void finite_field_init(int q, int f_without_tables, int verbose_level)
linear_algebra::linear_algebra * Linear_algebra
various functions related to geometries
void AG_element_unrank(int q, int *v, int stride, int len, long int a)
long int nb_pts_Qepsilon(int epsilon, int k, int q)
to rank and unrank subspaces of a fixed dimension in F_q^n
void create_Schlaefli_graph(int *&Adj, int &sz, int verbose_level)
void unrank_lint_here(int *Mtx, long int rk, int verbose_level)
void init(int n, int k, field_theory::finite_field *F, int verbose_level)
parameters that control the clique finding process
unsigned long int nb_decision_steps
unsigned long int nb_search_steps
finds all cliques of a certain size in a graph
void backtrack_search(int depth, int verbose_level)
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 get_solutions(int *&Sol, long int &nb_solutions, int &clique_sz, int verbose_level)
std::deque< std::vector< int > > solutions
a graph with a vertex coloring
void save(std::string &fname, int verbose_level)
void draw_partitioned(std::string &fname, graphics::layered_graph_draw_options *Draw_options, int f_labels, int verbose_level)
void init(int nb_points, int nb_colors, int nb_colors_per_vertex, int *colors, data_structures::bitvector *Bitvec, int f_ownership_of_bitvec, std::string &label, std::string &label_tex, int verbose_level)
void init_adjacency_no_colors(int nb_points, int *Adj, std::string &label, std::string &label_tex, int verbose_level)
void load(std::string &fname, int verbose_level)
void all_rainbow_cliques(clique_finder_control *Control, std::ostream &fp, int verbose_level)
void make_graph_of_disjoint_sets_from_rows_of_matrix(int *M, int m, int n, int *&Adj, int verbose_level)
void colored_graph_all_cliques_list_of_cases(clique_finder_control *Control, long int *list_of_cases, int nb_cases, std::string &fname_template, std::string &fname_sol, std::string &fname_stats, int f_split, int split_r, int split_m, int f_prefix, std::string &prefix, int verbose_level)
void all_cliques_of_given_size(int *Adj, int nb_pts, int clique_sz, int *&Sol, long int &nb_sol, int verbose_level)
void load_colored_graph(std::string &fname, int &nb_vertices, int &nb_colors, int &nb_colors_per_vertex, long int *&vertex_labels, int *&vertex_colors, long int *&user_data, int &user_data_size, data_structures::bitvector *&Bitvec, int verbose_level)
void compute_decomposition_of_graph_wrt_partition(int *Adj, int N, int *first, int *len, int nb_parts, int *&R, int verbose_level)
void make_Paley_graph(int *&Adj, int &N, int q, int verbose_level)
void save_colored_graph(std::string &fname, int nb_vertices, int nb_colors, int nb_colors_per_vertex, long int *points, int *point_color, long int *data, int data_sz, data_structures::bitvector *Bitvec, int verbose_level)
void list_parameters_of_SRG(int v_max, int verbose_level)
void colored_graph_all_cliques(clique_finder_control *Control, std::string &fname, int f_output_solution_raw, int f_output_fname, std::string &output_fname, int verbose_level)
void compute_adjacency_matrix(int *Table, int nb_sets, int set_size, std::string &prefix_for_graph, data_structures::bitvector *&B, int verbose_level)
void make_Winnie_Li_graph(int *&Adj, int &N, int q, int index, int verbose_level)
void make_orthogonal_collinearity_graph(int *&Adj, int &N, int epsilon, int d, int q, int verbose_level)
void make_Hamming_graph(int *&Adj, int &N, int n, int q, int verbose_level)
void make_disjoint_sets_graph(int *&Adj, int &N, std::string &fname, int verbose_level)
void make_Grassmann_graph(int *&Adj, int &N, int n, int k, int q, int r, int verbose_level)
void save_as_colored_graph_easy(std::string &fname_base, int n, int *Adj, int verbose_level)
void make_cycle_graph(int *&Adj, int &N, int n, int verbose_level)
void colored_graph_draw(std::string &fname, graphics::layered_graph_draw_options *Draw_options, int f_labels, int verbose_level)
int is_association_scheme(int *color_graph, int n, int *&Pijk, int *&colors, int &nb_colors, int verbose_level)
void print_Pijk(int *Pijk, int nb_colors)
void make_Schlaefli_graph(int *&Adj, int &N, int q, int verbose_level)
void make_non_attacking_queens_graph(int *&Adj, int &N, int n, int verbose_level)
void make_Johnson_graph(int *&Adj, int &N, int n, int k, int s, int verbose_level)
void draw_bitmatrix(std::string &fname_base, graphics::layered_graph_draw_options *Draw_options, int f_dots, int f_partition, int nb_row_parts, int *row_part_first, int nb_col_parts, int *col_part_first, int f_row_grid, int f_col_grid, int f_bitmatrix, data_structures::bitmatrix *Bitmatrix, int *M, int m, int n, int f_has_labels, int *labels, int verbose_level)
options for drawing an object of type layered_graph
a general 2D graphical output interface (metapost, tikz, postscript)
void init(std::string &file_name, layered_graph_draw_options *Draw_options, int verbose_level)
void draw_bitmatrix2(int f_dots, int f_partition, int nb_row_parts, int *row_part_first, int nb_col_parts, int *col_part_first, int f_row_grid, int f_col_grid, int f_bitmatrix, data_structures::bitmatrix *Bitmatrix, int *M, int m, int n, int f_has_labels, int *labels)
void finish(std::ostream &ost, int verbose_level)
int evaluate_bilinear_form(int n, int *v1, int *v2, int *Gram)
void choose_anisotropic_form(int &c1, int &c2, int &c3, int verbose_level)
int rank_of_rectangular_matrix(int *A, int m, int n, int verbose_level)
void Gram_matrix(int epsilon, int k, int form_c1, int form_c2, int form_c3, int *&Gram, int verbose_level)
basic number theoretic functions
int i_power_j(int i, int j)
int factor_int(int a, int *&primes, int *&exponents)
a collection of functions related to file io
long int file_size(std::string &fname)
void lint_matrix_read_csv(std::string &fname, long int *&M, int &m, int &n, int verbose_level)
void Q_epsilon_unrank(int *v, int stride, int epsilon, int k, int c1, int c2, int c3, long int a, int verbose_level)
#define Int_vec_zero(A, B)
#define Int_vec_print_integer_matrix_width(A, B, C, D, E, F)
#define Int_vec_copy(A, B, C)
#define Int_vec_print(A, B, C)
the orbiter library for the classification of combinatorial objects