PGROUTING  3.2
componentsResult.cpp
Go to the documentation of this file.
1 /*PGR-GNU*****************************************************************
2 
3 Copyright (c) 2015 pgRouting developers
5 
6 Copyright (c) 2017 Maoguang Wang
8 
9 ------
10 
11 This program is free software; you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation; either version 2 of the License, or
14 (at your option) any later version.
15 
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details.
20 
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software
23 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 
25  ********************************************************************PGR-GNU*/
26 
28 
29 #include <vector>
30 #include <algorithm>
31 
32 namespace pgrouting {
33 namespace algorithms {
34 
35 namespace detail {
36 
37 std::vector<pgr_components_rt>
39  std::vector< std::vector< int64_t > > &components) {
40  // sort identifier
41  for (auto &component : components) {
42  std::sort(component.begin(), component.end());
43  }
44  sort(components.begin(), components.end());
45 
46  // generate results
47  std::vector< pgr_components_rt > results;
48  for (const auto& component : components) {
49  auto component_id = component[0];
50  for (const auto element : component) {
51  results.push_back({component_id, element});
52  }
53  }
54  return results;
55 }
56 
57 } // namespace detail
58 
59 } // namespace algorithms
60 } // namespace pgrouting
detail
Definition: dijkstra_driver.cpp:48
componentsResult.h
pgrouting::algorithms::detail::componentsResult
std::vector< pgr_components_rt > componentsResult(std::vector< std::vector< int64_t > > &components)
Definition: componentsResult.cpp:38
pgrouting
Book keeping class for swapping orders between vehicles.
Definition: pgr_alphaShape.cpp:56