aGrUM 3.2.0
a C++ library for (probabilistic) graphical models
gum::graph::detail Namespace Reference

Functions

std::vector< NodeId > reconstructPath (const NodeProperty< NodeId > &mark, NodeId n1, NodeId n2)
 Reconstruct the BFS path [n1 … n2] from the predecessor mark table.

Function Documentation

◆ reconstructPath()

std::vector< NodeId > gum::graph::detail::reconstructPath ( const NodeProperty< NodeId > & mark,
NodeId n1,
NodeId n2 )
inline

Reconstruct the BFS path [n1 … n2] from the predecessor mark table.

Definition at line 50 of file pathFinding_tpl.h.

50 {
51 std::vector< NodeId > v;
52 NodeId cur = n1;
53 while (cur != n2) {
54 v.push_back(cur);
55 if (!mark.exists(cur))
56 GUM_ERROR(NotFound, "reconstructPath: no BFS predecessor for node " << cur)
57 cur = mark[cur];
58 }
59 v.push_back(n2);
60 return v;
61 }
bool exists(const Key &key) const
Checks whether there exists an element with a given key in the hashtable.
Exception : the element we looked for cannot be found.
#define GUM_ERROR(type, msg)
Definition exceptions.h:76
Size NodeId
Type for node ids.

References gum::HashTable< Key, Val >::exists(), GUM_ERROR, and reconstructPath().

Referenced by gum::graph::directedPath(), gum::graph::directedUnorientedPath(), gum::graph::mixedOrientedPath(), gum::graph::mixedUnorientedPath(), reconstructPath(), and gum::graph::undirectedPath().

Here is the call graph for this function:
Here is the caller graph for this function: