IBM SYSTEMG G RUNTIME & NATIVE STORE  0.5
IBM Native Graph Computing and Storage System based on IBM Parallel Programming Library
 All Classes Functions Variables Typedefs Pages
Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
ibmppl::adjacency_list< Traits > Class Template Reference

Adjaceny list class. The main functionality of a directed graph is implemented here. It uses Traits as a template argument from which it infers all teh types used by the graph. More...

#include <ibm_graph.h>

Inheritance diagram for ibmppl::adjacency_list< Traits >:
ibmppl::DAdaptor< DIRECTED, Traits > ibmppl::DAdaptor< PRED_DIRECTED, Traits > ibmppl::DAdaptor< UNDIRECTED, Traits >

Public Types

typedef Traits::vertex_type vertex_type
 
typedef Traits::edge_type edge_type
 
typedef vertex_type::vertexd_type vertexd_type
 
typedef edge_type::edged_type edged_type
 
typedef
Traits::storage_type::iterator 
vertex_iterator
 
typedef
Traits::storage_type::const_iterator 
const_vertex_iterator
 
typedef Traits::edge_iterator edge_iterator
 
typedef Traits::const_edge_iterator const_edge_iterator
 
typedef Traits::vertex_property vertex_property
 
typedef Traits::edge_property edge_property
 

Public Member Functions

 adjacency_list ()
 constructor
 
void set_offset (size_t off)
 
size_t num_vertices () const
 
size_t num_edges () const
 
bool is_empty ()
 
vertexd_type next_vid () const
 
vertex_iterator vertices_begin ()
 
vertex_iterator vertices_end ()
 
const_vertex_iterator vertices_begin () const
 
const_vertex_iterator vertices_end () const
 
vertexd_type add_vertex (const vertex_property &p)
 add a new vertex with a given property
 
vertexd_type batch_add_vertex (const vertex_property &p)
 
void batch_mode_begin (size_t batch_size)
 
void batch_mode_end (void)
 
void add_vertex (vertexd_type vd, const vertex_property &p)
 
vertex_iterator find_vertex (vertexd_type vid)
 find a vertex by vertex id More...
 
const_vertex_iterator find_vertex (vertexd_type vid) const
 find a vertex by vertex id More...
 
void delete_vertex (vertexd_type vid)
 delete a vertex based on vertex id More...
 
void delete_vertex (vertex_iterator vit)
 delete the vertex pointed to by vertex iterator and delete all edges pointing to or from the vertex More...
 
edged_type add_edge (vertexd_type s, vertexd_type t)
 add an edge between two existing vertices More...
 
edged_type add_edge (vertexd_type s, vertexd_type t, const edge_property &p)
 add an edge and edge property between two existing vertices More...
 
bool find_edge (vertexd_type source, vertexd_type target, edged_type eid, edge_iterator &eit)
 
bool find_edge (vertexd_type source, vertexd_type target, edged_type eid)
 
bool find_edge_with_id (vertexd_type source, edged_type eid, edge_iterator &eit)
 
bool find_edge (vertexd_type source, vertexd_type target, edge_iterator &eit)
 find edge by source and target vertices More...
 
void delete_edge (vertexd_type s, vertexd_type t)
 remove the unique edge between source and sink vertices More...
 
void delete_edge (vertexd_type s, vertexd_type t, edged_type eid)
 
void delete_edge_with_id (vertexd_type s, edged_type eid)
 
void delete_all_edges (vertexd_type s, vertexd_type t)
 
void delete_edge (edged_type e)
 

Protected Types

typedef Traits::storage_type storage_type
 

Protected Member Functions

void incr_num_edges ()
 
void decr_num_edges ()
 
size_t next_edgeid (void)
 
void remove_from_verts (vertex_iterator vit)
 

Protected Attributes

size_t _id_gen
 
storage_type _verts
 
size_t _ne
 
size_t _eid_gen
 

Detailed Description

template<class Traits>
class ibmppl::adjacency_list< Traits >

Adjaceny list class. The main functionality of a directed graph is implemented here. It uses Traits as a template argument from which it infers all teh types used by the graph.

Member Function Documentation

template<class Traits >
edged_type ibmppl::adjacency_list< Traits >::add_edge ( vertexd_type  s,
vertexd_type  t 
)
inline

add an edge between two existing vertices

Parameters
[in]ssource vertex id
[in]ttarget vertex id
Returns
edge id of the inserted vertex
Warning
vertices s and t must be pre-existing
template<class Traits >
edged_type ibmppl::adjacency_list< Traits >::add_edge ( vertexd_type  s,
vertexd_type  t,
const edge_property &  p 
)
inline

add an edge and edge property between two existing vertices

Parameters
[in]ssource vertex id
[in]ttarget vertex id
[in]pedge property
Returns
id of the added edge
Warning
vertices s and t must be pre-existing
template<class Traits >
void ibmppl::adjacency_list< Traits >::delete_edge ( vertexd_type  s,
vertexd_type  t 
)
inline

remove the unique edge between source and sink vertices

Parameters
[in]ssource vertex
[in]ttarget vertex
Warning
source vertex must be pre-existing
template<class Traits >
void ibmppl::adjacency_list< Traits >::delete_vertex ( vertexd_type  vid)
inline

delete a vertex based on vertex id

Parameters
[in]vidvertex id to be deleted
Warning
assert failure when <vid> does not exist
template<class Traits >
void ibmppl::adjacency_list< Traits >::delete_vertex ( vertex_iterator  vit)
inline

delete the vertex pointed to by vertex iterator and delete all edges pointing to or from the vertex

Parameters
[in,out]vititerator to the vertex to be deleted
Attention
vit is updated after delete operation
template<class Traits >
bool ibmppl::adjacency_list< Traits >::find_edge ( vertexd_type  source,
vertexd_type  target,
edge_iterator &  eit 
)
inline

find edge by source and target vertices

Parameters
[in]sourcesource vertex
[in]targettarget vertex
[out]eitpoints to the found edge
Returns
true if the edge is found
template<class Traits >
vertex_iterator ibmppl::adjacency_list< Traits >::find_vertex ( vertexd_type  vid)
inline

find a vertex by vertex id

Parameters
[in]vidvertex id to find
Returns
iterator to the vertex found
template<class Traits >
const_vertex_iterator ibmppl::adjacency_list< Traits >::find_vertex ( vertexd_type  vid) const
inline

find a vertex by vertex id

Parameters
[in]vidvertex id to find
Returns
const iterator to the vertex found
template<class Traits >
void ibmppl::adjacency_list< Traits >::set_offset ( size_t  off)
inline

Start vertex and edge id with the given offset; Usefull for multithreaded and distributed case


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