30 # include <ahFunction.H> 31 # include <tpl_agraph.H> 32 # include <tpl_graph_utils.H> 33 # include <tpl_test_acyclique.H> 34 # include <tpl_union.H> 36 using namespace Aleph;
95 noexcept(
std::is_nothrow_move_assignable<Distance>::value and
96 std::is_nothrow_move_assignable<SA>::value)
97 : dist(__dist), sa(__sa), painted(false)
103 noexcept(std::is_nothrow_copy_assignable<Distance>::value and
104 std::is_nothrow_copy_assignable<SA>::value)
105 : dist(__dist), sa(__sa), painted(
false)
113 template <
class G,
class GT_SA>
119 noexcept(std::is_nothrow_copy_assignable<SA>::value)
122 bool operator () (
typename G::Arc * a)
const noexcept
137 Init_Node() noexcept : count(0) { }
139 void operator () (
const GT &,
typename GT::Node * p) noexcept
142 NODE_BITS(p).set_bit(Aleph::Spanning_Tree,
false);
146 static bool arc_is_in_tree(
Fixed_Relation & tree,
long i,
long j) noexcept
153 void paint_min_spanning_tree(
const GT & g)
156 throw std::domain_error(
"g is a digraph");
158 g.reset_bit_arcs(Aleph::Spanning_Tree);
163 const_cast<GT&
>(g).
template sort_arcs<DCMP>(comp);
164 const size_t V = g.get_num_nodes();
171 it.has_curr(); it.next_ne())
173 auto arc = it.get_current_arc_ne();
176 if (arc_is_in_tree(tree, i, j))
180 ARC_BITS(arc).set_bit(Aleph::Spanning_Tree,
true);
186 void paint_min_spanning_tree(
const GT & g, GT & tree)
188 paint_min_spanning_tree(g);
191 for (
typename GT::Node_Iterator it(g); it.has_curr(); it.next_ne())
193 auto gp = it.get_curr_ne();
194 auto tp = tree.insert_node(gp->get_info());
201 auto ga = it.get_current_arc_ne();
202 auto tsrc = mapped_node<GT>(g.get_src_node(ga));
203 auto ttgt = mapped_node<GT>(g.get_tgt_node(ga));
204 auto ta = tree.insert_arc(tsrc, ttgt, ga->get_info());
222 void operator () (
const GT & g, GT & tree)
224 paint_min_spanning_tree(g, tree);
238 void operator () (
const GT & g)
240 paint_min_spanning_tree(g);
void clear_graph(GT &g) noexcept
Definition: tpl_graph.H:3463
Definition: tpl_graph.H:1225
Definition: tpl_graph.H:2493
Definition: tpl_graph_utils.H:1618
Definition: tpl_union.H:52
#define NODE_COUNTER(p)
Definition: aleph-graph.H:311
void join(size_t i, size_t j) noexcept
Definition: tpl_union.H:139
void map_arcs(typename GTS::Arc *p, typename GTT::Arc *q) noexcept
Definition: tpl_graph.H:3445
size_t get_num_blocks() const noexcept
Definition: tpl_union.H:114
#define IS_ARC_VISITED(p, bit)
Definition: aleph-graph.H:360
void map_nodes(typename GTS::Node *p, typename GTT::Node *q) noexcept
Definition: tpl_graph.H:3419
bool are_connected(size_t i, size_t j) noexcept
Definition: tpl_union.H:128
Definition: tpl_graph.H:1063
#define NODE_BITS(p)
Definition: aleph-graph.H:305
Definition: tpl_graph_utils.H:1753
Filtro de arcos pintados por el algoritmo de Kruskal.
Definition: Kruskal.H:114
Kruskal_Min_Spanning_Tree(Distance &&__dist=Distance(), SA __sa=SA()) noexcept(std::is_nothrow_move_assignable< Distance >::value and std::is_nothrow_move_assignable< SA >::value)
Definition: Kruskal.H:93
#define ARC_BITS(p)
Definition: aleph-graph.H:351