PGROUTING  3.2
details.cpp
Go to the documentation of this file.
1 /*PGR-GNU*****************************************************************
2 File: details.hpp
3 
4 Copyright (c) 2018 Vicky Vergara
5 
6 
7 ------
8 
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
13 
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18 
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 
23  ********************************************************************PGR-GNU*/
24 
25 #include "spanningTree/details.hpp"
26 #include <vector>
27 #include <algorithm>
28 
29 namespace pgrouting {
30 namespace details {
31 
32 std::vector<int64_t>
33 clean_vids(std::vector<int64_t> vids) {
34  std::sort(vids.begin(), vids.end());
35  vids.erase(
36  std::unique(vids.begin(), vids.end()),
37  vids.end());
38  vids.erase(
39  std::remove(vids.begin(), vids.end(), 0),
40  vids.end());
41  return vids;
42 }
43 
44 std::vector<pgr_mst_rt>
46  std::vector<int64_t> vids) {
47  std::vector<pgr_mst_rt> results;
48  if (vids.empty()) return results;
49  for (auto const root : clean_vids(vids)) {
50  results.push_back({root, 0, root, -1, 0.0, 0.0});
51  }
52  return results;
53 }
54 
55 } // namespace details
56 } // namespace pgrouting
pgrouting::details::clean_vids
std::vector< int64_t > clean_vids(std::vector< int64_t > vids)
Definition: details.cpp:33
pgrouting::details::get_no_edge_graph_result
std::vector< pgr_mst_rt > get_no_edge_graph_result(std::vector< int64_t > vids)
Definition: details.cpp:45
details.hpp
pgrouting
Book keeping class for swapping orders between vehicles.
Definition: pgr_alphaShape.cpp:56