pgRouting  2.2
pgRouting extends the PostGIS / PostgreSQL geospatial database to provide geospatial routing functionality.
 All Classes Functions Variables Pages
Pgr_base_graph< G > Class Template Reference
Collaboration diagram for Pgr_base_graph< G >:

Public Types

Graph related types
Type boost meaning pgRouting Meaning
G boost::adjacency_list Graph
V vertex_descriptor Think of it as local ID of a vertex
E edge_descriptor Think of it as local ID of an edge
V_i vertex_iterator To cycle the vertices of the Graph
E_i edge_iterator To cycle the edges of the Graph
EO_i out_edge_iterator To cycle the out going edges of a vertex
EI_i in_edge_iterator To cycle the in coming edges of a vertex (only in bidirectional graphs)
typedef boost::graph_traits< G >
::vertex_descriptor 
V
 
typedef boost::graph_traits< G >
::edge_descriptor 
E
 
typedef boost::graph_traits< G >
::vertex_iterator 
V_i
 
typedef boost::graph_traits< G >
::edge_iterator 
E_i
 
typedef boost::graph_traits< G >
::out_edge_iterator 
EO_i
 
typedef boost::graph_traits< G >
::in_edge_iterator 
EI_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
Type Meaning pgRouting Meaning
id_to_V maps id -> V given an id store the V
V_to_id maps V -> id given a V store the id
LI Left Iterator iterates over id_to_V
RI right Iterator iterates over V_to_id
typedef std::map< int64_t, V > id_to_V
 
typedef std::map< V, int64_t > V_to_id
 
typedef id_to_V::const_iterator LI
 
typedef V_to_id::const_iterator RI
 

Public Member Functions

void disconnect_out_going_edge (int64_t vertex_id, int64_t edge_id)
 Disconnects the outgoing edges with a particular original id from a vertex. More...
 
void disconnect_vertex (int64_t p_vertex)
 Disconnects all incomming and outgoing edges from the vertex. More...
 
void restore_graph ()
 Reconnects all edges that were removed. More...
 
boost wrappers
degree_size_type out_degree (int64_t vertex_id) const
 get the out-degree of a vertex More...
 
degree_size_type out_degree (V &v) const
 
only for stand by program
void print_graph (std::ostream &log=std::cout) const
 

Public Attributes

Id handling
id_to_V vertices_map
 id -> graph id More...
 
V_to_id gVertices_map
 graph id -> id More...
 
Graph Modification
std::deque< boost_edge_tremoved_edges
 Used for storing the removed_edges. More...
 

The Graph

Used for storing modified edges because of adding points

graph
 The graph. More...
 
size_t m_num_vertices
 number of vertices More...
 
graphType m_gType
 type (DIRECTED or UNDIRECTED) More...
 
 Pgr_base_graph (graphType gtype, const size_t initial_size)
 Constructor. More...
 
void graph_insert_data (const pgr_edge_t *data_edges, int64_t count)
 Inserts count edges of type pgr_edge_t into the graph. More...
 
void graph_insert_data (const std::vector< pgr_edge_t > &data_edges)
 
void disconnect_edge (int64_t p_from, int64_t p_to)
 Disconnects all edges from p_from to p_to. More...
 

Detailed Description

template<class G>
class Pgr_base_graph< G >

Definition at line 93 of file baseGraph.hpp.

Constructor & Destructor Documentation

template<class G>
Pgr_base_graph< G >::Pgr_base_graph ( graphType  gtype,
const size_t  initial_size 
)
inlineexplicit

Constructor.

Prepares the graph to be of type gtype with the aproximate number of vertices its coing to have as initial_size

Definition at line 231 of file baseGraph.hpp.

Member Function Documentation

template<class G>
void Pgr_base_graph< G >::disconnect_edge ( int64_t  p_from,
int64_t  p_to 
)
inline

Disconnects all edges from p_from to p_to.

  • No edge is disconnected if the vertices id's do not exist in the graph
  • All removed edges are stored for future reinsertion
  • All parallel edges are disconnected (automatically by boost)
disconnectEdgeUndirected.png
disconnect_edge(2,3) on an UNDIRECTED graph
disconnectEdgeDirected.png
disconnect_edge(2,3) on a DIRECTED graph
Parameters
[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 268 of file baseGraph.hpp.

References Pgr_base_graph< G >::graph, and Pgr_base_graph< G >::removed_edges.

template<class G>
void Pgr_base_graph< G >::disconnect_out_going_edge ( int64_t  vertex_id,
int64_t  edge_id 
)
inline

Disconnects the outgoing edges with a particular original id from a vertex.

  • No edge is disconnected if it doesn't exist in the graph
  • Removed edges are stored for future reinsertion
  • all outgoing edges with the edge_id are removed if they exist
Parameters
[IN]vertex_id original vertex
[IN]edge_id original edge_id

Definition at line 326 of file baseGraph.hpp.

References Pgr_base_graph< G >::graph, and Pgr_base_graph< G >::removed_edges.

template<class G>
void Pgr_base_graph< G >::disconnect_vertex ( int64_t  p_vertex)
inline

Disconnects all incomming 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

  • No edge is disconnected if the vertices id's do not exist in the graph
  • All removed edges are stored for future reinsertion
  • All parallel edges are disconnected (automatically by boost)
disconnectVertexUndirected.png
disconnect_vertex(2) on an UNDIRECTED graph
disconnectVertexDirected.png
disconnect_vertex(2) on a DIRECTED graph
Parameters
[IN]p_vertex original vertex id of the starting point of the edge

Definition at line 373 of file baseGraph.hpp.

References Pgr_base_graph< G >::graph, Pgr_base_graph< G >::m_gType, Pgr_base_graph< G >::removed_edges, and Pgr_base_graph< G >::vertices_map.

template<class G>
void Pgr_base_graph< G >::graph_insert_data ( const pgr_edge_t data_edges,
int64_t  count 
)
inline

Inserts count edges of type pgr_edge_t into the graph.

Definition at line 238 of file baseGraph.hpp.

References Pgr_base_graph< G >::graph, and Pgr_base_graph< G >::gVertices_map.

template<class G>
degree_size_type Pgr_base_graph< G >::out_degree ( int64_t  vertex_id) const
inline

get the out-degree of a vertex

Returns
0: The out degree of a vertex that its not in the graph
Parameters
[IN]vertex_id original vertex id

Definition at line 303 of file baseGraph.hpp.

template<class G>
void Pgr_base_graph< G >::restore_graph ( )
inline

Reconnects all edges that were removed.

Definition at line 410 of file baseGraph.hpp.

References Pgr_base_graph< G >::removed_edges.

Member Data Documentation

template<class G>
V_to_id Pgr_base_graph< G >::gVertices_map

graph id -> id

Definition at line 145 of file baseGraph.hpp.

Referenced by Pgr_base_graph< G >::graph_insert_data().

template<class G>
graphType Pgr_base_graph< G >::m_gType

type (DIRECTED or UNDIRECTED)

Definition at line 139 of file baseGraph.hpp.

Referenced by Pgr_base_graph< G >::disconnect_vertex().

template<class G>
size_t Pgr_base_graph< G >::m_num_vertices

number of vertices

Definition at line 138 of file baseGraph.hpp.

template<class G>
std::deque<boost_edge_t> Pgr_base_graph< G >::removed_edges
template<class G>
id_to_V Pgr_base_graph< G >::vertices_map

id -> graph id

Definition at line 144 of file baseGraph.hpp.

Referenced by Pgr_base_graph< G >::disconnect_vertex().


The documentation for this class was generated from the following file: