15#define DONT_DRAW_ROOT_NODE 0
18namespace layer1_foundations {
52 int f_has_color,
int color, std::string &label,
55 int f_v = (verbose_level >= 1);
59 cout <<
"tree_node::init depth=" <<
depth <<
" value=" <<
value << endl;
89 cout <<
"depth " <<
depth <<
" : ";
125 int f_v = (verbose_level >= 1);
128 cout <<
"tree_node::find_node ";
129 cout <<
"my_path = ";
131 cout <<
" value=" <<
value << endl;
135 if (
value == path[0]) {
146 cout <<
"tree_node::find_node did not find node" << endl;
157 int f_v = (verbose_level >= 1);
160 cout <<
"tree_node::find_node_and_path ";
161 cout <<
"my_path = ";
163 cout <<
" value=" <<
value << endl;
167 if (
value == path[0]) {
178 cout <<
"tree_node::find_node_and_path did not find node" << endl;
206 coord_xyw[idx * 3 + 2] =
width;
226 int i, w, w0, w1, lft, rgt;
232 width = right - left;
233 dx = (double)
width / (
double) (w - 1);
239 lft = left + (int)((
double)w0 * dx);
240 rgt = left + (int)((
double)(w0 + w1) * dx);
254 dy = (int)((
double)ymax / (double)(max_depth + 1));
261 x1 = y * cos(x) * xmax * 0.5 + xmax * 0.5;
262 y1 = y * sin(x) * ymax * 0.5 + ymax * 0.5;
271 int depth,
int *path,
int color, std::string &label,
275 int f_v = (verbose_level >= 1);
276 int f_vv = (verbose_level >= 2);
279 cout <<
"tree_node::add_node depth=" <<
depth <<
" : ";
285 cout <<
"tree_node::add_node node of length 0" << endl;
292 cout <<
"tree_node::add_node find_child for " << path[
depth] <<
" returns " << idx << endl;
306 cout <<
"tree_node::add_node nb_children increased to " <<
nb_children << endl;
309 if (l ==
depth + 1) {
311 cout <<
"tree_node::add_node initializing terminal node" << endl;
320 cout <<
"initializing intermediate node" << endl;
329 cout <<
"searching deeper" << endl;
348 int f_v = (verbose_level >= 1);
351 cout <<
"tree_node::get_values" << endl;
352 cout <<
"get_values depth=" <<
depth <<
" value=" <<
value << endl;
359 cout <<
"tree_node::get_values done" << endl;
366 int f_has_parent,
int parent_x,
int parent_y,
int max_depth,
367 tree *T,
int verbose_level)
369 int f_v = (verbose_level >= 1);
372 cout <<
"tree_node::draw_edges" << endl;
381 int f_circle_text =
TRUE;
384 f_circle_text =
FALSE;
388#if DONT_DRAW_ROOT_NODE
394 f_has_draw_vertex_callback, draw_vertex_callback, T);
405 cout <<
"{" << x <<
"," << y <<
"}, // depth " <<
depth <<
" ";
419 cout <<
"tree_node::draw_edges DFS_rank = " << rk << endl;
441 if (Opt->f_edge_labels && char_data) {
442 Px[2] = (x + parent_x) >> 1;
443 Py[2] = (y + parent_y) >> 1;
456 cout <<
"tree_node::draw_edges done" << endl;
463 int f_has_parent,
int parent_x,
int parent_y,
int max_depth,
464 tree *T,
int verbose_level)
466 int f_v = (verbose_level >= 1);
469 cout <<
"tree_node::draw_vertices" << endl;
478#if DONT_DRAW_ROOT_NODE
484 f_has_draw_vertex_callback, draw_vertex_callback, T);
514 cout <<
"tree_node::draw_vertices DFS_rank = " << rk << endl;
532 sprintf(str,
"%d",
value);
539 sprintf(str,
"%d",
value);
546 cout <<
"calling draw_vertex_callback" << endl;
554 cout <<
"{" << x <<
"," << y <<
"}, // depth " <<
depth <<
" ";
598 snprintf(str, 1000,
"%d",
value);
601 snprintf(str, 1000,
" ");
614 cout <<
"tree_node::draw_vertices done" << endl;
620 int f_has_parent,
int parent_x,
int parent_y,
int max_depth,
int f_edge_labels)
628#if DONT_DRAW_ROOT_NODE
635 children[i]->draw(G, f_circletext, f_i,
TRUE, xx, yy, max_depth, f_edge_labels);
648 cout <<
"{" << xx <<
"," << yy <<
"}, // depth " <<
depth <<
" ";
663 if (f_edge_labels &&
label.length()) {
664 Px[2] = (xx + parent_x) >> 1;
665 Py[2] = (yy + parent_y) >> 1;
674 snprintf(str, 1000,
"%d",
value);
677 snprintf(str, 1000,
" ");
695 snprintf(str, 1000,
"%d",
color);
705 dy = (int)((
double)ymax / (double)(max_depth + 1));
706 y = (int)(dy * ((
double)l + 0.5));
options for drawing an object of type layered_graph
a general 2D graphical output interface (metapost, tikz, postscript)
void aligned_text(int x, int y, const char *alignment, const char *p)
void polygon2(int *Px, int *Py, int i1, int i2)
void nice_circle(int x, int y, int rad)
void sf_color(int fill_color)
void circle(int x, int y, int rad)
void sf_interior(int fill_interior)
options for drawing a tree
void(* draw_vertex_callback)(tree *T, mp_graphics *G, int *v, int layer, tree_node *N, int x, int y, int dx, int dy)
int f_has_draw_vertex_callback
part of the data structure tree
void draw_edges(mp_graphics &G, tree_draw_options *Tree_draw_options, layered_graph_draw_options *Opt, int f_has_parent, int parent_x, int parent_y, int max_depth, tree *T, int verbose_level)
void draw_sideways(mp_graphics &G, int f_circletext, int f_i, int f_has_parent, int parent_x, int parent_y, int max_depth, int f_edge_labels)
void get_values(int *v, int verbose_level)
int find_node(int &DFS_rk, int *path, int sz, int verbose_level)
void place_xy(int left, int right, int ymax, int max_depth)
int calc_y_coordinate(int ymax, int l, int max_depth)
void place_on_circle(int xmax, int ymax, int max_depth)
void get_coordinates_and_width(int &idx, int *coord_xyw)
void draw_vertices(mp_graphics &G, tree_draw_options *Tree_draw_options, layered_graph_draw_options *Opt, int f_has_parent, int parent_x, int parent_y, int max_depth, tree *T, int verbose_level)
void add_node(int l, int depth, int *path, int color, std::string &label, int verbose_level)
int find_node_and_path(std::vector< int > &Rk, int *path, int sz, int verbose_level)
void compute_DFS_rank(int &rk)
void init(int depth, tree_node *parent, int f_value, int value, int f_has_color, int color, std::string &label, int verbose_level)
void get_coordinates(int &idx, int *coord_xy)
a data structure for trees
#define Int_vec_print(A, B, C)
the orbiter library for the classification of combinatorial objects
#define DONT_DRAW_ROOT_NODE