OpenFPM_pdata  4.1.0
Project that contain the implementation of distributed structures
 
Loading...
Searching...
No Matches
Graph_CSR< V, E, Memory, layout_v_base, layout_e_base, grow_p > Class Template Reference

Structure that store a graph in CSR format or basically in compressed adjacency matrix format. More...

Detailed Description

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
Veach vertex will encapsulate have this type
Eeach edge will encapsulate this type
deviceType 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
VertexListstructure that store the list of Vertex
EdgeListstructure 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

typedef Point_test<float> V;
typedef Point_test<float> E;
Test structure used for several test.

Create a Cartesian graph

// first create the vertex
for (size_t i = 0 ; i < GS_SIZE ; i++)
{
for (size_t j = 0 ; j < GS_SIZE ; j++)
{
// Add vertex
g.addVertex(p);
}
}
// than create the edge
// Create a grid, // NOTE this does not produce any memory grid, it retain only the information
// and give a set of usefull function
/* std::vector<size_t> gs;
gs.push_back(GS_SIZE);
gs.push_back(GS_SIZE);*/
size_t gs[2] = {GS_SIZE,GS_SIZE};
// Create the edge 4 for each vertex
for (size_t i = 0 ; i < GS_SIZE ; i++)
{
for (size_t j = 0 ; j < GS_SIZE ; j++)
{
// Add 4 edge
g.addEdge<CheckExistence>(g2.Lin(i,j),g2.Lin(i+1,j),p);
g.addEdge<CheckExistence>(g2.Lin(i,j),g2.Lin(i,j+1),p);
g.addEdge<CheckExistence>(g2.Lin(i,j),g2.Lin(i-1,j),p);
g.addEdge<CheckExistence>(g2.Lin(i,j),g2.Lin(i,j-1),p);
}
}
Class to check if the edge can be created or not.
Definition grid_sm.hpp:82
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
Declaration grid_sm.
Definition grid_sm.hpp:167

Create a tree graph with no edge properties

Graph_CSR<V> g_no_edge;
// Create a tree
// root
g_no_edge.addVertex(p);
// 2 leaf
g_no_edge.addVertex(p);
g_no_edge.addEdge(0,1);
g_no_edge.addVertex(p);
g_no_edge.addEdge(0,2);
// 4 leaf
g_no_edge.addVertex(p);
g_no_edge.addEdge(1,3);
g_no_edge.addVertex(p);
g_no_edge.addEdge(1,4);
g_no_edge.addVertex(p);
g_no_edge.addEdge(2,5);
g_no_edge.addVertex(p);
g_no_edge.addEdge(2,6);
// 8 leaf
g_no_edge.addVertex(p);
g_no_edge.addEdge(3,7);
g_no_edge.addVertex(p);
g_no_edge.addEdge(3,8);
g_no_edge.addVertex(p);
g_no_edge.addEdge(4,9);
g_no_edge.addVertex(p);
g_no_edge.addEdge(4,10);
g_no_edge.addVertex(p);
g_no_edge.addEdge(5,11);
g_no_edge.addVertex(p);
g_no_edge.addEdge(5,12);
g_no_edge.addVertex(p);
g_no_edge.addEdge(6,13);
g_no_edge.addVertex(p);
g_no_edge.addEdge(6,14);

Definition at line 304 of file map_graph.hpp.

#include <map_graph.hpp>

+ Inheritance diagram for Graph_CSR< V, E, Memory, layout_v_base, layout_e_base, grow_p >:

Public Types

typedef V V_type
 Vertex typedef.
 
typedef E E_type
 Edge typedef.
 
typedef openfpm::vector< V, Memory, 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_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_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.
 

Private Member Functions

template<typename CheckPolicy = NoCheck>
size_t addEdge_ (size_t v1, size_t v2)
 add edge on the graph
 

Private Attributes

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
 

Member Typedef Documentation

◆ E_container

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>
typedef openfpm::vector<E,Memory,layout_e_base,grow_p,openfpm::vect_isel<E>::value>::container Graph_CSR< V, E, Memory, layout_v_base, layout_e_base, grow_p >::E_container

Object container for the edge, for example can be encap<...> (map_grid or openfpm::vector)

Definition at line 427 of file map_graph.hpp.

◆ E_type

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>
typedef E Graph_CSR< V, E, Memory, layout_v_base, layout_e_base, grow_p >::E_type

Edge typedef.

Definition at line 421 of file map_graph.hpp.

◆ V_container

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>
typedef openfpm::vector<V,Memory,layout_v_base,grow_p,openfpm::vect_isel<V>::value>::container Graph_CSR< V, E, Memory, layout_v_base, layout_e_base, grow_p >::V_container

Object container for the vertex, for example can be encap<...> (map_grid or openfpm::vector)

Definition at line 424 of file map_graph.hpp.

◆ V_type

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>
typedef V Graph_CSR< V, E, Memory, layout_v_base, layout_e_base, grow_p >::V_type

Vertex typedef.

Definition at line 418 of file map_graph.hpp.

Constructor & Destructor Documentation

◆ Graph_CSR() [1/4]

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>
Graph_CSR< V, E, Memory, layout_v_base, layout_e_base, grow_p >::Graph_CSR ( )
inline

Constructor.

Constructor

Definition at line 481 of file map_graph.hpp.

◆ Graph_CSR() [2/4]

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>
Graph_CSR< V, E, Memory, layout_v_base, layout_e_base, grow_p >::Graph_CSR ( size_t  n_vertex)
inline

Constructor.

Constructor

Parameters
n_vertexnumber of vertex has a graph

Definition at line 493 of file map_graph.hpp.

◆ Graph_CSR() [3/4]

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>
Graph_CSR< V, E, Memory, layout_v_base, layout_e_base, grow_p >::Graph_CSR ( size_t  n_vertex,
size_t  n_slot 
)
inline

Constructor.

Parameters
n_vertexnumber of vertices
n_slotnumber 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 506 of file map_graph.hpp.

◆ Graph_CSR() [4/4]

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>
Graph_CSR< V, E, Memory, layout_v_base, layout_e_base, grow_p >::Graph_CSR ( Graph_CSR< V, E, Memory > &&  g)
inline

Copy constructor.

Parameters
gGraph to copy

Definition at line 524 of file map_graph.hpp.

Member Function Documentation

◆ addEdge() [1/3]

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>
auto Graph_CSR< V, E, Memory, layout_v_base, layout_e_base, 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
v1start vertex
v2end vertex
Returns
the edge object

add an edge

return the edge to change the properties

Definition at line 924 of file map_graph.hpp.

◆ addEdge() [2/3]

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>
auto Graph_CSR< V, E, Memory, layout_v_base, layout_e_base, grow_p >::addEdge ( size_t  v1,
size_t  v2,
const E &  ed 
) -> decltype(e.get(0))
inline

add edge on the graph

Parameters
v1source edge
v2destination edge
ededge object to add
Returns
edge object

Definition at line 900 of file map_graph.hpp.

◆ addEdge() [3/3]

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
v1start vertex
v2end vertex
srcgidsource global id
dstgiddestination global id
Template Parameters
sgidproperty id filled with the source vertex global id
dgidproperty 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.

◆ addEdge_()

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>
size_t Graph_CSR< V, E, Memory, layout_v_base, layout_e_base, grow_p >::addEdge_ ( size_t  v1,
size_t  v2 
)
inlineprivate

add edge on the graph

add edge on the graph

Parameters
v1start vertex
v2end vertex
Returns
the edge id

Definition at line 335 of file map_graph.hpp.

◆ addVertex() [1/2]

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>
void Graph_CSR< V, E, Memory, layout_v_base, layout_e_base, grow_p >::addVertex ( )
inline

add an empty vertex

Definition at line 877 of file map_graph.hpp.

◆ addVertex() [2/2]

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>
void Graph_CSR< V, E, Memory, layout_v_base, layout_e_base, grow_p >::addVertex ( const V &  vrt)
inline

add vertex

Parameters
vrtVertex properties

Definition at line 860 of file map_graph.hpp.

◆ clear()

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>
void Graph_CSR< V, E, Memory, layout_v_base, layout_e_base, grow_p >::clear ( )
inline

operator to clear the whole graph

operator to clear all

Definition at line 668 of file map_graph.hpp.

◆ destroy()

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>
void Graph_CSR< V, E, Memory, layout_v_base, layout_e_base, grow_p >::destroy ( )
inline

operator to clear the whole graph

operator to clear all

Definition at line 683 of file map_graph.hpp.

◆ duplicate()

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>
Graph_CSR< V, E, Memory, layout_v_base, layout_e_base, grow_p > Graph_CSR< V, E, Memory, layout_v_base, layout_e_base, grow_p >::duplicate ( ) const
inline

It duplicate the graph.

Returns
a graph duplicate of the first

duplicate all the structures

Definition at line 459 of file map_graph.hpp.

◆ edge() [1/3]

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>
auto Graph_CSR< V, E, Memory, layout_v_base, layout_e_base, grow_p >::edge ( edge_key  ek) const -> const decltype ( e.get(0) )
inline

operator to access the edge

Parameters
ekkey of the edge
Returns
the edge object

Definition at line 731 of file map_graph.hpp.

◆ edge() [2/3]

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>
auto Graph_CSR< V, E, Memory, layout_v_base, layout_e_base, grow_p >::edge ( grid_key_dx< 1 >  id) const -> const decltype ( e.get(id.get(0)) )
inline

Access the edge.

Parameters
idof the edge to access
Returns
the edge object

Definition at line 755 of file map_graph.hpp.

◆ edge() [3/3]

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>
auto Graph_CSR< V, E, Memory, layout_v_base, layout_e_base, grow_p >::edge ( size_t  id) const -> const decltype ( e.get(id) )
inline

operator to access the edge

Parameters
idof the edge to access
Returns
the edge object

Definition at line 743 of file map_graph.hpp.

◆ edge_p() [1/2]

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<unsigned int i>
auto Graph_CSR< V, E, Memory, layout_v_base, layout_e_base, grow_p >::edge_p ( grid_key_dx< 1 >  id) -> decltype ( e.template get<i>(id) )
inline

Access the edge.

Template Parameters
iproperty to access
Parameters
idof the edge to access
Returns
a reference to the edge property

Definition at line 705 of file map_graph.hpp.

◆ edge_p() [2/2]

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<unsigned int i>
auto Graph_CSR< V, E, Memory, layout_v_base, layout_e_base, grow_p >::edge_p ( size_t  id) -> decltype ( e.template get<i>(id) )
inline

Access the edge.

Template Parameters
iproperty to access
Parameters
idof the edge to access
Returns
a reference to the edge property

Definition at line 718 of file map_graph.hpp.

◆ getChild() [1/2]

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>
size_t Graph_CSR< V, E, Memory, layout_v_base, layout_e_base, grow_p >::getChild ( size_t  v,
size_t  i 
) const
inline

Get the child vertex id.

Parameters
vnode
ichild at position i
Returns
the target vertex id that connect v with the target vertex at position i

Definition at line 812 of file map_graph.hpp.

◆ getChild() [2/2]

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>
size_t Graph_CSR< V, E, Memory, layout_v_base, layout_e_base, grow_p >::getChild ( typename openfpm::vector< V, Memory, layout_v_base, grow_p >::iterator_key &  v,
size_t  i 
)
inline

Get the child edge.

Parameters
vnode
ichild at position i
Returns
the target i connected by an edge node, for the node v

Definition at line 837 of file map_graph.hpp.

◆ getChildEdge()

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>
auto Graph_CSR< V, E, Memory, layout_v_base, layout_e_base, grow_p >::getChildEdge ( size_t  v,
size_t  v_e 
) -> decltype(e.get(0))
inline

Get the vertex edge.

Parameters
vvertex
v_eedge id
Returns
the edge object

Definition at line 797 of file map_graph.hpp.

◆ getEdgeIterator()

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>
edge_iterator< Graph_CSR< V, E, Memory > > Graph_CSR< V, E, Memory, layout_v_base, layout_e_base, grow_p >::getEdgeIterator ( ) const
inline

Get the vertex iterator.

Get the vertex iterator

Returns
an iterator to iterate through all the edges

Definition at line 1034 of file map_graph.hpp.

◆ getNChilds() [1/2]

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>
size_t Graph_CSR< V, E, Memory, layout_v_base, layout_e_base, grow_p >::getNChilds ( size_t  c) const
inline

Return the number of childs of a vertex.

Parameters
cChild id
Returns
the number of childs

Definition at line 768 of file map_graph.hpp.

◆ getNChilds() [2/2]

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>
size_t Graph_CSR< V, E, Memory, layout_v_base, layout_e_base, grow_p >::getNChilds ( typename openfpm::vector< V, Memory, layout_v_base, grow_p, openfpm::vect_isel< V >::value >::iterator_key &  c)
inline

Return the number of childs of a vertex.

Parameters
cchild id
Returns
the number of childs

Definition at line 782 of file map_graph.hpp.

◆ getNEdge()

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>
size_t Graph_CSR< V, E, Memory, layout_v_base, layout_e_base, grow_p >::getNEdge ( ) const
inline

Return the number of edges.

Returns
the number of edges

Definition at line 1056 of file map_graph.hpp.

◆ getNVertex()

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>
size_t Graph_CSR< V, E, Memory, layout_v_base, layout_e_base, grow_p >::getNVertex ( ) const
inline

Return the number of the vertex.

Returns
the number of vertex

Definition at line 1045 of file map_graph.hpp.

◆ getVertexIterator()

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>
auto Graph_CSR< V, E, Memory, layout_v_base, layout_e_base, grow_p >::getVertexIterator ( ) const -> decltype(v.getIterator())
inline

Get the vertex iterator.

Get the vertex iterator

Returns
an iterator to iterate through all the vertex

Definition at line 1021 of file map_graph.hpp.

◆ operator=() [1/2]

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>
Graph_CSR< V, E, Memory > & Graph_CSR< V, E, Memory, layout_v_base, layout_e_base, grow_p >::operator= ( const Graph_CSR< V, E, Memory > &  g)
inline

\breif Copy the graph

Parameters
ggraph to copy

Definition at line 551 of file map_graph.hpp.

◆ operator=() [2/2]

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>
Graph_CSR< V, E, Memory > & Graph_CSR< V, E, Memory, layout_v_base, layout_e_base, grow_p >::operator= ( Graph_CSR< V, E, Memory > &&  g)
inline

\breif Copy the graph

Parameters
ggraph to copy
Returns
itself

Definition at line 536 of file map_graph.hpp.

◆ operator==()

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>
bool Graph_CSR< V, E, Memory, layout_v_base, layout_e_base, grow_p >::operator== ( const Graph_CSR< V, E, Memory, layout_v_base, layout_e_base, grow_p > &  g) const
inline

Check if two graph exactly match.

Warning
The requirement to match is more restrictive than simply content matching
Parameters
gGraph to compare
Returns
true if they match

Definition at line 438 of file map_graph.hpp.

◆ swap() [1/2]

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>
void Graph_CSR< V, E, Memory, layout_v_base, layout_e_base, grow_p >::swap ( Graph_CSR< V, E > &&  g)
inline

swap the memory of g with this graph

it is basically used for move semantic

Parameters
ggraph to swap

Definition at line 998 of file map_graph.hpp.

◆ swap() [2/2]

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>
void Graph_CSR< V, E, Memory, layout_v_base, layout_e_base, grow_p >::swap ( Graph_CSR< V, E > &  g)
inline

swap the memory of g with this graph

it is basically used for move semantic

Parameters
ggraph to swap

Definition at line 976 of file map_graph.hpp.

◆ vertex() [1/6]

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>
auto Graph_CSR< V, E, Memory, layout_v_base, layout_e_base, grow_p >::vertex ( grid_key_dx< 1 >  id) -> decltype( v.get(id.get(0)) )
inline

Function to access the vertex.

Parameters
idof the vertex to access
Returns
the vertex object

Definition at line 608 of file map_graph.hpp.

◆ vertex() [2/6]

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>
auto Graph_CSR< V, E, Memory, layout_v_base, layout_e_base, grow_p >::vertex ( grid_key_dx< 1 >  id) const -> const decltype( v.get(id.get(0)) )
inline

Fuction to access the vertex.

operator to access the vertex

Parameters
idof the vertex to access
Returns
the vertex object

Definition at line 646 of file map_graph.hpp.

◆ vertex() [3/6]

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>
auto Graph_CSR< V, E, Memory, layout_v_base, layout_e_base, grow_p >::vertex ( openfpm::vector_key_iterator  id) -> decltype( v.get(0) )
inline

Fuction to access the vertex.

Parameters
idof the vertex to access
Returns
the vertex object

Definition at line 620 of file map_graph.hpp.

◆ vertex() [4/6]

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>
auto Graph_CSR< V, E, Memory, layout_v_base, layout_e_base, grow_p >::vertex ( openfpm::vector_key_iterator  id) const -> const decltype( v.get(0) )
inline

operator to access the vertex

Parameters
idof the vertex to access
Returns
the vertex object

Definition at line 658 of file map_graph.hpp.

◆ vertex() [5/6]

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>
auto Graph_CSR< V, E, Memory, layout_v_base, layout_e_base, grow_p >::vertex ( size_t  id) -> decltype( v.get(id) )
inline

Function to access the vertex.

Parameters
idof the vertex to access
Returns
vertex object

Definition at line 596 of file map_graph.hpp.

◆ vertex() [6/6]

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>
auto Graph_CSR< V, E, Memory, layout_v_base, layout_e_base, grow_p >::vertex ( size_t  id) const -> const decltype( v.get(id) )
inline

Function to access the vertex.

Parameters
idof the vertex to access
Returns
the vertex object

Definition at line 632 of file map_graph.hpp.

◆ vertex_p() [1/2]

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<unsigned int i>
auto Graph_CSR< V, E, Memory, layout_v_base, layout_e_base, grow_p >::vertex_p ( grid_key_dx< 1 >  id) -> decltype( v.template get<i>(id) )
inline

Access the vertex.

Template Parameters
iproperty to access
Parameters
idof the vertex to access
Returns
the reference of the property vertex

Definition at line 584 of file map_graph.hpp.

◆ vertex_p() [2/2]

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<unsigned int i>
auto Graph_CSR< V, E, Memory, layout_v_base, layout_e_base, 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
iproperty to access
Parameters
idof the vertex to access
Returns
the reference of the property vertex

Definition at line 570 of file map_graph.hpp.

Field Documentation

◆ e

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>
openfpm::vector<E, Memory, layout_e_base, grow_p, openfpm::vect_isel<E>::value> Graph_CSR< V, E, Memory, layout_v_base, layout_e_base, grow_p >::e
private

Structure that store the edge properties.

Definition at line 316 of file map_graph.hpp.

◆ e_invalid

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>
openfpm::vector<E, Memory, layout_e_base, grow_p, openfpm::vect_isel<E>::value> Graph_CSR< V, E, Memory, layout_v_base, layout_e_base, grow_p >::e_invalid
private

invalid edge element, when a function try to create an in valid edge this object is returned

Definition at line 322 of file map_graph.hpp.

◆ e_l

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>
openfpm::vector<e_map, Memory, layout_e_base , grow_p, openfpm::vect_isel<e_map>::value> Graph_CSR< V, E, Memory, layout_v_base, layout_e_base, grow_p >::e_l
private

Structure that store for each vertex the adjacent the vertex id and edge id (for property into e)

Definition at line 319 of file map_graph.hpp.

◆ v

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>
openfpm::vector<V, Memory, layout_v_base,grow_p, openfpm::vect_isel<V>::value> Graph_CSR< V, E, Memory, layout_v_base, layout_e_base, grow_p >::v
private

Structure that store the vertex properties.

Definition at line 310 of file map_graph.hpp.

◆ v_l

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>
openfpm::vector<size_t, Memory, layout_v_base,grow_p, openfpm::vect_isel<size_t>::value> Graph_CSR< V, E, Memory, layout_v_base, layout_e_base, grow_p >::v_l
private

Structure that store the number of adjacent vertex in e_l for each vertex.

Definition at line 313 of file map_graph.hpp.

◆ v_slot

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>
size_t Graph_CSR< V, E, Memory, layout_v_base, layout_e_base, grow_p >::v_slot
private

number of slot per vertex

Definition at line 307 of file map_graph.hpp.


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