93namespace mat_path_detail
97 template <
class GT,
class Compare>
101 -> std::convertible_to<bool>;
107 template <
class GT,
class Compare>
120 typename GT::Arc * lightest =
nullptr;
121 for (
typename GT::Node_Arc_Iterator it(src); it.has_curr(); it.next_ne())
122 if (it.get_tgt_node_ne() == tgt
and
123 (lightest ==
nullptr or
124 Compare () (it.get_current_arc_ne()->get_info().get_distance(),
125 lightest->
get_info().get_distance())))
126 lightest = it.get_current_arc_ne();
129 <<
"find_min_path(): there is no arc between two nodes of the path";
190template <
class Mat,
class Compare = std::less<>>
194 using GT =
typename Mat::Graph_Type;
195 GT & g = p.get_list_graph();
198 if (src_idx == tgt_idx)
205 typename GT::Node * src = p(src_idx);
209 for (
long i = src_idx, j = p(i, tgt_idx); ; i = j, j = p(i, tgt_idx))
211 mat_path_detail::append_node<GT, Compare>(g, path, p(j));
227template <
class Mat,
class Compare = std::less<>>
229 typename Mat::Node * src_node,
230 typename Mat::Node * tgt_node,
233 find_min_path<Mat, Compare>(p, p(src_node), p(tgt_node), path);
254template <
class Mat,
class Compare = std::less<>>
262 typename Mat::Node * src_node,
263 typename Mat::Node * tgt_node,
266 find_min_path<Mat, Compare>(p, src_node, tgt_node, path);
273 long src_index,
long tgt_index,
276 find_min_path<Mat, Compare>(p, src_index, tgt_index, path);
#define ah_invalid_argument_if(C)
Throws std::invalid_argument if condition holds.
Functor wrapper for find_min_path.
void operator()(Mat &p, typename Mat::Node *src_node, typename Mat::Node *tgt_node, Path< typename Mat::Graph_Type > &path) const
Reconstruct path using node pointers.
void operator()(Mat &p, long src_index, long tgt_index, Path< typename Mat::Graph_Type > &path) const
Reconstruct path using matrix indices.
void set_graph(const GT &__g, Node *start_node=nullptr)
Set the graph of the path.
void append(Arc *arc)
Append an arc to the path.
Node * get_last_node() const
Return the last node of path; throws overflow_error if path is empty.
ArcInfo & get_info() noexcept
Return a modifiable reference to the arc data.
size_t num_arcs
data associated to the node. Access it with get_info()
bool is_digraph() const noexcept
Return true if the graph this is directed.
Whether the arcs of GT give their weights by get_info().get_distance(), and Compare compares them.
int cmp(const __gmp_expr< T, U > &expr1, const __gmp_expr< V, W > &expr2)
void find_min_path(Mat &p, long src_idx, long tgt_idx, Path< typename Mat::Graph_Type > &path)
Build a minimum path from Floyd-Warshall path matrix using indices.
void append_node(GT &g, Path< GT > &path, typename GT::Node *node)
Main namespace for Aleph-w library functions.
and
Check uniqueness with explicit hash + equality functors.
Adjacency matrix representations for graphs.