Structure that store a graph in CSR format or basically in compressed adjacency matrix format. More...
Structure that store a graph in CSR format or basically in compressed adjacency matrix format.
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 |
Definition at line 83 of file map_graph.hpp.
#include <map_graph.hpp>
Public Types | |
typedef V | V_type |
Vertex typedef. | |
typedef E | E_type |
Edge typedef. | |
typedef openfpm::vector< V, Memory, layout_v, layout_v_base, grow_p, openfpm::vect_isel< V >::value > ::container | V_container |
Object container for the vertex, for example can be encap<...> (map_grid or openfpm::vector) | |
typedef openfpm::vector< E, Memory, layout_e, layout_e_base, grow_p, openfpm::vect_isel< E >::value > ::container | E_container |
Object container for the edge, for example can be encap<...> (map_grid or openfpm::vector) | |
Public Member Functions | |
bool | operator== (const Graph_CSR< V, E, Memory, layout_v, layout_e, layout_v_base, layout_e_base, grow_p > &g) const |
Check if two graph exactly match. More... | |
Graph_CSR< V, E, Memory, layout_v, layout_e, layout_v_base, layout_e_base, grow_p > | duplicate () const |
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, Memory > &&g) | |
Copy constructor. More... | |
Graph_CSR< V, E, Memory > & | operator= (Graph_CSR< V, E, Memory > &&g) |
Graph_CSR< V, E, Memory > & | operator= (const Graph_CSR< V, E, Memory > &g) |
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 vertex. More... | |
auto | vertex (grid_key_dx< 1 > id) -> decltype(v.get(id.get(0))) |
Function to access the vertex. More... | |
auto | vertex (openfpm::vector_key_iterator id) -> decltype(v.get(0)) |
Fuction to access the vertex. More... | |
auto | vertex (size_t id) const -> const decltype(v.get(id)) |
Function to access the vertex. More... | |
auto | vertex (grid_key_dx< 1 > id) const -> const decltype(v.get(id.get(0))) |
Fuction to access the vertex. More... | |
auto | vertex (openfpm::vector_key_iterator id) const -> const decltype(v.get(0)) |
operator to access the vertex More... | |
void | clear () |
operator to clear the whole graph 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 (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... | |
auto | edge (grid_key_dx< 1 > id) const -> const decltype(e.get(id.get(0))) |
Access the edge. More... | |
size_t | getNChilds (size_t c) const |
Return the number of childs of a vertex. More... | |
size_t | getNChilds (typename openfpm::vector< V, Memory, layout_v, layout_v_base, 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 vertex id. More... | |
size_t | getChild (typename openfpm::vector< V, Memory, layout_v, layout_v_base, grow_p >::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... | |
template<typename CheckPolicy = NoCheck, int sgid, int dgid> | |
auto | addEdge (size_t v1, size_t v2, size_t srcgid, size_t dstgid) -> decltype(e.get(0)) |
add edge on the graph and fill source and destination informations More... | |
void | swap (Graph_CSR< V, E > &g) |
swap the memory of g with this graph More... | |
void | swap (Graph_CSR< V, E > &&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, 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... | |
Private Member Functions | |
template<typename CheckPolicy = NoCheck> | |
size_t | addEdge_ (size_t v1, size_t v2) |
add edge on the graph More... | |
Private Attributes | |
size_t | v_slot |
number of slot per vertex | |
openfpm::vector< V, Memory, layout_v, layout_v_base, grow_p, openfpm::vect_isel< V > ::value > | v |
Structure that store the vertex properties. | |
openfpm::vector< size_t, Memory, typename layout_v_base < size_t >::type, layout_v_base, grow_p, openfpm::vect_isel< size_t > ::value > | v_l |
Structure that store the number of adjacent vertex in e_l for each vertex. | |
openfpm::vector< E, Memory, layout_e, layout_e_base, grow_p, openfpm::vect_isel< E > ::value > | e |
Structure that store the edge properties. | |
openfpm::vector< e_map, Memory, typename layout_e_base< e_map > ::type, layout_e_base, 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) | |
openfpm::vector< E, Memory, layout_e, layout_e_base, 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 | |
|
inline |
Constructor.
Constructor
n_vertex | number of vertex has a graph |
Definition at line 497 of file map_graph.hpp.
|
inline |
Constructor.
n_vertex | number of vertices |
n_slot | number of slots (around how many edge has a vertex, it is not fundamental parameter is just an indication) |
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 510 of file map_graph.hpp.
|
inline |
|
inline |
add edge on the graph
v1 | source edge |
v2 | destination edge |
ed | edge object to add |
Definition at line 884 of file map_graph.hpp.
|
inline |
add edge on the graph
add edge on the graph
v1 | start vertex |
v2 | end vertex |
add an edge
return the edge to change the properties
Definition at line 908 of file map_graph.hpp.
|
inline |
add edge on the graph and fill source and destination informations
add edge on the graph
v1 | start vertex |
v2 | end vertex |
srcgid | source global id |
dstgid | destination global id |
sgid | property id filled with the source vertex global id |
dgid | property id filled with the destination vertex global id |
add an edge
If there is not edge return an invalid edge, is a kind of stub object
set source and destination ids of the edge
return the edge to change the properties
Definition at line 936 of file map_graph.hpp.
|
inlineprivate |
add edge on the graph
add edge on the graph
v1 | start vertex |
v2 | end vertex |
Definition at line 339 of file map_graph.hpp.
|
inline |
|
inline |
add an empty vertex
Definition at line 861 of file map_graph.hpp.
|
inline |
operator to clear the whole graph
operator to clear all
Definition at line 672 of file map_graph.hpp.
|
inline |
It duplicate the graph.
duplicate all the structures
Definition at line 463 of file map_graph.hpp.
|
inline |
operator to access the edge
ek | key of the edge |
Definition at line 715 of file map_graph.hpp.
|
inline |
operator to access the edge
id | of the edge to access |
Definition at line 727 of file map_graph.hpp.
|
inline |
Access the edge.
id | of the edge to access |
Definition at line 739 of file map_graph.hpp.
|
inline |
Access the edge.
i | property to access |
id | of the edge to access |
Definition at line 689 of file map_graph.hpp.
|
inline |
Access the edge.
i | property to access |
id | of the edge to access |
Definition at line 702 of file map_graph.hpp.
|
inline |
Get the child vertex id.
v | node |
i | child at position i |
Definition at line 796 of file map_graph.hpp.
|
inline |
Get the child edge.
v | node |
i | child at position i |
Definition at line 821 of file map_graph.hpp.
|
inline |
Get the vertex edge.
v | vertex |
v_e | edge id |
Definition at line 781 of file map_graph.hpp.
|
inline |
Get the vertex iterator.
Get the vertex iterator
Definition at line 1018 of file map_graph.hpp.
|
inline |
Return the number of childs of a vertex.
c | Child id |
Definition at line 752 of file map_graph.hpp.
|
inline |
Return the number of childs of a vertex.
c | child id |
Definition at line 766 of file map_graph.hpp.
|
inline |
Return the number of edges.
Definition at line 1040 of file map_graph.hpp.
|
inline |
Return the number of the vertex.
Definition at line 1029 of file map_graph.hpp.
|
inline |
Get the vertex iterator.
Get the vertex iterator
Definition at line 1005 of file map_graph.hpp.
|
inline |
Copy the graph
g | graph to copy |
Definition at line 540 of file map_graph.hpp.
|
inline |
|
inline |
Check if two graph exactly match.
g | Graph to compare |
Definition at line 442 of file map_graph.hpp.
|
inline |
swap the memory of g with this graph
it is basically used for move semantic
g | graph to swap |
Definition at line 960 of file map_graph.hpp.
|
inline |
swap the memory of g with this graph
it is basically used for move semantic
g | graph to swap |
Definition at line 982 of file map_graph.hpp.
|
inline |
Function to access the vertex.
id | of the vertex to access |
Definition at line 600 of file map_graph.hpp.
|
inline |
Function to access the vertex.
id | of the vertex to access |
Definition at line 612 of file map_graph.hpp.
|
inline |
Fuction to access the vertex.
id | of the vertex to access |
Definition at line 624 of file map_graph.hpp.
|
inline |
Function to access the vertex.
id | of the vertex to access |
Definition at line 636 of file map_graph.hpp.
|
inline |
Fuction to access the vertex.
operator to access the vertex
id | of the vertex to access |
Definition at line 650 of file map_graph.hpp.
|
inline |
operator to access the vertex
id | of the vertex to access |
Definition at line 662 of file map_graph.hpp.
|
inline |
operator to access the vertex
operator to access the vertex
i | property to access |
id | of the vertex to access |
Definition at line 574 of file map_graph.hpp.
|
inline |
Access the vertex.
i | property to access |
id | of the vertex to access |
Definition at line 588 of file map_graph.hpp.