Structure that store a graph in CSR format or basically in compressed adjacency matrix format.
More...
template<typename V, typename E = no_edge, typename Memory = HeapMemory, template< typename > class layout_v_base = memory_traits_lin, template< typename > class layout_e_base = memory_traits_lin, typename grow_p = openfpm::grow_policy_double>
class Graph_CSR< V, E, Memory, layout_v_base, layout_e_base, 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
Test structure used for several test.
Create a Cartesian graph
for (size_t i = 0 ; i < GS_SIZE ; i++)
{
for (size_t j = 0 ; j < GS_SIZE ; j++)
{
}
}
size_t gs[2] = {GS_SIZE,GS_SIZE};
for (size_t i = 0 ; i < GS_SIZE ; i++)
{
for (size_t j = 0 ; j < GS_SIZE ; j++)
{
}
}
Class to check if the edge can be created or not.
Structure that store a graph in CSR format or basically in compressed adjacency matrix format.
void addVertex(const V &vrt)
add vertex
auto addEdge(size_t v1, size_t v2, const E &ed) -> decltype(e.get(0))
add edge on the graph
Create a tree graph with no edge properties
Definition at line 304 of file map_graph.hpp.
|
bool | operator== (const Graph_CSR< V, E, Memory, layout_v_base, layout_e_base, grow_p > &g) const |
| Check if two graph exactly match.
|
|
Graph_CSR< V, E, Memory, layout_v_base, layout_e_base, grow_p > | duplicate () const |
| It duplicate the graph.
|
|
| Graph_CSR () |
| Constructor.
|
|
| Graph_CSR (size_t n_vertex) |
| Constructor.
|
|
| Graph_CSR (size_t n_vertex, size_t n_slot) |
| Constructor.
|
|
| Graph_CSR (Graph_CSR< V, E, Memory > &&g) |
| Copy constructor.
|
|
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
|
|
template<unsigned int i> |
auto | vertex_p (grid_key_dx< 1 > id) -> decltype(v.template get< i >(id)) |
| Access the vertex.
|
|
auto | vertex (size_t id) -> decltype(v.get(id)) |
| Function to access the vertex.
|
|
auto | vertex (grid_key_dx< 1 > id) -> decltype(v.get(id.get(0))) |
| Function to access the vertex.
|
|
auto | vertex (openfpm::vector_key_iterator id) -> decltype(v.get(0)) |
| Fuction to access the vertex.
|
|
auto | vertex (size_t id) const -> const decltype(v.get(id)) |
| Function to access the vertex.
|
|
auto | vertex (grid_key_dx< 1 > id) const -> const decltype(v.get(id.get(0))) |
| Fuction to access the vertex.
|
|
auto | vertex (openfpm::vector_key_iterator id) const -> const decltype(v.get(0)) |
| operator to access the vertex
|
|
void | clear () |
| operator to clear the whole graph
|
|
void | destroy () |
| operator to clear the whole graph
|
|
template<unsigned int i> |
auto | edge_p (grid_key_dx< 1 > id) -> decltype(e.template get< i >(id)) |
| Access the edge.
|
|
template<unsigned int i> |
auto | edge_p (size_t id) -> decltype(e.template get< i >(id)) |
| Access the edge.
|
|
auto | edge (edge_key ek) const -> const decltype(e.get(0)) |
| operator to access the edge
|
|
auto | edge (size_t id) const -> const decltype(e.get(id)) |
| operator to access the edge
|
|
auto | edge (grid_key_dx< 1 > id) const -> const decltype(e.get(id.get(0))) |
| Access the edge.
|
|
size_t | getNChilds (size_t c) const |
| Return the number of childs of a vertex.
|
|
size_t | getNChilds (typename openfpm::vector< V, Memory, layout_v_base, grow_p, openfpm::vect_isel< V >::value >::iterator_key &c) |
| Return the number of childs of a vertex.
|
|
auto | getChildEdge (size_t v, size_t v_e) -> decltype(e.get(0)) |
| Get the vertex edge.
|
|
size_t | getChild (size_t v, size_t i) const |
| Get the child vertex id.
|
|
size_t | getChild (typename openfpm::vector< V, Memory, layout_v_base, grow_p >::iterator_key &v, size_t i) |
| Get the child edge.
|
|
void | addVertex (const V &vrt) |
| add vertex
|
|
void | addVertex () |
| add an empty vertex
|
|
template<typename CheckPolicy = NoCheck> |
auto | addEdge (size_t v1, size_t v2, const E &ed) -> decltype(e.get(0)) |
| add edge on the graph
|
|
template<typename CheckPolicy = NoCheck> |
auto | addEdge (size_t v1, size_t v2) -> decltype(e.get(0)) |
| add edge on the graph
|
|
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
|
|
void | swap (Graph_CSR< V, E > &g) |
| swap the memory of g with this graph
|
|
void | swap (Graph_CSR< V, E > &&g) |
| swap the memory of g with this graph
|
|
auto | getVertexIterator () const -> decltype(v.getIterator()) |
| Get the vertex iterator.
|
|
edge_iterator< Graph_CSR< V, E, Memory > > | getEdgeIterator () const |
| Get the vertex iterator.
|
|
size_t | getNVertex () const |
| Return the number of the vertex.
|
|
size_t | getNEdge () const |
| Return the number of edges.
|
|
|
size_t | v_slot |
| number of slot per vertex
|
|
openfpm::vector< V, Memory, layout_v_base, grow_p, openfpm::vect_isel< V >::value > | v |
| Structure that store the vertex properties.
|
|
openfpm::vector< size_t, Memory, 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_base, grow_p, openfpm::vect_isel< E >::value > | e |
| Structure that store the edge properties.
|
|
openfpm::vector< e_map, Memory, 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_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
|
|
template<typename V , typename E = no_edge, typename Memory = HeapMemory, template< typename > class layout_v_base = memory_traits_lin, template< typename > class layout_e_base = memory_traits_lin, typename grow_p = openfpm::grow_policy_double>
template<typename CheckPolicy = NoCheck, int sgid, int dgid>
auto Graph_CSR< V, E, Memory, layout_v_base, layout_e_base, grow_p >::addEdge |
( |
size_t |
v1, |
|
|
size_t |
v2, |
|
|
size_t |
srcgid, |
|
|
size_t |
dstgid |
|
) |
| -> decltype(e.get(0))
|
|
inline |
add edge on the graph and fill source and destination informations
add edge on the graph
- Parameters
-
v1 | start vertex |
v2 | end vertex |
srcgid | source global id |
dstgid | destination global id |
- Template Parameters
-
sgid | property id filled with the source vertex global id |
dgid | property id filled with the destination vertex global id |
- Returns
- the edge object
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 952 of file map_graph.hpp.