9# include <gtest/gtest.h>
58 int d =
dial(g, n0, n3, path);
74 int d =
dial(g, n0, n0, path);
90 int d =
dial(g, n0, n1, path);
92 EXPECT_EQ(d, std::numeric_limits<int>::max());
106 int d =
dial(g, n0, n0, path);
128 int d =
dial(g, n0, n3, path);
148 int d =
dial(g, n0, n2, path);
171 int d =
dial(g, n0, n3, path);
236 int d =
dial.get_min_path(n3, path);
317 auto n0 = g.insert_node(0);
318 auto n1 = g.insert_node(1);
319 auto n2 = g.insert_node(2);
321 g.insert_arc(n0, n1, 3);
322 g.insert_arc(n1, n2, 2);
326 int d =
dial(g, n0, n2, path);
337 auto n0 = g.insert_node(0);
338 auto n1 = g.insert_node(1);
340 g.insert_arc(n0, n1, 3);
348 EXPECT_EQ(
dial(g, n1, n0, p2), std::numeric_limits<int>::max());
382 for (
int i = 0; i <
N; ++i)
385 for (
int i = 0; i <
N - 1; ++i)
410 int d =
dial(g, n0, n2, path);
433 int d =
dial(g, n0, n3, path);
469 int d =
dial(g, n0, n3, path);
490 int d =
dial(g, n0, n2, path);
512 dial.paint_min_paths_tree(g, n0);
556 int d =
dial(g, n0, n1, path);
617 int dist =
dial(g, a, e, path);
632 for (
int i = 0; i <
N; ++i)
636 for (
int i = 0; i <
N - 1; ++i)
640 for (
int i = 0; i <
N - 3; i += 3)
646 for (
int end = 1; end <
N; end += 3)
721 for (GT::Arc_Iterator it(g); it.has_curr(); it.next())
Dial's algorithm for shortest paths with small integer weights.
Dijkstra's shortest path algorithm.
WeightedDigraph::Node Node
static Array create(size_t n)
Create an array with n logical elements.
Dial's algorithm for shortest paths with integer weights.
void paint_min_paths_tree(const GT &g, Node *start)
Paints the shortest paths tree on the graph from start.
Generic directed graph (digraph) wrapper template.
typename BaseGraph::Arc Arc
typename BaseGraph::Node Node
Spanning tree calculation of all shortest paths from a given node according to Dijkstra's algorithm.
bool has_curr() const noexcept
Return true if the iterator has current item.
Dynamic singly linked list with functional programming support.
T & append(const T &item)
virtual Node * insert_node(Node *node) noexcept
Insertion of a node already allocated.
Graph_Node< int > Node
The graph type.
Graph_Arc< int > Arc
The node class type.
Arc * insert_arc(Node *src_node, Node *tgt_node, void *a)
Iterator on nodes and arcs of a path.
bool is_empty() const noexcept
Return true if the path is empty.
DynArray< Graph::Node * > nodes
#define IS_NODE_VISITED(p, bit)
Determine whether the control bit is set or not to one.
#define NODE_COOKIE(p)
Return the node cookie
#define IS_ARC_VISITED(p, bit)
Determine whether the bit field is or not set to one.
Main namespace for Aleph-w library functions.
Divide_Conquer_DP_Result< Cost > divide_and_conquer_partition_dp(const size_t groups, const size_t n, Transition_Cost_Fn transition_cost, const Cost inf=dp_optimization_detail::default_inf< Cost >())
Optimize partition DP using divide-and-conquer optimization.
Arc of graph implemented with double-linked adjacency lists.
Distance_Type operator()(Arc *arc) const noexcept
Generic graph and digraph implementations.