28 int num_nodes = graph.
size();
29 vector<int> nodes(num_nodes);
31 std::vector<pair> edges;
32 std::vector<Edge_Cost> weights;
37 auto edge_sets = graph.
GetEdges(cost_type);
41 for (
const auto& edgeset : edge_sets) {
42 const int parent_id = edgeset.parent;
45 for (
const auto& edge : edgeset.children) {
49 int child_id = edge.child;
50 float cost = edge.weight;
52 edges.emplace_back(
pair{ parent_id,child_id });
57 unsigned int max_node = graph.
MaxID() + 1;
60 g =
graph_t(boost::edges_are_unsorted, edges.begin(), edges.end(), weights.begin(), max_node);
62 int n = num_vertices(
g);
Contains definitions for the BoostGraph class.
Contains definitions for the Edge structure.
Contains definitions for the Graph class.
Contains definitions for the Node structure.
Algorithms to find the shortest path between nodes in a HF::SpatialStructures::Graph.
Data stored for every edge in the BoostGraph.
boost::compressed_sparse_row_graph< boost::directedS, vertex_data, Edge_Cost > graph_t
Type of graph held by the BoostGraph.
std::pair< int, int > pair
Shorten std::pair to simplify graph construction.
float weight
Cost of traversing this edge.
std::vector< double > d
Distance array preallocated to the number of nodes in the graph.
graph_t g
The underlying graph in boost.
~BoostGraph()
Explicit Destructor required for BoostGraphDeleter to work in path_finder.h.
BoostGraph(const HF::SpatialStructures::Graph &graph, const std::string &cost_type="")
Create a boost graph from a HF::SpatialStructures::Graph.
std::vector< vertex_descriptor > p
Vertex array preallocated to the number of nodes in the graph.
A Graph of nodes connected by edges that supports both integers and HF::SpatialStructures::Node.
std::vector< EdgeSet > GetEdges() const
Get every in the given graph as IDs.
int size() const
Determine how many nodes are in the graph.
int MaxID() const
Calculate the maximum ID of any node in the graph.
A point in space with an ID.