10 void operator () (GT &,
typename GT::Node *,
const size_t &,
const size_t &) { }
16 void operator () (GT &,
typename GT::Arc *,
const size_t &,
const size_t &) { }
31 void operator () (GT & g,
const size_t & width,
const size_t & height)
33 if (g.get_num_nodes() != 0)
34 throw std::domain_error(
"There is nodes in graph");
36 if (width < 2 or height < 2)
37 throw std::length_error(
"The minimun size must be 2 x 2");
39 typename GT::Node ***
map =
new typename GT::Node **[height];
40 for (
size_t i = 0; i < height; ++i)
44 map[i] =
new typename GT::Node *[width];
45 for (
size_t j = 0; j < width; ++j)
47 typename GT::Node * n = g.insert_node(
typename GT::Node_Type());
48 Operation_On_Node()(g, n, i, j);
52 typename GT::Arc * a = g.insert_arc(n, map[i][j - 1]);
53 Operation_On_Arc()(g, a, i, j);
57 typename GT::Arc * a = g.insert_arc(n, map[i - 1][j]);
58 Operation_On_Arc()(g, a, i, j);
62 typename GT::Arc * a = g.insert_arc(n, map[i - 1][j - 1]);
63 Operation_On_Arc()(g, a, i, j);
65 if (j + 1 < width and i > 0)
67 typename GT::Arc * a = g.insert_arc(n, map[i - 1][j + 1]);
68 Operation_On_Arc()(g, a, i, j);
74 for (
size_t k = i - 1; k >= 0; --k)
82 for (
size_t i = 0; i < height; ++i)
void clear_graph(GT &g)
Definition: tpl_graph.H:2486