Galois
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
galois::graphs::BufferedGraph< EdgeDataType > Class Template Reference

Class that loads a portion of a Galois graph from disk directly into memory buffers for access. More...

#include <BufferedGraph.h>

Public Types

using EdgeIterator = boost::counting_iterator< uint64_t >
 Edge iterator typedef. More...
 

Public Member Functions

 BufferedGraph ()
 Class vars should be initialized by in-class initialization; all left is to reset read counters. More...
 
 ~BufferedGraph () noexcept
 On destruction, free allocated buffers (if necessary). More...
 
 BufferedGraph (const BufferedGraph &)=delete
 disabled copy constructor More...
 
BufferedGraphoperator= (const BufferedGraph &)=delete
 disabled copy constructor operator More...
 
 BufferedGraph (BufferedGraph &&)=delete
 disabled move operator More...
 
BufferedGraphoperator= (BufferedGraph &&)=delete
 disabled move constructor operator More...
 
uint32_t size () const
 Gets the number of global nodes in the graph. More...
 
uint32_t sizeEdges () const
 Gets the number of global edges in the graph. More...
 
uint64_t getNodeOffset () const
 
void loadGraph (const std::string &filename)
 Loads given Galois CSR graph into memory. More...
 
void loadPartialGraph (const std::string &filename, uint64_t nodeStart, uint64_t nodeEnd, uint64_t edgeStart, uint64_t edgeEnd, uint64_t numGlobalNodes, uint64_t numGlobalEdges)
 Given a node/edge range to load, loads the specified portion of the graph into memory buffers using read. More...
 
EdgeIterator edgeBegin (uint64_t globalNodeID)
 Get the index to the first edge of the provided node THAT THIS GRAPH HAS LOADED (not necessary the first edge of it globally). More...
 
EdgeIterator edgeEnd (uint64_t globalNodeID)
 Get the index to the first edge of the node after the provided node. More...
 
uint64_t edgeDestination (uint64_t globalEdgeID)
 Get the global node id of the destination of the provided edge. More...
 
template<typename K = EdgeDataType, typename std::enable_if<!std::is_void< K >::value >::type * = nullptr>
EdgeDataType edgeData (uint64_t globalEdgeID)
 Get the edge data of some edge. More...
 
template<typename K = EdgeDataType, typename std::enable_if< std::is_void< K >::value >::type * = nullptr>
unsigned edgeData (uint64_t)
 Version of above function when edge data type is void. More...
 
void resetReadCounters ()
 Reset reading counters. More...
 
uint64_t getBytesRead ()
 Returns the total number of bytes read from this graph so far. More...
 
void resetAndFree ()
 Free all of the in memory buffers in this object and reset graph status. More...
 

Detailed Description

template<typename EdgeDataType>
class galois::graphs::BufferedGraph< EdgeDataType >

Class that loads a portion of a Galois graph from disk directly into memory buffers for access.

Template Parameters
EdgeDataTypetype of the edge data

Member Typedef Documentation

template<typename EdgeDataType>
using galois::graphs::BufferedGraph< EdgeDataType >::EdgeIterator = boost::counting_iterator<uint64_t>

Edge iterator typedef.

Constructor & Destructor Documentation

template<typename EdgeDataType>
galois::graphs::BufferedGraph< EdgeDataType >::BufferedGraph ( )
inline

Class vars should be initialized by in-class initialization; all left is to reset read counters.

template<typename EdgeDataType>
galois::graphs::BufferedGraph< EdgeDataType >::~BufferedGraph ( )
inlinenoexcept

On destruction, free allocated buffers (if necessary).

template<typename EdgeDataType>
galois::graphs::BufferedGraph< EdgeDataType >::BufferedGraph ( const BufferedGraph< EdgeDataType > &  )
delete

disabled copy constructor

template<typename EdgeDataType>
galois::graphs::BufferedGraph< EdgeDataType >::BufferedGraph ( BufferedGraph< EdgeDataType > &&  )
delete

disabled move operator

Member Function Documentation

template<typename EdgeDataType>
EdgeIterator galois::graphs::BufferedGraph< EdgeDataType >::edgeBegin ( uint64_t  globalNodeID)
inline

Get the index to the first edge of the provided node THAT THIS GRAPH HAS LOADED (not necessary the first edge of it globally).

Parameters
globalNodeIDthe global node id of the node to get the edge for
Returns
a GLOBAL edge id iterator
template<typename EdgeDataType>
template<typename K = EdgeDataType, typename std::enable_if<!std::is_void< K >::value >::type * = nullptr>
EdgeDataType galois::graphs::BufferedGraph< EdgeDataType >::edgeData ( uint64_t  globalEdgeID)
inline

Get the edge data of some edge.

Parameters
globalEdgeIDthe global edge id of the edge to get the data of
Returns
the edge data of the requested edge id
template<typename EdgeDataType>
template<typename K = EdgeDataType, typename std::enable_if< std::is_void< K >::value >::type * = nullptr>
unsigned galois::graphs::BufferedGraph< EdgeDataType >::edgeData ( uint64_t  )
inline

Version of above function when edge data type is void.

template<typename EdgeDataType>
uint64_t galois::graphs::BufferedGraph< EdgeDataType >::edgeDestination ( uint64_t  globalEdgeID)
inline

Get the global node id of the destination of the provided edge.

Parameters
globalEdgeIDthe global edge id of the edge to get the destination for (should obtain from edgeBegin/End)
template<typename EdgeDataType>
EdgeIterator galois::graphs::BufferedGraph< EdgeDataType >::edgeEnd ( uint64_t  globalNodeID)
inline

Get the index to the first edge of the node after the provided node.

Parameters
globalNodeIDthe global node id of the node to get the edge for
Returns
a GLOBAL edge id iterator
template<typename EdgeDataType>
uint64_t galois::graphs::BufferedGraph< EdgeDataType >::getBytesRead ( )
inline

Returns the total number of bytes read from this graph so far.

Returns
Total number of bytes read using the "get" functions on out indices, edge destinations, and edge data.
template<typename EdgeDataType>
uint64_t galois::graphs::BufferedGraph< EdgeDataType >::getNodeOffset ( ) const
inline
Returns
node offset of this buffered graph
template<typename EdgeDataType>
void galois::graphs::BufferedGraph< EdgeDataType >::loadGraph ( const std::string &  filename)
inline

Loads given Galois CSR graph into memory.

Parameters
filenamename of graph to load; should be in Galois binary graph format
template<typename EdgeDataType>
void galois::graphs::BufferedGraph< EdgeDataType >::loadPartialGraph ( const std::string &  filename,
uint64_t  nodeStart,
uint64_t  nodeEnd,
uint64_t  edgeStart,
uint64_t  edgeEnd,
uint64_t  numGlobalNodes,
uint64_t  numGlobalEdges 
)
inline

Given a node/edge range to load, loads the specified portion of the graph into memory buffers using read.

Parameters
filenamename of graph to load; should be in Galois binary graph format
nodeStartFirst node to load
nodeEndLast node to load, non-inclusive
edgeStartFirst edge to load; should correspond to first edge of first node
edgeEndLast edge to load, non-inclusive
numGlobalNodesTotal number of nodes in the graph
numGlobalEdgesTotal number of edges in the graph
template<typename EdgeDataType>
BufferedGraph& galois::graphs::BufferedGraph< EdgeDataType >::operator= ( const BufferedGraph< EdgeDataType > &  )
delete

disabled copy constructor operator

template<typename EdgeDataType>
BufferedGraph& galois::graphs::BufferedGraph< EdgeDataType >::operator= ( BufferedGraph< EdgeDataType > &&  )
delete

disabled move constructor operator

template<typename EdgeDataType>
void galois::graphs::BufferedGraph< EdgeDataType >::resetAndFree ( )
inline

Free all of the in memory buffers in this object and reset graph status.

template<typename EdgeDataType>
void galois::graphs::BufferedGraph< EdgeDataType >::resetReadCounters ( )
inline

Reset reading counters.

template<typename EdgeDataType>
uint32_t galois::graphs::BufferedGraph< EdgeDataType >::size ( ) const
inline

Gets the number of global nodes in the graph.

Returns
the total number of nodes in the graph (not just local loaded nodes)
template<typename EdgeDataType>
uint32_t galois::graphs::BufferedGraph< EdgeDataType >::sizeEdges ( ) const
inline

Gets the number of global edges in the graph.

Returns
the total number of edges in the graph (not just local loaded edges)

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