Structure that store a graph in CSR format or basically in compressed adjacency matrix format.
More...
template<typename V, typename E, template< typename, typename, typename, unsigned int > class VertexList, template< typename, typename, typename, unsigned int > class EdgeList, typename Memory, typename grow_p>
class Graph_CSR< V, E, VertexList, EdgeList, Memory, grow_p >
Structure that store a graph in CSR format or basically in compressed adjacency matrix format.
- Parameters
-
V | each vertex will encapsulate have this type |
E | each edge will encapsulate this type |
device | Type of device / basicaly it select the layout for device_cpu is (x_1, p1_1, p2_1, p3_1 ....), ... ( x_n, p1_1, p2_1, p3_1, ...) for device_gpu is (x_1, ... , x_n) ... (p1_n, ... pn_n) where x_1 is the index where it end the list of the neighborhood list and pj_k is the property j for the vertex j. Basically in the first case one array will store index and property of each vertex, in the second case several array will store index and property |
VertexList | structure that store the list of Vertex |
EdgeList | structure that store the list of edge |
- Warning
- This graph is suitable only when we know the graph structure and we build the graph adding vertexes and edges, removing vertex and edge is EXTREMLY expensive
Define vertex and edge of the graph
Create a Cartesian graph
for (size_t i = 0 ; i < GS_SIZE ; i++)
{
for (size_t j = 0 ; j < GS_SIZE ; j++)
{
}
}
std::vector<size_t> gs;
gs.push_back(GS_SIZE);
gs.push_back(GS_SIZE);
for (size_t i = 0 ; i < GS_SIZE ; i++)
{
for (size_t j = 0 ; j < GS_SIZE ; j++)
{
}
}
Create a tree graph with no edge properties
Definition at line 70 of file map_graph.hpp.
|
Graph_CSR< V, E, VertexList,
EdgeList, Memory, grow_p > | duplicate () |
| It duplicate the graph. More...
|
|
| Graph_CSR () |
| Constructor. More...
|
|
| Graph_CSR (size_t n_vertex) |
| Constructor. More...
|
|
| Graph_CSR (size_t n_vertex, size_t n_slot) |
| Constructor. More...
|
|
| Graph_CSR (Graph_CSR< V, E, VertexList, EdgeList, Memory > &&g) |
| Copy constructor. More...
|
|
template<unsigned int i> |
auto | vertex_p (size_t id) -> decltype(v.template get< i >(id)) |
| operator to access the vertex More...
|
|
template<unsigned int i> |
auto | vertex_p (grid_key_dx< 1 > id) -> decltype(v.template get< i >(id)) |
| Access the vertex. More...
|
|
auto | vertex (size_t id) -> decltype(v.get(id)) |
| Function to access the vertexes. More...
|
|
auto | vertex (grid_key_dx< 1 > id) -> decltype(v.get(id.get(0))) |
| operator to access the vertex More...
|
|
auto | vertex (openfpm::vector_key_iterator id) -> decltype(v.get(0)) |
| operator to access the vertex More...
|
|
auto | vertex (size_t id) const -> const decltype(v.get(id)) |
| Function to access the vertexes. More...
|
|
auto | vertex (grid_key_dx< 1 > id) const -> const decltype(v.get(id.get(0))) |
| operator to access the vertex More...
|
|
auto | vertex (openfpm::vector_key_iterator id) const -> const decltype(v.get(0)) |
| operator to access the vertex More...
|
|
template<unsigned int i> |
auto | edge_p (grid_key_dx< 1 > id) -> decltype(e.template get< i >(id)) |
| Access the edge. More...
|
|
template<unsigned int i> |
auto | edge_p (size_t id) -> decltype(e.template get< i >(id)) |
| Access the edge. More...
|
|
auto | edge (grid_key_dx< 1 > id) -> decltype(e.get(id.get(0))) |
| Access the edge. More...
|
|
auto | edge (edge_key ek) -> decltype(e.get(0)) |
| operator to access the edge More...
|
|
auto | edge (size_t id) -> decltype(e.get(id)) |
| operator to access the edge More...
|
|
auto | edge (grid_key_dx< 1 > id) const -> const decltype(e.get(id.get(0))) |
| Access the edge. More...
|
|
auto | edge (edge_key ek) const -> const decltype(e.get(0)) |
| operator to access the edge More...
|
|
auto | edge (size_t id) const -> const decltype(e.get(id)) |
| operator to access the edge More...
|
|
size_t | getNChilds (size_t c) const |
| Return the number of childs of a vertex. More...
|
|
size_t | getNChilds (typename VertexList< V, Memory, grow_p, openfpm::vect_isel< V >::value >::iterator_key &c) |
| Return the number of childs of a vertex. More...
|
|
auto | getChildEdge (size_t v, size_t v_e) -> decltype(e.get(0)) |
| Get the vertex edge. More...
|
|
size_t | getChild (size_t v, size_t i) const |
| Get the child edge. More...
|
|
size_t | getChild (typename VertexList< V, Memory, grow_p, openfpm::vect_isel< V >::value >::iterator_key &v, size_t i) |
| Get the child edge. More...
|
|
void | addVertex (const V &vrt) |
| add vertex More...
|
|
void | addVertex () |
| add an empty vertex More...
|
|
template<typename CheckPolicy = NoCheck> |
auto | addEdge (size_t v1, size_t v2, const E &ed) -> decltype(e.get(0)) |
| add edge on the graph More...
|
|
template<typename CheckPolicy = NoCheck> |
auto | addEdge (size_t v1, size_t v2) -> decltype(e.get(0)) |
| add edge on the graph More...
|
|
void | swap (Graph_CSR< V, E, VertexList, EdgeList > &g) |
| swap the memory of g with this graph More...
|
|
auto | getVertexIterator () const -> decltype(v.getIterator()) |
| Get the vertex iterator. More...
|
|
edge_iterator< Graph_CSR< V, E,
VertexList, EdgeList, Memory > > | getEdgeIterator () const |
| Get the vertex iterator. More...
|
|
size_t | getNVertex () const |
| Return the number of the vertex. More...
|
|
size_t | getNEdge () const |
| Return the number of edges. More...
|
|
|
size_t | v_slot |
| number of slot per vertex
|
|
VertexList< V, Memory, grow_p,
openfpm::vect_isel< V >::value > | v |
| Structure that store the vertex properties.
|
|
VertexList< size_t, Memory,
grow_p, openfpm::vect_isel
< size_t >::value > | v_l |
| Structure that store the number of adjacent vertex in e_l for each vertex.
|
|
EdgeList< E, Memory, grow_p,
openfpm::vect_isel< E >::value > | e |
| Structure that store the edge properties.
|
|
EdgeList< e_map, Memory,
grow_p, openfpm::vect_isel
< e_map >::value > | e_l |
| Structure that store for each vertex the adjacent the vertex id and edge id (for property into e)
|
|
EdgeList< E, Memory, grow_p,
openfpm::vect_isel< E >::value > | e_invalid |
| invalid edge element, when a function try to create an in valid edge this object is returned
|
|
template<typename V, typename E, template< typename, typename, typename, unsigned int > class VertexList, template< typename, typename, typename, unsigned int > class EdgeList, typename Memory, typename grow_p>
Graph_CSR< V, E, VertexList, EdgeList, Memory, grow_p >::Graph_CSR |
( |
size_t |
n_vertex, |
|
|
size_t |
n_slot |
|
) |
| |
|
inline |
Constructor.
Constructor
Creating n_vertex into the graph
Creating n_vertex adjacency list counters
no edge set the counter to zero
create one invalid edge
Definition at line 455 of file map_graph.hpp.
template<typename V, typename E, template< typename, typename, typename, unsigned int > class VertexList, template< typename, typename, typename, unsigned int > class EdgeList, typename Memory, typename grow_p>
template<typename CheckPolicy = NoCheck>
auto Graph_CSR< V, E, VertexList, EdgeList, Memory, grow_p >::addEdge |
( |
size_t |
v1, |
|
|
size_t |
v2, |
|
|
const E & |
ed |
|
) |
| -> decltype(e.get(0))
|
|
inline |
add edge on the graph
add an edge on the graph
Definition at line 806 of file map_graph.hpp.
template<typename V, typename E, template< typename, typename, typename, unsigned int > class VertexList, template< typename, typename, typename, unsigned int > class EdgeList, typename Memory, typename grow_p>
template<typename CheckPolicy = NoCheck>
auto Graph_CSR< V, E, VertexList, EdgeList, Memory, grow_p >::addEdge |
( |
size_t |
v1, |
|
|
size_t |
v2 |
|
) |
| -> decltype(e.get(0))
|
|
inline |
add edge on the graph
add edge on the graph
- Parameters
-
v1 | start vertex |
v2 | end vertex |
add an edge
return the edge to change the properties
Definition at line 829 of file map_graph.hpp.
template<typename V, typename E, template< typename, typename, typename, unsigned int > class VertexList, template< typename, typename, typename, unsigned int > class EdgeList, typename Memory, typename grow_p>
template<typename CheckPolicy = NoCheck>
size_t Graph_CSR< V, E, VertexList, EdgeList, Memory, grow_p >::addEdge_ |
( |
size_t |
v1, |
|
|
size_t |
v2 |
|
) |
| |
|
inlineprivate |
add edge on the graph
add edge on the graph
- Parameters
-
v1 | start vertex |
v2 | end vertex |
Definition at line 313 of file map_graph.hpp.
template<typename V, typename E, template< typename, typename, typename, unsigned int > class VertexList, template< typename, typename, typename, unsigned int > class EdgeList, typename Memory, typename grow_p>
Graph_CSR<V, E, VertexList, EdgeList, Memory, grow_p> Graph_CSR< V, E, VertexList, EdgeList, Memory, grow_p >::duplicate |
( |
| ) |
|
|
inline |
It duplicate the graph.
- Returns
- a graph duplicate of the first
duplicate all the structures
Definition at line 413 of file map_graph.hpp.
template<typename V, typename E, template< typename, typename, typename, unsigned int > class VertexList, template< typename, typename, typename, unsigned int > class EdgeList, typename Memory, typename grow_p>
auto Graph_CSR< V, E, VertexList, EdgeList, Memory, grow_p >::edge |
( |
edge_key |
ek | ) |
-> decltype ( e.get(0) )
|
|
inline |
operator to access the edge
- Parameters
-
Definition at line 608 of file map_graph.hpp.
template<typename V, typename E, template< typename, typename, typename, unsigned int > class VertexList, template< typename, typename, typename, unsigned int > class EdgeList, typename Memory, typename grow_p>
auto Graph_CSR< V, E, VertexList, EdgeList, Memory, grow_p >::edge |
( |
size_t |
id | ) |
-> decltype ( e.get(id) )
|
|
inline |
operator to access the edge
operator to access the edge
- Parameters
-
Definition at line 620 of file map_graph.hpp.
template<typename V, typename E, template< typename, typename, typename, unsigned int > class VertexList, template< typename, typename, typename, unsigned int > class EdgeList, typename Memory, typename grow_p>
auto Graph_CSR< V, E, VertexList, EdgeList, Memory, grow_p >::edge |
( |
edge_key |
ek | ) |
const -> const decltype ( e.get(0) )
|
|
inline |
operator to access the edge
- Parameters
-
Definition at line 640 of file map_graph.hpp.
template<typename V, typename E, template< typename, typename, typename, unsigned int > class VertexList, template< typename, typename, typename, unsigned int > class EdgeList, typename Memory, typename grow_p>
auto Graph_CSR< V, E, VertexList, EdgeList, Memory, grow_p >::edge |
( |
size_t |
id | ) |
const -> const decltype ( e.get(id) )
|
|
inline |
operator to access the edge
operator to access the edge
- Parameters
-
Definition at line 652 of file map_graph.hpp.
template<typename V, typename E, template< typename, typename, typename, unsigned int > class VertexList, template< typename, typename, typename, unsigned int > class EdgeList, typename Memory, typename grow_p>
size_t Graph_CSR< V, E, VertexList, EdgeList, Memory, grow_p >::getNChilds |
( |
size_t |
c | ) |
const |
|
inline |
Return the number of childs of a vertex.
- Parameters
-
- Returns
- the number of childs
Definition at line 665 of file map_graph.hpp.
template<typename V, typename E, template< typename, typename, typename, unsigned int > class VertexList, template< typename, typename, typename, unsigned int > class EdgeList, typename Memory, typename grow_p>
size_t Graph_CSR< V, E, VertexList, EdgeList, Memory, grow_p >::getNChilds |
( |
typename VertexList< V, Memory, grow_p, openfpm::vect_isel< V >::value >::iterator_key & |
c | ) |
|
|
inline |
Return the number of childs of a vertex.
- Parameters
-
- Returns
- the number of childs
Definition at line 679 of file map_graph.hpp.
template<typename V, typename E, template< typename, typename, typename, unsigned int > class VertexList, template< typename, typename, typename, unsigned int > class EdgeList, typename Memory, typename grow_p>
size_t Graph_CSR< V, E, VertexList, EdgeList, Memory, grow_p >::getNEdge |
( |
| ) |
const |
|
inline |
Return the number of edges.
- Returns
- the number of edges
Definition at line 902 of file map_graph.hpp.
template<typename V, typename E, template< typename, typename, typename, unsigned int > class VertexList, template< typename, typename, typename, unsigned int > class EdgeList, typename Memory, typename grow_p>
size_t Graph_CSR< V, E, VertexList, EdgeList, Memory, grow_p >::getNVertex |
( |
| ) |
const |
|
inline |
Return the number of the vertex.
- Returns
- the number of vertex
Definition at line 891 of file map_graph.hpp.
template<typename V, typename E, template< typename, typename, typename, unsigned int > class VertexList, template< typename, typename, typename, unsigned int > class EdgeList, typename Memory, typename grow_p>
void Graph_CSR< V, E, VertexList, EdgeList, Memory, grow_p >::swap |
( |
Graph_CSR< V, E, VertexList, EdgeList > & |
g | ) |
|
|
inline |
swap the memory of g with this graph
swap the memory of g with this graph, it is basically used for move semantic
Definition at line 848 of file map_graph.hpp.
template<typename V, typename E, template< typename, typename, typename, unsigned int > class VertexList, template< typename, typename, typename, unsigned int > class EdgeList, typename Memory, typename grow_p>
auto Graph_CSR< V, E, VertexList, EdgeList, Memory, grow_p >::vertex |
( |
size_t |
id | ) |
-> decltype( v.get(id) )
|
|
inline |
Function to access the vertexes.
- Parameters
-
id | of the vertex to access |
Definition at line 508 of file map_graph.hpp.
template<typename V, typename E, template< typename, typename, typename, unsigned int > class VertexList, template< typename, typename, typename, unsigned int > class EdgeList, typename Memory, typename grow_p>
auto Graph_CSR< V, E, VertexList, EdgeList, Memory, grow_p >::vertex |
( |
grid_key_dx< 1 > |
id | ) |
-> decltype( v.get(id.get(0)) )
|
|
inline |
operator to access the vertex
operator to access the vertex
- Parameters
-
id | of the vertex to access |
Definition at line 520 of file map_graph.hpp.
template<typename V, typename E, template< typename, typename, typename, unsigned int > class VertexList, template< typename, typename, typename, unsigned int > class EdgeList, typename Memory, typename grow_p>
operator to access the vertex
operator to access the vertex
- Parameters
-
id | of the vertex to access |
Definition at line 532 of file map_graph.hpp.
template<typename V, typename E, template< typename, typename, typename, unsigned int > class VertexList, template< typename, typename, typename, unsigned int > class EdgeList, typename Memory, typename grow_p>
auto Graph_CSR< V, E, VertexList, EdgeList, Memory, grow_p >::vertex |
( |
size_t |
id | ) |
const -> const decltype( v.get(id) )
|
|
inline |
Function to access the vertexes.
- Parameters
-
id | of the vertex to access |
Definition at line 542 of file map_graph.hpp.
template<typename V, typename E, template< typename, typename, typename, unsigned int > class VertexList, template< typename, typename, typename, unsigned int > class EdgeList, typename Memory, typename grow_p>
auto Graph_CSR< V, E, VertexList, EdgeList, Memory, grow_p >::vertex |
( |
grid_key_dx< 1 > |
id | ) |
const -> const decltype( v.get(id.get(0)) )
|
|
inline |
operator to access the vertex
operator to access the vertex
- Parameters
-
id | of the vertex to access |
Definition at line 554 of file map_graph.hpp.
template<typename V, typename E, template< typename, typename, typename, unsigned int > class VertexList, template< typename, typename, typename, unsigned int > class EdgeList, typename Memory, typename grow_p>
operator to access the vertex
operator to access the vertex
- Parameters
-
id | of the vertex to access |
Definition at line 566 of file map_graph.hpp.
template<typename V, typename E, template< typename, typename, typename, unsigned int > class VertexList, template< typename, typename, typename, unsigned int > class EdgeList, typename Memory, typename grow_p>
template<unsigned int i>
auto Graph_CSR< V, E, VertexList, EdgeList, Memory, grow_p >::vertex_p |
( |
size_t |
id | ) |
-> decltype( v.template get<i>(id) )
|
|
inline |
operator to access the vertex
operator to access the vertex
- Template Parameters
-
- Parameters
-
id | of the vertex to access |
Definition at line 487 of file map_graph.hpp.