107 typedef typename AM::Graph_Type::Arc_Type
Arc_Type;
109 typedef typename AM::Graph_Type
GT;
130 entry = AM::Graph_Type::Arc_Type::Zero_Distance;
142 entry = AM::Graph_Type::Arc_Type::Max_Distance;
146 entry = arc->
get_info().get_distance();
170template <
class GT,
class Compare,
class Plus>
178 typedef typename GT::Arc_Type::Distance_Type
Dist_Type;
187 for (
int i = 0; i < n; ++i)
188 for (
int s = 0; s < n; ++s)
189 if (dist(s, i) <
max)
190 for (
int t = 0; t < n; ++t)
192 if (!(dist(i, t) <
max))
197 if (Compare () (
new_dist, dist(s, t)))
199 path(s, t) = path(s, i);
213 using Dist_T =
typename GT::Arc_Type::Distance_Type;
234 using GT =
typename Mat::Graph_Type;
237 GT & g = p.get_list_graph();
267 typename Mat::Node * src_node,
268 typename Mat::Node * tgt_node,
304template <
class GT,
class Compare,
class Plus,
305 template <
class>
class P_i,
306 template <
class>
class P_ij,
307 template <
class>
class D_ij>
317 typedef typename GT::Arc_Type::Distance_Type
Dist_Type;
326 output <<
"\\begin{figure}[H]{\\tiny " << std::endl
327 <<
"\\begin{tabular}{ll}" << std::endl
328 <<
"\\begin{tabular}{ll}" << std::endl;
330 (dist, n, n,
output,
"\\hskip -5mm $D_0=$",
"\\\\ ");
331 output <<
"\\end{tabular}" << std::endl
332 <<
" & \\begin{tabular}{ll}" << std::endl;
334 (path, n, n,
output,
"\\hskip -7mm $P_0=$",
"\\\\ ");
335 output <<
"\\end{tabular}" << std::endl
336 <<
"\\end{tabular}" << std::endl
337 <<
"}\\end{figure}" << std::endl;
339 for (
int i = 0; i < n; ++i)
341 for (
int s = 0; s < n; ++s)
342 if (dist(s, i) <
max)
343 for (
int t = 0; t < n; ++t)
345 if (!(dist(i, t) <
max))
350 if (Compare () (
new_dist, dist(s, t)))
352 path(s, t) = path(s, i);
358 snprintf(
buf, 256,
"\\hskip -5mm $D_%d=$ ", i + 1);
360 output <<
"\\begin{figure}[H]{\\tiny " << std::endl
361 <<
"\\begin{tabular}{ll}" << std::endl
362 <<
"\\begin{tabular}{ll}" << std::endl;
365 output <<
"\\end{tabular}" << std::endl
366 <<
" & \\begin{tabular}{ll}" << std::endl;
368 snprintf(
buf, 256,
"\\hskip -7mm $P_%d=$ ", i + 1);
372 output <<
"\\end{tabular}" << std::endl
373 <<
"\\end{tabular}" << std::endl
374 <<
"}\\end{figure}" << std::endl;
382 template <
class>
class P_i,
383 template <
class>
class P_ij,
384 template <
class>
class D_ij>
391 using Dist_T =
typename GT::Arc_Type::Distance_Type;
Standard functor implementations and comparison objects.
WeightedDigraph::Node Node
Auxiliary adjacency matrix with custom entry type.
GT & get_list_graph() noexcept
Get reference to underlying graph.
Graph_Node< int > Node
The graph type.
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.
ArcInfo & get_info() noexcept
Return a modifiable reference to the arc data.
constexpr size_t get_num_nodes() const noexcept
Return the total of nodes of graph.
List_Graph< Graph_Node< int >, Graph_Arc< int > > GT
__gmp_expr< typename __gmp_resolve_expr< T, V >::value_type, __gmp_binary_expr< __gmp_expr< T, U >, __gmp_expr< V, W >, __gmp_max_function > > max(const __gmp_expr< T, U > &expr1, const __gmp_expr< V, W > &expr2)
void floyd_all_shortest_paths_latex(GT &g, Ady_Mat< GT, typename GT::Arc_Type::Distance_Type > &dist, Ady_Mat< GT, long > &path, std::ofstream &output)
Floyd-Warshall algorithm with LaTeX step-by-step output.
void find_min_path(Mat &p, const long src_index, const long tgt_index, Path< typename Mat::Graph_Type > &path)
This is an overloaded member function, provided for convenience. It differs from the above function o...
void floyd_all_shortest_paths(GT &g, Ady_Mat< GT, typename GT::Arc_Type::Distance_Type > &dist, Ady_Mat< GT, long > &path)
Compute all-pairs shortest paths using Floyd-Warshall algorithm.
GT::Arc * search_arc(const GT &g, typename GT::Node *src, typename GT::Node *tgt, SA sa=SA()) noexcept
Arc filtered searching given two nodes.
Matrix to LaTeX table conversion utilities.
Main namespace for Aleph-w library functions.
void next()
Advance all underlying iterators (bounds-checked).
DynList< T > maps(const C &c, Op op)
Classic map operation.
Arc of graph implemented with double-linked adjacency lists.
Matrix initialization functor for Floyd-Warshall.
AM::Arc_Type::Distance_Type Distance_Type
AM::Graph_Type::Arc_Type Arc_Type
void operator()(AM &mat, Node *src, Node *tgt, const long &i, const long &j, Distance_Type &entry, void *p)
Adjacency matrix representations for graphs.