49 template <
class Graph>
58 template <
class Graph>
65 a->get_info() =
is_diagonal ? std::numbers::sqrt2 : 1.0;
70 cout <<
"========================================" <<
endl;
71 cout <<
" Grid Graph Generation Example" <<
endl;
72 cout <<
"========================================" <<
endl;
80 const size_t rows = 4;
81 const size_t cols = 4;
83 cout <<
"\nBuilding a " <<
rows <<
" x " <<
cols <<
" grid..." <<
endl;
87 cout <<
"Grid successfully built!" <<
endl;
91 cout <<
"\nSample of connections from the bottom-right node (" <<
rows-1 <<
", " <<
cols-1 <<
"):" <<
endl;
95 for (
auto it = g.
get_node_it(); it.has_curr(); it.next()) {
96 auto n = it.get_curr();
97 if (n->get_info().row ==
rows - 1
and n->get_info().col ==
cols - 1) {
108 auto a = it.get_curr();
110 cout <<
" -> Connected to node (" << tgt->get_info().row <<
", " << tgt->get_info().col
111 <<
") with weight " << a->get_info() <<
endl;
115 cout <<
"\n========================================" <<
endl;
WeightedDigraph::Node Node
Functor to build a 2D grid graph with 8-connectivity.
Arc Arc
The node class type.
bool has_curr() const noexcept
Return true is the iterator has a current arc.
Node * get_src_node(Arc *arc) const noexcept
Return the source node of arc (only for directed graphs)
Out_Iterator get_out_it(Node *p) const noexcept
Return an output iterator on the incoming nodes to p
constexpr size_t get_num_nodes() const noexcept
Return the total of nodes of graph.
constexpr size_t get_num_arcs() const noexcept
auto get_node_it() const noexcept
Obtains an iterator to the nodes of graph.
Node * get_tgt_node(Arc *arc) const noexcept
Return the target node of arc (only for directed graphs)
2D grid graph generation with 8-connectivity.
size_t blossom_maximum_cardinality_matching(const GT &g, DynDlist< typename GT::Arc * > &matching, SA sa=SA())
Alias of compute_maximum_cardinality_general_matching().
Main namespace for Aleph-w library functions.
and
Check uniqueness with explicit hash + equality functors.
Arc of graph implemented with double-linked adjacency lists.
Coordinate(size_t r, size_t c)
void operator()(Graph &g, typename Graph::Arc *a, size_t, size_t)
void operator()(Graph &, typename Graph::Node *n, size_t r, size_t c)
Generic graph and digraph implementations.
Treap< int >::Node * last_node