109 typedef typename AM::Graph_Type::Arc_Type
Arc_Type;
111 typedef typename AM::Graph_Type
GT;
132 entry = AM::Graph_Type::Arc_Type::Zero_Distance;
144 entry = AM::Graph_Type::Arc_Type::Max_Distance;
148 entry = arc->
get_info().get_distance();
172template <AlephGraph GT,
class Compare,
class Plus>
180 typedef typename GT::Arc_Type::Distance_Type
Dist_Type;
189 for (
int i = 0; i < n; ++i)
190 for (
int s = 0; s < n; ++s)
191 if (dist(s, i) <
max)
192 for (
int t = 0; t < n; ++t)
194 if (!(dist(i, t) <
max))
199 if (Compare () (
new_dist, dist(s, t)))
201 path(s, t) = path(s, i);
209template <AlephGraph GT>
215 using Dist_T =
typename GT::Arc_Type::Distance_Type;
236 using GT =
typename Mat::Graph_Type;
239 GT & g = p.get_list_graph();
269 typename Mat::Node * src_node,
270 typename Mat::Node * tgt_node,
306template <AlephGraph
GT,
class Compare,
class Plus,
307 template <
class>
class P_i,
308 template <
class>
class P_ij,
309 template <
class>
class D_ij>
319 typedef typename GT::Arc_Type::Distance_Type
Dist_Type;
328 output <<
"\\begin{figure}[H]{\\tiny " << std::endl
329 <<
"\\begin{tabular}{ll}" << std::endl
330 <<
"\\begin{tabular}{ll}" << std::endl;
332 (dist, n, n,
output,
"\\hskip -5mm $D_0=$",
"\\\\ ");
333 output <<
"\\end{tabular}" << std::endl
334 <<
" & \\begin{tabular}{ll}" << std::endl;
336 (path, n, n,
output,
"\\hskip -7mm $P_0=$",
"\\\\ ");
337 output <<
"\\end{tabular}" << std::endl
338 <<
"\\end{tabular}" << std::endl
339 <<
"}\\end{figure}" << std::endl;
341 for (
int i = 0; i < n; ++i)
343 for (
int s = 0; s < n; ++s)
344 if (dist(s, i) <
max)
345 for (
int t = 0; t < n; ++t)
347 if (!(dist(i, t) <
max))
352 if (Compare () (
new_dist, dist(s, t)))
354 path(s, t) = path(s, i);
360 snprintf(buf, 256,
"\\hskip -5mm $D_%d=$ ", i + 1);
362 output <<
"\\begin{figure}[H]{\\tiny " << std::endl
363 <<
"\\begin{tabular}{ll}" << std::endl
364 <<
"\\begin{tabular}{ll}" << std::endl;
366 (dist, n, n,
output, buf,
"\\\\ ");
367 output <<
"\\end{tabular}" << std::endl
368 <<
" & \\begin{tabular}{ll}" << std::endl;
370 snprintf(buf, 256,
"\\hskip -7mm $P_%d=$ ", i + 1);
373 (path, n, n,
output, buf,
"\\\\");
374 output <<
"\\end{tabular}" << std::endl
375 <<
"\\end{tabular}" << std::endl
376 <<
"}\\end{figure}" << std::endl;
383template <AlephGraph
GT,
384 template <
class>
class P_i,
385 template <
class>
class P_ij,
386 template <
class>
class D_ij>
393 using Dist_T =
typename GT::Arc_Type::Distance_Type;
C++20 concepts for the protocol shared by graph algorithms.
Standard functor implementations and comparison objects.
WeightedDigraph::Node Node
List_Graph< Graph_Node< Node_Info >, Graph_Arc< Arc_Info > > GT
Auxiliary adjacency matrix with custom entry type.
GT & get_list_graph() noexcept
Get reference to underlying graph.
Graph_Node< Node_Info > 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.
__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.
size_t blossom_maximum_cardinality_matching(const GT &g, DynDlist< typename GT::Arc * > &matching, SA sa=SA())
Alias of compute_maximum_cardinality_general_matching().
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).
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.