24 #ifndef INCLUDE_BREADTHFIRSTSEARCH_PGR_BREADTHFIRSTSEARCH_HPP_
25 #define INCLUDE_BREADTHFIRSTSEARCH_PGR_BREADTHFIRSTSEARCH_HPP_
30 #include <boost/graph/breadth_first_search.hpp>
46 typedef typename G::B_G
B_G;
51 std::vector<int64_t> start_vertex,
53 std::vector<pgr_mst_rt> results;
56 for (
auto source : start_vertex) {
57 std::vector<E> visited_order;
59 if (graph.has_vertex(source)) {
60 results.push_back({source, 0, source, -1, 0.0, 0.0});
61 boost::breadth_first_search(graph.graph,
63 visitor(bfs_visitor(visited_order)));
65 auto single_source_results =
get_results(visited_order, source, depth, graph);
66 results.insert(results.end(), single_source_results.begin(), single_source_results.end());
69 CHECK_FOR_INTERRUPTS();
82 std::vector<pgr_mst_rt> results;
84 std::vector<double> agg_cost(graph.num_vertices(), 0);
85 std::vector<int64_t> depth(graph.num_vertices(), 0);
87 for (
const auto edge : order) {
88 auto u = graph.source(
edge);
89 auto v = graph.target(
edge);
91 agg_cost[v] = agg_cost[u] + graph[
edge].cost;
92 depth[v] = depth[u] + 1;
94 if (max_depth >= depth[v]) {
111 #endif // INCLUDE_BREADTHFIRSTSEARCH_PGR_BREADTHFIRSTSEARCH_HPP_