PGROUTING  3.2
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
 
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
 

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 (const pgr_edge_t *data_edges, size_t count)
 
std::vector< XY_vertexextract_vertices (const Pgr_edge_xy_t *data_edges, size_t count)
 
std::vector< Basic_vertexextract_vertices (const std::vector< Basic_vertex > &vertices, const pgr_edge_t *data_edges, size_t count)
 
std::vector< Basic_vertexextract_vertices (const std::vector< pgr_edge_t > &data_edges)
 
std::vector< XY_vertexextract_vertices (const std::vector< Pgr_edge_xy_t > &data_edges)
 
std::vector< Basic_vertexextract_vertices (std::vector< Basic_vertex > vertices, const pgr_edge_t *data_edges, size_t count)
 
std::vector< Basic_vertexextract_vertices (std::vector< Basic_vertex > vertices, const std::vector< pgr_edge_t > data_edges)
 
std::ostream & operator<< (std::ostream &log, const Basic_vertex &v)
 
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_edge &e)
 
std::ostream & operator<< (std::ostream &os, const CH_vertex &v)
 
std::ostream & operator<< (std::ostream &os, const Pg_points_graph &g)
 
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 43 of file bline.hpp.

◆ Blines

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

Definition at line 44 of file bline.hpp.

◆ Bpoint

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

Definition at line 40 of file bline.hpp.

◆ Bpoints

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

Definition at line 41 of file bline.hpp.

◆ Bpoly

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

Definition at line 46 of file bline.hpp.

◆ Bpolys

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

Definition at line 47 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

◆ 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.

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  }

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().

◆ 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 65 of file xy_vertex.cpp.

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

◆ extract_vertices() [1/7]

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

Definition at line 124 of file basic_vertex.cpp.

125  {
126  return extract_vertices(
127  std::vector < pgr_edge_t >(
128  data_edges, data_edges + count));
129  }

References extract_vertices().

◆ extract_vertices() [2/7]

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

Definition at line 114 of file xy_vertex.cpp.

115  {
116  return extract_vertices(
117  std::vector < Pgr_edge_xy_t >(data_edges, data_edges + count));
118 }

References extract_vertices().

◆ extract_vertices() [3/7]

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

Definition at line 131 of file basic_vertex.cpp.

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

References extract_vertices().

◆ 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.

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  }

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

◆ extract_vertices() [5/7]

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

Definition at line 82 of file xy_vertex.cpp.

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

◆ extract_vertices() [6/7]

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

◆ extract_vertices() [7/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.

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  }

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().

◆ operator<<() [1/6]

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

Definition at line 37 of file basic_vertex.cpp.

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

References pgrouting::Basic_vertex::id.

◆ operator<<() [2/6]

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

Definition at line 51 of file identifier.cpp.

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

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

◆ operator<<() [3/6]

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

Definition at line 51 of file xy_vertex.cpp.

51  {
52  log << v.id << "-" << bg::wkt(v.point);
53  return log;
54 }

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

◆ operator<<() [4/6]

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

Definition at line 72 of file ch_edge.cpp.

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 }

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

◆ operator<<() [5/6]

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

Definition at line 60 of file ch_vertex.cpp.

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

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

◆ operator<<() [6/6]

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

Definition at line 46 of file pgr_withPoints.cpp.

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 }

References pgrouting::Pg_points_graph::m_points.

◆ pgr_dijkstra()

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

Definition at line 87 of file pgr_dijkstra.hpp.

91  {
92  Pgr_dijkstra< G > fn_dijkstra;
93  return fn_dijkstra.dijkstra(graph, source, target, only_cost);
94 }

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

◆ 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 68 of file pgr_dijkstra.hpp.

73  {
74  Pgr_dijkstra< G > fn_dijkstra;
75  return fn_dijkstra.drivingDistance(
76  graph,
77  start_vids,
78  distance,
79  equicost,
80  log);
81 }

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

Referenced by do_pgr_driving_many_to_dist(), and do_pgr_many_withPointsDD().

pgrouting::extract_vertices
std::vector< XY_vertex > extract_vertices(const Pgr_edge_xy_t *data_edges, size_t count)
Definition: xy_vertex.cpp:114
edge::target
int64 target
Definition: trsp.h:44
pgrouting::LinearDirectedGraph
boost::adjacency_list< boost::vecS, boost::vecS, boost::bidirectionalS, Line_vertex, Basic_edge > LinearDirectedGraph
Data type to handle graph -> lineGaph transformation.
Definition: linear_directed_graph.h:55
pgrouting::Basic_edge
Definition: basic_edge.h:35
edge
Definition: trsp.h:41
pgrouting::graph::Pgr_lineGraphFull
Definition: pgr_lineGraphFull.hpp:47
pgrouting::graph::Pgr_lineGraph
Definition: pgr_lineGraph.hpp:49
edge::source
int64 source
Definition: trsp.h:43
pgrouting::extract_vertices
std::vector< Basic_vertex > extract_vertices(const std::vector< Basic_vertex > &vertices, const pgr_edge_t *data_edges, size_t count)
Definition: basic_vertex.cpp:131
DIRECTED
@ DIRECTED
Definition: graph_enum.h:30
pgrouting::Line_vertex
Definition: line_vertex.h:45