PGROUTING
3.2
|
#include "pgr_contractionGraph.hpp"
Public Types | |||||||||||||||||||||||||
typedef boost::graph_traits< G >::edge_descriptor | E | ||||||||||||||||||||||||
typedef boost::graph_traits< G >::in_edge_iterator | EI_i | ||||||||||||||||||||||||
typedef boost::graph_traits< G >::out_edge_iterator | EO_i | ||||||||||||||||||||||||
typedef boost::graph_traits< G >::vertex_descriptor | V | ||||||||||||||||||||||||
Id handling related types | |||||||||||||||||||||||||
| |||||||||||||||||||||||||
typedef std::map< int64_t, V > | id_to_V | ||||||||||||||||||||||||
typedef id_to_V::const_iterator | LI | ||||||||||||||||||||||||
Graph related types | |||||||||||||||||||||||||
| |||||||||||||||||||||||||
typedef G | B_G | ||||||||||||||||||||||||
typedef CH_edge | G_T_E | ||||||||||||||||||||||||
typedef CH_vertex | G_T_V | ||||||||||||||||||||||||
typedef boost::graph_traits< G >::vertex_iterator | V_i | ||||||||||||||||||||||||
typedef boost::graph_traits< G >::edge_iterator | E_i | ||||||||||||||||||||||||
typedef boost::graph_traits< G >::vertices_size_type | vertices_size_type | ||||||||||||||||||||||||
typedef boost::graph_traits< G >::edges_size_type | edges_size_type | ||||||||||||||||||||||||
typedef boost::graph_traits< G >::degree_size_type | degree_size_type | ||||||||||||||||||||||||
Id handling related types | |||||||||||||||||||||||||
| |||||||||||||||||||||||||
typedef std::map< int64_t, V > | id_to_V | ||||||||||||||||||||||||
typedef id_to_V::const_iterator | LI | ||||||||||||||||||||||||
Public Member Functions | |
Pgr_contractionGraph (graphType gtype) | |
Prepares the graph to be of type gtype More... | |
void | add_shortcut (const CH_edge &edge, V u, V v) |
add_shortuct to the graph during contraction More... | |
Identifiers< V > | find_adjacent_vertices (V v) const |
get the vertex descriptors of adjacent vertices of v More... | |
std::tuple< double, Identifiers< int64_t >, bool > | get_min_cost_edge (V u, V v) |
get the edge with minimum cost between two vertices More... | |
bool | has_u_v_w (V u, V v, V w) const |
bool | is_linear (V v) |
bool | is_shortcut_possible (V u, V v, V w) |
Possibility of a shortcut from left vertex to right vertex v* should be a linear vertex u <-> v -> w: v not considered linear. More... | |
boost wrappers with original id | |
degree_size_type | out_degree (int64_t vertex_id) const |
get the out-degree of a vertex More... | |
degree_size_type | in_degree (int64_t vertex_id) const |
V | get_V (const CH_vertex &vertex) |
get the vertex descriptor of the vertex When the vertex does not exist More... | |
V | get_V (int64_t vid) const |
get the vertex descriptor of the vid Call has_vertex(vid) before calling this function More... | |
bool | has_vertex (int64_t vid) const |
True when vid is in the graph. More... | |
boost wrappers with V | |
degree_size_type | out_degree (V &v) const |
out degree of a vertex More... | |
degree_size_type | in_degree (V &v) const |
in degree of a vertex More... | |
CH_edge & | operator[] (E e_idx) |
const CH_edge & | operator[] (E e_idx) const |
CH_vertex & | operator[] (V v_idx) |
const CH_vertex & | operator[] (V v_idx) const |
V | source (E e_idx) const |
V | target (E e_idx) const |
V | adjacent (V v_idx, E e_idx) const |
to be or not to be | |
bool | is_directed () const |
bool | is_undirected () const |
bool | is_source (V v_idx, E e_idx) const |
bool | is_target (V v_idx, E e_idx) const |
edge disconection/reconnection | |
void | disconnect_edge (int64_t p_from, int64_t p_to) |
Disconnects all edges from p_from to p_to. More... | |
void | disconnect_out_going_edge (int64_t vertex_id, int64_t edge_id) |
Disconnects the outgoing edges of a vertex. More... | |
void | disconnect_vertex (int64_t p_vertex) |
Disconnects all incoming and outgoing edges from the vertex. More... | |
void | disconnect_vertex (V vertex) |
void | restore_graph () |
Reconnects all edges that were removed. More... | |
boost wrappers with original id | |
degree_size_type | out_degree (int64_t vertex_id) const |
get the out-degree of a vertex More... | |
degree_size_type | in_degree (int64_t vertex_id) const |
V | get_V (const CH_vertex &vertex) |
get the vertex descriptor of the vertex When the vertex does not exist More... | |
V | get_V (int64_t vid) const |
get the vertex descriptor of the vid Call has_vertex(vid) before calling this function More... | |
bool | has_vertex (int64_t vid) const |
True when vid is in the graph. More... | |
boost wrappers with V | |
degree_size_type | out_degree (V &v) const |
out degree of a vertex More... | |
degree_size_type | in_degree (V &v) const |
in degree of a vertex More... | |
CH_edge & | operator[] (E e_idx) |
const CH_edge & | operator[] (E e_idx) const |
CH_vertex & | operator[] (V v_idx) |
const CH_vertex & | operator[] (V v_idx) const |
V | source (E e_idx) const |
V | target (E e_idx) const |
V | adjacent (V v_idx, E e_idx) const |
to be or not to be | |
bool | is_directed () const |
bool | is_undirected () const |
bool | is_source (V v_idx, E e_idx) const |
bool | is_target (V v_idx, E e_idx) const |
edge disconection/reconnection | |
void | disconnect_edge (int64_t p_from, int64_t p_to) |
Disconnects all edges from p_from to p_to. More... | |
void | disconnect_out_going_edge (int64_t vertex_id, int64_t edge_id) |
Disconnects the outgoing edges of a vertex. More... | |
void | disconnect_vertex (int64_t p_vertex) |
Disconnects all incoming and outgoing edges from the vertex. More... | |
void | disconnect_vertex (V vertex) |
void | restore_graph () |
Reconnects all edges that were removed. More... | |
only for stand by program | |
int64_t | get_edge_id (V from, V to, double &distance) const |
E | get_edge (V from, V to, double &distance) const |
size_t | num_vertices () const |
size_t | num_edges () const |
void | graph_add_edge (const CH_edge &edge) |
void | graph_add_edge (const T &edge, bool normal=true) |
void | graph_add_min_edge_no_parallel (const T &edge) |
void | graph_add_neg_edge (const T &edge, bool normal=true) |
void | graph_add_edge_no_create_vertex (const T &edge) |
Use this function when the vertices are already inserted in the graph. More... | |
Public Attributes | |
Graph Modification | |
std::deque< CH_edge > | removed_edges |
Used for storing the removed_edges. More... | |
The Graph | |
G | graph |
The graph. More... | |
graphType | m_gType |
type (DIRECTED or UNDIRECTED) More... | |
Graph Modification | |
std::deque< CH_edge > | removed_edges |
Used for storing the removed_edges. More... | |
Friends | |
std::ostream & | operator<< (std::ostream &os, const Pgr_contractionGraph &g) |
print the graph with contracted vertices of all vertices and edges More... | |
Id mapping handling | |
typedef std::map< V, size_t > | IndexMap |
id_to_V | vertices_map |
id -> graph id More... | |
boost::property_map< G, boost::vertex_index_t >::type | vertIndex |
IndexMap | mapIndex |
boost::associative_property_map< IndexMap > | propmapIndex |
Insert edges | |
void | insert_edges (const T *edges, size_t count) |
Inserts count edges of type T into the graph. More... | |
void | insert_edges (T *edges, size_t count, bool) |
void | insert_edges (const std::vector< T > &edges, bool normal=true) |
Inserts count edges of type pgr_edge_t into the graph The set of edges should not have an illegal vertex defined When the graph is empty calls: More... | |
void | insert_edges_neg (const T *edges, size_t count) |
void | insert_negative_edges (const T *edges, int64_t count) |
void | insert_negative_edges (const std::vector< T > &edges, bool normal=true) |
void | insert_min_edges_no_parallel (const T *edges, size_t count) |
void | insert_min_edges_no_parallel (const std::vector< T > &edges) |
void | add_vertices (std::vector< CH_vertex > vertices) |
adds the vertices into the graph More... | |
Definition at line 51 of file pgr_contractionGraph.hpp.
|
inherited |
Definition at line 226 of file pgr_base_graph.hpp.
|
inherited |
Definition at line 241 of file pgr_base_graph.hpp.
typedef boost::graph_traits< G >::edge_descriptor pgrouting::graph::Pgr_contractionGraph< G >::E |
Definition at line 54 of file pgr_contractionGraph.hpp.
|
inherited |
Definition at line 232 of file pgr_base_graph.hpp.
|
inherited |
Definition at line 239 of file pgr_base_graph.hpp.
typedef boost::graph_traits< G >::in_edge_iterator pgrouting::graph::Pgr_contractionGraph< G >::EI_i |
Definition at line 56 of file pgr_contractionGraph.hpp.
typedef boost::graph_traits< G >::out_edge_iterator pgrouting::graph::Pgr_contractionGraph< G >::EO_i |
Definition at line 55 of file pgr_contractionGraph.hpp.
|
inherited |
Definition at line 227 of file pgr_base_graph.hpp.
|
inherited |
Definition at line 228 of file pgr_base_graph.hpp.
|
inherited |
Definition at line 253 of file pgr_base_graph.hpp.
|
inherited |
Definition at line 271 of file pgr_base_graph.hpp.
|
inherited |
Definition at line 254 of file pgr_base_graph.hpp.
typedef boost::graph_traits< G >::vertex_descriptor pgrouting::graph::Pgr_contractionGraph< G >::V |
Definition at line 53 of file pgr_contractionGraph.hpp.
|
inherited |
Definition at line 231 of file pgr_base_graph.hpp.
|
inherited |
Definition at line 237 of file pgr_base_graph.hpp.
|
inlineexplicit |
Prepares the graph to be of type gtype
Definition at line 61 of file pgr_contractionGraph.hpp.
|
inline |
add_shortuct to the graph during contraction
u -> v -> w
u -> w
edge (u, w) is a new edge e e.contracted_vertices = v + v.contracted vertices
removed from graph edges: u -> v and v -> w
[in] | edge | of type CH_edge is to be added |
Definition at line 170 of file pgr_contractionGraph.hpp.
References edge::cost, and pgrouting::graph::Pgr_base_graph< G, CH_vertex, CH_edge >::graph.
|
inlineprivateinherited |
adds the vertices into the graph
PRECONDITIONS:
POSTCONDITIONS:
Example use:
Definition at line 462 of file pgr_base_graph.hpp.
|
inherited |
Disconnects all edges from p_from to p_to.
[in] | p_from | original vertex id of the starting point of the edge |
[in] | p_to | original vertex id of the ending point of the edge |
Definition at line 765 of file pgr_base_graph.hpp.
|
inherited |
Disconnects the outgoing edges of a vertex.
[in] | vertex_id | original vertex |
[in] | edge_id | original edge_id |
Definition at line 794 of file pgr_base_graph.hpp.
|
inherited |
Disconnects all incoming and outgoing edges from the vertex.
boost::graph doesn't recommend th to insert/remove vertices, so a vertex removal is simulated by disconnecting the vertex from the graph
[in] | p_vertex | original vertex id of the starting point of the edge |
Definition at line 826 of file pgr_base_graph.hpp.
|
inherited |
Definition at line 833 of file pgr_base_graph.hpp.
|
inline |
get the vertex descriptors of adjacent vertices of v
[in] | v | vertex_descriptor |
Definition at line 69 of file pgr_contractionGraph.hpp.
References pgrouting::graph::Pgr_base_graph< G, CH_vertex, CH_edge >::adjacent(), and pgrouting::graph::Pgr_base_graph< G, CH_vertex, CH_edge >::graph.
Referenced by pgrouting::graph::Pgr_contractionGraph< G >::is_linear().
|
inlineinherited |
Definition at line 671 of file pgr_base_graph.hpp.
|
inherited |
Definition at line 878 of file pgr_base_graph.hpp.
|
inline |
get the edge with minimum cost between two vertices
[in] | u | vertex_descriptor of source vertex |
[in] | v | vertex_descriptor of target vertex |
Definition at line 92 of file pgr_contractionGraph.hpp.
References pgrouting::graph::Pgr_base_graph< G, CH_vertex, CH_edge >::adjacent(), pgrouting::graph::Pgr_base_graph< G, CH_vertex, CH_edge >::graph, pgrouting::graph::Pgr_base_graph< G, CH_vertex, CH_edge >::is_directed(), pgrouting::graph::Pgr_base_graph< G, CH_vertex, CH_edge >::is_undirected(), pgassert, and pgrouting::graph::Pgr_base_graph< G, CH_vertex, CH_edge >::target().
|
inlineinherited |
get the vertex descriptor of the vertex When the vertex does not exist
Definition at line 512 of file pgr_base_graph.hpp.
|
inlineinherited |
get the vertex descriptor of the vid Call has_vertex(vid) before calling this function
Definition at line 528 of file pgr_base_graph.hpp.
|
inherited |
Definition at line 908 of file pgr_base_graph.hpp.
|
inherited |
Definition at line 936 of file pgr_base_graph.hpp.
|
inlineinherited |
Use this function when the vertices are already inserted in the graph.
Definition at line 721 of file pgr_base_graph.hpp.
|
inherited |
Definition at line 972 of file pgr_base_graph.hpp.
|
inherited |
Definition at line 1035 of file pgr_base_graph.hpp.
|
inline |
Definition at line 181 of file pgr_contractionGraph.hpp.
References pgrouting::graph::Pgr_base_graph< G, CH_vertex, CH_edge >::graph.
Referenced by pgrouting::graph::Pgr_contractionGraph< G >::is_shortcut_possible().
|
inlineinherited |
True when vid is in the graph.
Definition at line 534 of file pgr_base_graph.hpp.
|
inlineinherited |
Definition at line 497 of file pgr_base_graph.hpp.
|
inlineinherited |
in degree of a vertex
Definition at line 576 of file pgr_base_graph.hpp.
|
inlineinherited |
Inserts count edges of type pgr_edge_t into the graph The set of edges should not have an illegal vertex defined When the graph is empty calls:
edges | |
normal |
Definition at line 395 of file pgr_base_graph.hpp.
|
inlineinherited |
Inserts count edges of type T into the graph.
Converts the edges to a std::vector<T> & calls the overloaded twin function.
edges | |
count |
Definition at line 357 of file pgr_base_graph.hpp.
|
inlineinherited |
Definition at line 367 of file pgr_base_graph.hpp.
|
inlineinherited |
Definition at line 362 of file pgr_base_graph.hpp.
|
inlineinherited |
Definition at line 416 of file pgr_base_graph.hpp.
|
inlineinherited |
Definition at line 410 of file pgr_base_graph.hpp.
|
inlineinherited |
Definition at line 423 of file pgr_base_graph.hpp.
|
inlineinherited |
Definition at line 376 of file pgr_base_graph.hpp.
|
inlineinherited |
Definition at line 543 of file pgr_base_graph.hpp.
|
inline |
Definition at line 241 of file pgr_contractionGraph.hpp.
References pgrouting::graph::Pgr_contractionGraph< G >::find_adjacent_vertices(), and pgrouting::graph::Pgr_contractionGraph< G >::is_shortcut_possible().
|
inline |
Possibility of a shortcut from left vertex to right vertex v* should be a linear vertex u <-> v -> w: v not considered linear.
Definition at line 208 of file pgr_contractionGraph.hpp.
References pgrouting::graph::Pgr_base_graph< G, CH_vertex, CH_edge >::graph, pgrouting::graph::Pgr_contractionGraph< G >::has_u_v_w(), pgrouting::graph::Pgr_base_graph< G, CH_vertex, CH_edge >::is_directed(), pgrouting::graph::Pgr_base_graph< G, CH_vertex, CH_edge >::is_undirected(), and pgassert.
Referenced by pgrouting::graph::Pgr_contractionGraph< G >::is_linear().
|
inlineinherited |
Definition at line 545 of file pgr_base_graph.hpp.
|
inlineinherited |
Definition at line 546 of file pgr_base_graph.hpp.
|
inlineinherited |
Definition at line 544 of file pgr_base_graph.hpp.
|
inlineinherited |
Definition at line 704 of file pgr_base_graph.hpp.
|
inlineinherited |
Definition at line 703 of file pgr_base_graph.hpp.
|
inlineinherited |
Definition at line 554 of file pgr_base_graph.hpp.
|
inlineinherited |
Definition at line 555 of file pgr_base_graph.hpp.
|
inlineinherited |
Definition at line 557 of file pgr_base_graph.hpp.
|
inlineinherited |
Definition at line 558 of file pgr_base_graph.hpp.
|
inlineinherited |
get the out-degree of a vertex
[in] | vertex_id | original vertex id |
Definition at line 489 of file pgr_base_graph.hpp.
|
inlineinherited |
out degree of a vertex
regardles of undirected or directed graph
Definition at line 587 of file pgr_base_graph.hpp.
|
inherited |
|
inlineinherited |
Definition at line 560 of file pgr_base_graph.hpp.
|
inlineinherited |
Definition at line 561 of file pgr_base_graph.hpp.
|
friend |
print the graph with contracted vertices of all vertices and edges
Definition at line 131 of file pgr_contractionGraph.hpp.
|
inherited |
The graph.
Definition at line 260 of file pgr_base_graph.hpp.
|
inherited |
type (DIRECTED or UNDIRECTED)
Definition at line 261 of file pgr_base_graph.hpp.
|
inherited |
Definition at line 272 of file pgr_base_graph.hpp.
|
inherited |
Definition at line 273 of file pgr_base_graph.hpp.
|
inherited |
Used for storing the removed_edges.
Definition at line 281 of file pgr_base_graph.hpp.
|
inherited |
id -> graph id
Definition at line 267 of file pgr_base_graph.hpp.
|
inherited |
Definition at line 269 of file pgr_base_graph.hpp.