88 nodes.reserve(s.num_nodes);
89 for (
size_t i = 0; i < s.num_nodes; ++i)
94 const Edge & e = it.get_curr();
138 cout << title <<
'\n';
142 const auto & item = it.get_curr();
143 cout << std::format(
" #{} cost={} path={}\n",
147 cout <<
" (no path found)\n";
165 scenario.num_nodes = 8;
169 scenario.edges.reserve(8);
170 scenario.edges.append(
Edge{0, 1, 1});
171 scenario.edges.append(
Edge{1, 2, 1});
172 scenario.edges.append(
Edge{2, 7, 1});
173 scenario.edges.append(
Edge{0, 3, 2});
174 scenario.edges.append(
Edge{3, 4, 2});
175 scenario.edges.append(
Edge{4, 7, 2});
176 scenario.edges.append(
Edge{2, 5, 1});
177 scenario.edges.append(
Edge{5, 2, 1});
182 auto * source =
nodes[scenario.source];
183 auto * target =
nodes[scenario.target];
185 cout << std::format(
"K shortest paths in Aleph graphs\n");
186 cout << std::format(
"source={}, target={}, k={}\n\n",
187 scenario.source, scenario.target, scenario.k);
K-shortest path algorithms (Yen and Eppstein-style API).
size_t size_t int32_t * out
Simple dynamic array with automatic resizing and functional operations.
Generic directed graph (digraph) wrapper template.
Iterator on the items of list.
Doubly-linked list (defined in tpl_dynList.H).
bool has_curr() const noexcept
virtual Node * insert_node(Node *node) noexcept
Insertion of a node already allocated.
Arc * insert_arc(Node *src_node, Node *tgt_node, void *a)
Iterator on nodes and arcs of a path.
bool has_current_node() const noexcept
Return true if the iterator has a current node.
DynArray< Graph::Node * > nodes
size_t blossom_maximum_cardinality_matching(const GT &g, DynDlist< typename GT::Arc * > &matching, SA sa=SA())
Alias of compute_maximum_cardinality_general_matching().
int main()
Runs a sample demonstration computing K shortest paths using two APIs and prints their results.
Main namespace for Aleph-w library functions.
std::string to_string(const time_t t, const std::string &format)
Format a time_t value into a string using format.
Iterator on the items of an array.
Arc of graph implemented with double-linked adjacency lists.
A shortest-path item returned by k-shortest algorithms.
Dynamic array container with automatic resizing.
Generic graph and digraph implementations.