9# include <gtest/gtest.h>
55 double d =
ida(g, n0, n3, path);
71 double d =
ida(g, n0, n0, path);
87 double d =
ida(g, n0, n1, path);
89 EXPECT_EQ(d, std::numeric_limits<double>::max());
103 double d =
ida(g, n0, n0, path);
125 double d =
ida(g, n0, n3, path);
143 double d =
ida(g, n0, n1, path);
170 auto t =
g_neg.insert_node(2);
171 g_neg.insert_arc(s, t, -1.0);
191 double d =
ida(g, n0, n1, path);
275 double d =
ida(g, n0, n3, path);
298 double d =
ida(g, n0, n3, path);
320 int d =
ida(g, n0, n2, path);
341 double d1 =
ida(g, n0, n2, p1);
345 double d2 =
ida(g, n2, n0, p2);
367 double d =
ida(g, n0, n3, path);
398 double d =
ida(g, n0, n2, path);
418 double d =
ida(g, n0, n2, path);
429 auto n0 = g.insert_node(0);
430 auto n1 = g.insert_node(1);
431 auto n2 = g.insert_node(2);
433 g.insert_arc(n0, n1, 1.0);
434 g.insert_arc(n1, n2, 1.0);
438 double d =
ida(g, n0, n2, path);
449 auto n0 = g.insert_node(0);
450 auto n1 = g.insert_node(1);
452 g.insert_arc(n0, n1, 1.0);
456 double d =
ida(g, n1, n0, p);
458 EXPECT_EQ(d, std::numeric_limits<double>::max());
480 double d =
ida(g, n1, n4, path);
502 double d =
ida(g, n0, n3, path);
504 EXPECT_EQ(d, std::numeric_limits<double>::max());
517 for (
int i = 0; i <
N; ++i)
520 for (
int i = 0; i <
N - 1; ++i)
530 for (
int end = 1; end <
N; end += 2)
575 double d =
ida(g, n0, n5, path);
595 double d =
ida(g, n0, n1, path);
607 struct Coord {
int x;
int y; };
612 auto n1 = g.insert_node(
Coord{0, 0});
613 auto n2 = g.insert_node(
Coord{3, 5});
A* shortest path algorithm.
Dijkstra's shortest path algorithm.
IDA* (Iterative Deepening A*) shortest path algorithm.
WeightedDigraph::Node Node
A* algorithm for finding the shortest path between two nodes.
static Array create(size_t n)
Create an array with n logical elements.
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)
IDA* algorithm for memory-efficient shortest path search.
virtual Node * insert_node(Node *node) noexcept
Insertion of a node already allocated.
Graph_Node< int > Node
The graph type.
Graph_Arc< double > 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
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.
Chebyshev (L-infinity) distance heuristic for 8-connected grids.
Arc of graph implemented with double-linked adjacency lists.
Default heuristic for A* (zero heuristic, degrades to Dijkstra).
Generic graph and digraph implementations.