PGROUTING  3.1
pgrouting Namespace Reference

Book keeping class for swapping orders between vehicles. More...

Namespaces

 algorithms
 
 alphashape
 
 bidirectional
 
 contraction
 
 details
 
 flow
 
 functions
 
 graph
 boost::graph simplified to pgRouting needs This class gives the handling basics of a boost::graph of kind G where G: can be an undirected graph or a directed graph.
 
 trsp
 
 tsp
 
 visitors
 
 vrp
 
 yen
 

Classes

class  Basic_edge
 
class  Basic_vertex
 
class  CH_edge
 
class  CH_vertex
 
class  compPathsLess
 Compares 2 paths for <. More...
 
struct  found_goals
 exception for visitor termination More...
 
class  Identifier
 
class  Line_vertex
 
class  Pg_points_graph
 
class  Pgr_dijkstra
 
class  Pgr_messages
 
class  XY_vertex
 

Typedefs

typedef boost::adjacency_list< boost::listS, boost::vecS, boost::directedS > BasicDirectedGraph
 
typedef boost::adjacency_list< boost::listS, boost::vecS, boost::undirectedS > BasicUndirectedGraph
 
using Bline = bg::model::linestring< Bpoint >
 
using Blines = bg::model::multi_linestring< Bline >
 
using Bpoint = bg::model::d2::point_xy< double >
 
using Bpoints = bg::model::multi_point< Bpoint >
 
using Bpoly = bg::model::polygon< Bpoint >
 
using Bpolys = bg::model::multi_polygon< Bpoly >
 
typedef boost::property_map< CostFlowGraph, boost::edge_capacity_t >::type Capacity
 
typedef boost::adjacency_list< boost::vecS, boost::vecS, boost::directedS, boost::no_property, boost::property< boost::edge_capacity_t, double, boost::property< boost::edge_residual_capacity_t, double, boost::property< boost::edge_reverse_t, Traits::edge_descriptor, boost::property< boost::edge_weight_t, double > > > > > CostFlowGraph
 
typedef boost::adjacency_list< boost::listS, boost::vecS, boost::directedS, boost::property< boost::vertex_index_t, int64_t, boost::property< boost::vertex_color_t, boost::default_color_type, boost::property< boost::vertex_distance_t, int64_t, boost::property< boost::vertex_predecessor_t, Traits::edge_descriptor > > > >, boost::property< boost::edge_capacity_t, int64_t, boost::property< boost::edge_residual_capacity_t, int64_t, boost::property< boost::edge_reverse_t, Traits::edge_descriptor > > > > FlowGraph
 
typedef boost::adjacency_list< boost::vecS, boost::vecS, boost::bidirectionalS, Line_vertex, Basic_edgeLinearDirectedGraph
 Data type to handle graph -> lineGaph transformation. More...
 
typedef boost::property_map< CostFlowGraph, boost::edge_residual_capacity_t >::type ResidualCapacity
 
typedef boost::property_map< CostFlowGraph, boost::edge_reverse_t >::type Reversed
 
typedef boost::adjacency_list_traits< boost::vecS, boost::vecS, boost::directedS > Traits
 
typedef boost::property_map< CostFlowGraph, boost::edge_weight_t >::type Weight
 
Graph types
Type pgRouting
UndirectedGraph Basic undirected graph
DirectedGraph Basic directed graph
xyUndirectedGraph X & Y values stored on the vertex
xyDirectedGraph X & Y values stored on the vertex
typedef graph::Pgr_base_graph< boost::adjacency_list< boost::vecS, boost::vecS, boost::undirectedS, Basic_vertex, Basic_edge >, Basic_vertex, Basic_edgeUndirectedGraph
 
typedef graph::Pgr_base_graph< boost::adjacency_list< boost::vecS, boost::vecS, boost::bidirectionalS, Basic_vertex, Basic_edge >, Basic_vertex, Basic_edgeDirectedGraph
 
typedef graph::Pgr_base_graph< boost::adjacency_list< boost::listS, boost::vecS, boost::undirectedS, XY_vertex, Basic_edge >, XY_vertex, Basic_edgexyUndirectedGraph
 
typedef graph::Pgr_base_graph< boost::adjacency_list< boost::listS, boost::vecS, boost::bidirectionalS, XY_vertex, Basic_edge >, XY_vertex, Basic_edgexyDirectedGraph
 

Functions

size_t check_vertices (std::vector< Basic_vertex > vertices)
 
size_t check_vertices (std::vector< CH_vertex > vertices)
 
size_t check_vertices (std::vector< XY_vertex > vertices)
 
std::vector< Basic_vertexextract_vertices (std::vector< Basic_vertex > vertices, const std::vector< pgr_edge_t > data_edges)
 
std::vector< Basic_vertexextract_vertices (std::vector< Basic_vertex > vertices, const pgr_edge_t *data_edges, int64_t count)
 
std::vector< XY_vertexextract_vertices (const std::vector< Pgr_edge_xy_t > &data_edges)
 
std::vector< Basic_vertexextract_vertices (const std::vector< pgr_edge_t > &data_edges)
 
std::vector< XY_vertexextract_vertices (const Pgr_edge_xy_t *data_edges, int64_t count)
 
std::vector< Basic_vertexextract_vertices (const pgr_edge_t *data_edges, int64_t count)
 
std::vector< Basic_vertexextract_vertices (const std::vector< Basic_vertex > &vertices, const pgr_edge_t *data_edges, int64_t count)
 
std::ostream & operator<< (std::ostream &log, const Basic_vertex &v)
 
std::ostream & operator<< (std::ostream &os, const Pg_points_graph &g)
 
std::ostream & operator<< (std::ostream &log, const Identifier &ident)
 
std::ostream & operator<< (std::ostream &log, const XY_vertex &v)
 
std::ostream & operator<< (std::ostream &os, const CH_vertex &v)
 
std::ostream & operator<< (std::ostream &os, const CH_edge &e)
 
template<class G >
Path pgr_dijkstra (G &graph, int64_t source, int64_t target, bool only_cost=false)
 
template<class G >
std::deque< Pathpgr_drivingDistance (G &graph, std::vector< int64_t > start_vids, double distance, bool equicost, std::ostringstream &log)
 

Detailed Description

Book keeping class for swapping orders between vehicles.

Typedef Documentation

◆ BasicDirectedGraph

typedef boost::adjacency_list<boost::listS, boost::vecS, boost::directedS> pgrouting::BasicDirectedGraph

Definition at line 50 of file pgr_maximumcardinalitymatching.hpp.

◆ BasicUndirectedGraph

typedef boost::adjacency_list<boost::listS, boost::vecS, boost::undirectedS> pgrouting::BasicUndirectedGraph

Definition at line 48 of file pgr_maximumcardinalitymatching.hpp.

◆ Bline

using pgrouting::Bline = typedef bg::model::linestring<Bpoint>

Definition at line 51 of file bline.hpp.

◆ Blines

using pgrouting::Blines = typedef bg::model::multi_linestring<Bline>

Definition at line 52 of file bline.hpp.

◆ Bpoint

typedef bg::model::d2::point_xy< double > pgrouting::Bpoint

Definition at line 48 of file bline.hpp.

◆ Bpoints

using pgrouting::Bpoints = typedef bg::model::multi_point<Bpoint>

Definition at line 49 of file bline.hpp.

◆ Bpoly

using pgrouting::Bpoly = typedef bg::model::polygon<Bpoint>

Definition at line 54 of file bline.hpp.

◆ Bpolys

using pgrouting::Bpolys = typedef bg::model::multi_polygon<Bpoly>

Definition at line 55 of file bline.hpp.

◆ Capacity

typedef boost::property_map< CostFlowGraph, boost::edge_capacity_t >::type pgrouting::Capacity

Definition at line 51 of file pgr_costFlowGraph.hpp.

◆ CostFlowGraph

typedef boost::adjacency_list< boost::vecS, boost::vecS, boost::directedS, boost::no_property, boost::property < boost::edge_capacity_t, double, boost::property < boost::edge_residual_capacity_t, double, boost::property < boost::edge_reverse_t, Traits::edge_descriptor, boost::property < boost::edge_weight_t, double> > > > > pgrouting::CostFlowGraph

Definition at line 49 of file pgr_costFlowGraph.hpp.

◆ DirectedGraph

typedef graph::Pgr_base_graph<boost::adjacency_list < boost::vecS, boost::vecS, boost::bidirectionalS, Basic_vertex, Basic_edge >, Basic_vertex, Basic_edge > pgrouting::DirectedGraph

Definition at line 192 of file pgr_base_graph.hpp.

◆ FlowGraph

typedef boost::adjacency_list<boost::listS, boost::vecS, boost::directedS, boost::property<boost::vertex_index_t, int64_t, boost::property<boost::vertex_color_t, boost::default_color_type, boost::property<boost::vertex_distance_t, int64_t, boost::property<boost::vertex_predecessor_t, Traits::edge_descriptor> > > >, boost::property<boost::edge_capacity_t, int64_t, boost::property<boost::edge_residual_capacity_t, int64_t, boost::property<boost::edge_reverse_t, Traits::edge_descriptor> > > > pgrouting::FlowGraph

Definition at line 50 of file pgr_flowgraph.hpp.

◆ LinearDirectedGraph

typedef boost::adjacency_list< boost::vecS, boost::vecS, boost::bidirectionalS, Line_vertex, Basic_edge > pgrouting::LinearDirectedGraph

Data type to handle graph -> lineGaph transformation.

Usage:

Definition at line 55 of file linear_directed_graph.h.

◆ ResidualCapacity

typedef boost::property_map< CostFlowGraph, boost::edge_residual_capacity_t >::type pgrouting::ResidualCapacity

Definition at line 53 of file pgr_costFlowGraph.hpp.

◆ Reversed

typedef boost::property_map< CostFlowGraph, boost::edge_reverse_t >::type pgrouting::Reversed

Definition at line 57 of file pgr_costFlowGraph.hpp.

◆ Traits

typedef boost::adjacency_list_traits< boost::vecS, boost::vecS, boost::directedS > pgrouting::Traits

Definition at line 39 of file pgr_costFlowGraph.hpp.

◆ UndirectedGraph

typedef graph::Pgr_base_graph<boost::adjacency_list < boost::vecS, boost::vecS, boost::undirectedS, Basic_vertex, Basic_edge >, Basic_vertex, Basic_edge > pgrouting::UndirectedGraph

Definition at line 186 of file pgr_base_graph.hpp.

◆ Weight

typedef boost::property_map< CostFlowGraph, boost::edge_weight_t >::type pgrouting::Weight

Definition at line 55 of file pgr_costFlowGraph.hpp.

◆ xyDirectedGraph

typedef graph::Pgr_base_graph<boost::adjacency_list < boost::listS, boost::vecS, boost::bidirectionalS, XY_vertex, Basic_edge >, XY_vertex, Basic_edge > pgrouting::xyDirectedGraph

Definition at line 204 of file pgr_base_graph.hpp.

◆ xyUndirectedGraph

typedef graph::Pgr_base_graph<boost::adjacency_list < boost::listS, boost::vecS, boost::undirectedS, XY_vertex, Basic_edge >, XY_vertex, Basic_edge > pgrouting::xyUndirectedGraph

Definition at line 198 of file pgr_base_graph.hpp.

Function Documentation

◆ check_vertices() [1/3]

size_t pgrouting::check_vertices ( std::vector< Basic_vertex vertices)

Definition at line 42 of file basic_vertex.cpp.

References pgrouting::Basic_vertex::id.

Referenced by pgrouting::graph::Pgr_base_graph< BG, XY_vertex, Basic_edge >::insert_edges(), and pgrouting::graph::Pgr_base_graph< BG, XY_vertex, Basic_edge >::Pgr_base_graph().

43  {
44  auto count(vertices.size());
45  std::stable_sort(
46  vertices.begin(), vertices.end(),
47  [](const Basic_vertex &lhs, const Basic_vertex &rhs)
48  {return lhs.id < rhs.id;});
49  vertices.erase(
50  std::unique(
51  vertices.begin(), vertices.end(),
52  [](const Basic_vertex &lhs, const Basic_vertex &rhs)
53  {return lhs.id == rhs.id;}), vertices.end());
54 
55  return vertices.size() - count;
56  }

◆ check_vertices() [2/3]

size_t pgrouting::check_vertices ( std::vector< CH_vertex vertices)

◆ check_vertices() [3/3]

size_t pgrouting::check_vertices ( std::vector< XY_vertex vertices)

Definition at line 69 of file xy_vertex.cpp.

References pgrouting::XY_vertex::id.

70  {
71  auto count(vertices.size());
72  std::stable_sort(
73  vertices.begin(), vertices.end(),
74  [](const XY_vertex &lhs, const XY_vertex &rhs)
75  {return lhs.id < rhs.id;});
76  vertices.erase(
77  std::unique(
78  vertices.begin(), vertices.end(),
79  [](const XY_vertex &lhs, const XY_vertex &rhs)
80  {return lhs.id == rhs.id;}), vertices.end());
81 
82  return count - vertices.size();
83 }

◆ extract_vertices() [1/7]

std::vector< Basic_vertex > pgrouting::extract_vertices ( std::vector< Basic_vertex vertices,
const std::vector< pgr_edge_t data_edges 
)

Definition at line 59 of file basic_vertex.cpp.

References pgrouting::Basic_vertex::id, edge::source, and edge::target.

Referenced by do_pgr_astarManyToMany(), do_pgr_bdAstar(), do_pgr_driving_many_to_dist(), do_pgr_withPoints(), do_pgr_withPointsKsp(), extract_vertices(), and pgrouting::graph::Pgr_base_graph< BG, XY_vertex, Basic_edge >::insert_edges().

61  {
62  if (data_edges.empty()) return vertices;
63 
64  vertices.reserve(vertices.size() + data_edges.size() * 2);
65 
66  for (const auto edge : data_edges) {
67  Basic_vertex vertex;
68 
69  vertex.id = edge.source;
70  vertices.push_back(vertex);
71 
72  vertex.id = edge.target;
73  vertices.push_back(vertex);
74  }
75 
76  /*
77  * sort and delete duplicates
78  */
79  std::stable_sort(vertices.begin(), vertices.end(),
80  [](const Basic_vertex &lhs, const Basic_vertex &rhs)
81  {return lhs.id < rhs.id;});
82 
83  vertices.erase(
84  std::unique(vertices.begin(), vertices.end(),
85  [](const Basic_vertex &lhs, const Basic_vertex &rhs)
86  {return lhs.id == rhs.id;}), vertices.end());
87 
88  return vertices;
89  }
int64 target
Definition: trsp.h:44
Definition: trsp.h:41
int64 source
Definition: trsp.h:43

◆ extract_vertices() [2/7]

std::vector< Basic_vertex > pgrouting::extract_vertices ( std::vector< Basic_vertex vertices,
const pgr_edge_t data_edges,
int64_t  count 
)

◆ extract_vertices() [3/7]

std::vector< XY_vertex > pgrouting::extract_vertices ( const std::vector< Pgr_edge_xy_t > &  data_edges)

Definition at line 86 of file xy_vertex.cpp.

References pgrouting::XY_vertex::id.

87  {
88 
89  std::vector< XY_vertex > vertices;
90  if (data_edges.empty()) return vertices;
91 
92  vertices.reserve(data_edges.size() * 2);
93 
94  for (const auto edge : data_edges) {
95  XY_vertex v_source(edge, true);
96  vertices.push_back(v_source);
97 
98  XY_vertex v_target(edge, false);
99  vertices.push_back(v_target);
100  }
101 
102  /*
103  * sort and delete duplicates
104  */
105  std::stable_sort(
106  vertices.begin(), vertices.end(),
107  [](const XY_vertex &lhs, const XY_vertex &rhs)
108  {return lhs.id < rhs.id;});
109  vertices.erase(
110  std::unique(
111  vertices.begin(), vertices.end(),
112  [](const XY_vertex &lhs, const XY_vertex &rhs)
113  {return lhs.id == rhs.id;}), vertices.end());
114  return vertices;
115 }
Definition: trsp.h:41

◆ extract_vertices() [4/7]

std::vector< Basic_vertex > pgrouting::extract_vertices ( const std::vector< pgr_edge_t > &  data_edges)

Definition at line 92 of file basic_vertex.cpp.

References pgrouting::Basic_vertex::id, edge::source, and edge::target.

93  {
94  std::vector< Basic_vertex > vertices;
95  if (data_edges.empty()) return vertices;
96 
97  vertices.reserve(data_edges.size() * 2);
98 
99  for (const auto edge : data_edges) {
100  Basic_vertex vertex;
101 
102  vertex.id = edge.source;
103  vertices.push_back(vertex);
104 
105  vertex.id = edge.target;
106  vertices.push_back(vertex);
107  }
108 
109  /*
110  * sort and delete duplicates
111  */
112  std::stable_sort(vertices.begin(), vertices.end(),
113  [](const Basic_vertex &lhs, const Basic_vertex &rhs)
114  {return lhs.id < rhs.id;});
115 
116  vertices.erase(
117  std::unique(vertices.begin(), vertices.end(),
118  [](const Basic_vertex &lhs, const Basic_vertex &rhs)
119  {return lhs.id == rhs.id;}), vertices.end());
120 
121  return vertices;
122  }
int64 target
Definition: trsp.h:44
Definition: trsp.h:41
int64 source
Definition: trsp.h:43

◆ extract_vertices() [5/7]

std::vector< XY_vertex > pgrouting::extract_vertices ( const Pgr_edge_xy_t data_edges,
int64_t  count 
)

Definition at line 118 of file xy_vertex.cpp.

References extract_vertices(), pgrouting::XY_vertex::id, edge::source, edge::target, and pgrouting::XY_vertex::XY_vertex().

119  {
120  return extract_vertices(
121  std::vector < Pgr_edge_xy_t >(data_edges, data_edges + count));
122 }
std::vector< XY_vertex > extract_vertices(const Pgr_edge_xy_t *data_edges, int64_t count)
Definition: xy_vertex.cpp:118

◆ extract_vertices() [6/7]

std::vector< Basic_vertex > pgrouting::extract_vertices ( const pgr_edge_t data_edges,
int64_t  count 
)

Definition at line 124 of file basic_vertex.cpp.

References extract_vertices().

125  {
126  return extract_vertices(
127  std::vector < pgr_edge_t >(
128  data_edges, data_edges + count));
129  }
std::vector< Basic_vertex > extract_vertices(const std::vector< Basic_vertex > &vertices, const pgr_edge_t *data_edges, int64_t count)

◆ extract_vertices() [7/7]

std::vector< Basic_vertex > pgrouting::extract_vertices ( const std::vector< Basic_vertex > &  vertices,
const pgr_edge_t data_edges,
int64_t  count 
)

Definition at line 131 of file basic_vertex.cpp.

References extract_vertices().

133  {
134  return extract_vertices(
135  vertices, std::vector < pgr_edge_t >(
136  data_edges, data_edges + count));
137  }
std::vector< Basic_vertex > extract_vertices(const std::vector< Basic_vertex > &vertices, const pgr_edge_t *data_edges, int64_t count)

◆ operator<<() [1/6]

std::ostream& pgrouting::operator<< ( std::ostream &  log,
const Basic_vertex v 
)

Definition at line 37 of file basic_vertex.cpp.

References pgrouting::Basic_vertex::id.

37  {
38  log << v.id;
39  return log;
40  }

◆ operator<<() [2/6]

std::ostream& pgrouting::operator<< ( std::ostream &  os,
const Pg_points_graph g 
)

Definition at line 46 of file pgr_withPoints.cpp.

References pgrouting::Pg_points_graph::m_points.

47  {
48  for (const auto p : g.m_points) {
49  os << p.pid << "\t"
50  << p.edge_id << "\t"
51  << p.fraction << "\t"
52  << p.side << "\n";
53  }
54  return os;
55 }

◆ operator<<() [3/6]

std::ostream& pgrouting::operator<< ( std::ostream &  log,
const Identifier ident 
)

Definition at line 51 of file identifier.cpp.

References pgrouting::Identifier::id(), and pgrouting::Identifier::idx().

51  {
52  log << "id(idx) = " << ident.id() << "(" << ident.idx() << ")";
53  return log;
54 }

◆ operator<<() [4/6]

std::ostream& pgrouting::operator<< ( std::ostream &  log,
const XY_vertex v 
)

Definition at line 55 of file xy_vertex.cpp.

References pgrouting::XY_vertex::id, and pgrouting::XY_vertex::point.

55  {
56  log << v.id << "-" << bg::wkt(v.point);
57  return log;
58 }

◆ operator<<() [5/6]

std::ostream& pgrouting::operator<< ( std::ostream &  os,
const CH_vertex v 
)

Definition at line 60 of file ch_vertex.cpp.

References pgrouting::CH_vertex::contracted_vertices(), and pgrouting::CH_vertex::id.

60  {
61  os << "{id: " << v.id << ",\t"
62  << "contracted vertices: "
63  << v.contracted_vertices()
64  << "}";
65  return os;
66 }

◆ operator<<() [6/6]

std::ostream& pgrouting::operator<< ( std::ostream &  os,
const CH_edge e 
)

Definition at line 72 of file ch_edge.cpp.

References pgrouting::CH_edge::contracted_vertices(), pgrouting::CH_edge::cost, pgrouting::CH_edge::id, pgrouting::CH_edge::source, and pgrouting::CH_edge::target.

72  {
73  os << "{id: " << e.id << ",\t"
74  << "source: " << e.source << ",\t"
75  << "target: " << e.target << ",\t"
76  << "cost: " << e.cost << ",\t"
77  << "contracted vertices: "
78  << e.contracted_vertices()
79  << "}";
80  return os;
81 }

◆ pgr_dijkstra()

template<class G >
Path pgrouting::pgr_dijkstra ( G &  graph,
int64_t  source,
int64_t  target,
bool  only_cost = false 
)

Definition at line 91 of file pgr_dijkstra.hpp.

References pgrouting::Pgr_dijkstra< G >::dijkstra().

95  {
96  Pgr_dijkstra< G > fn_dijkstra;
97  return fn_dijkstra.dijkstra(graph, source, target, only_cost);
98 }

◆ pgr_drivingDistance()

template<class G >
std::deque<Path> pgrouting::pgr_drivingDistance ( G &  graph,
std::vector< int64_t >  start_vids,
double  distance,
bool  equicost,
std::ostringstream &  log 
)

Definition at line 72 of file pgr_dijkstra.hpp.

References pgrouting::Pgr_dijkstra< G >::drivingDistance().

Referenced by do_pgr_driving_many_to_dist(), and do_pgr_many_withPointsDD().

77  {
78  Pgr_dijkstra< G > fn_dijkstra;
79  return fn_dijkstra.drivingDistance(
80  graph,
81  start_vids,
82  distance,
83  equicost,
84  log);
85 }