|
Galois
|
Graph that mmaps Galois gr files for access. More...
#include <FileGraph.h>
Public Types | |
| using | GraphNode = uint64_t |
| type of a node More... | |
| using | edge_iterator = boost::counting_iterator< uint64_t > |
| Edge iterators (boost iterator) More... | |
| typedef boost::transform_iterator < Convert32, uint32_t * > | neighbor_iterator |
| iterator over neighbors More... | |
| typedef boost::transform_iterator < Convert32, uint32_t * > | node_id_iterator |
| iterator over node ids More... | |
| typedef boost::transform_iterator < Convert64, uint64_t * > | edge_id_iterator |
| edge iterator More... | |
| typedef boost::counting_iterator < uint64_t > | iterator |
| uint64 boost counting iterator More... | |
| typedef std::pair< iterator, iterator > | NodeRange |
| pair specifying a node range More... | |
| typedef std::pair < edge_iterator, edge_iterator > | EdgeRange |
| pair specifying an edge range More... | |
| typedef std::pair< NodeRange, EdgeRange > | GraphRange |
| pair of a NodeRange and an EdgeRange More... | |
Public Member Functions | |
| void | reset_byte_counters () |
| Reset the num bytes counters. More... | |
| uint64_t | num_bytes_read () |
| Return all bytes read. More... | |
| bool | containsNode (const GraphNode n) const |
| Checks if a node is in the graph (already added) More... | |
| template<typename EdgeTy > | |
| EdgeTy & | getEdgeData (GraphNode src, GraphNode dst) |
| Get edge data of an edge between 2 nodes. More... | |
| edge_iterator | edge_begin (GraphNode N) |
| Returns the index to the beginning of global node N's outgoing edges in the outgoing edges array. More... | |
| edge_iterator | edge_end (GraphNode N) |
| Returns the index to the end of global node N's outgoing edges in the outgoing edges array. More... | |
| runtime::iterable < NoDerefIterator < edge_iterator > > | edges (GraphNode N) |
| Returns the edges of node N as a range that can be iterated through by C++ foreach. More... | |
| runtime::iterable < NoDerefIterator < edge_iterator > > | out_edges (GraphNode N) |
| Returns the edges of node N as a range that can be iterated through by C++ foreach. More... | |
| template<typename EdgeTy , typename CompTy > | |
| void | sortEdgesByEdgeData (GraphNode N, const CompTy &comp=std::less< EdgeTy >()) |
| Sorts outgoing edges of a node. More... | |
| template<typename EdgeTy , typename CompTy > | |
| void | sortEdges (GraphNode N, const CompTy &comp) |
| Sorts outgoing edges of a node. More... | |
| template<typename EdgeTy > | |
| EdgeTy & | getEdgeData (edge_iterator it) |
| Get edge data given an edge iterator. More... | |
| GraphNode | getEdgeDst (edge_iterator it) |
| Gets the destination of some edge. More... | |
| neighbor_iterator | neighbor_begin (GraphNode N) |
| Gets an iterator to the first neighbor of node N. More... | |
| neighbor_iterator | neighbor_end (GraphNode N) |
| Gets an iterator to the end of node N's neighbors. More... | |
| template<typename EdgeTy > | |
| EdgeTy * | edge_data_begin () const |
| template<typename EdgeTy > | |
| EdgeTy * | edge_data_end () const |
| iterator | begin () const |
| Gets the first node of the loaded graph. More... | |
| iterator | end () const |
| Gets the end of the nodes of the loaded graph. More... | |
| GraphRange | divideByNode (size_t nodeSize, size_t edgeSize, size_t id, size_t total) |
| Given a division and a total number of divisions, return a range for that particular division to work on. More... | |
| GraphRange | divideByEdge (size_t nodeSize, size_t edgeSize, size_t id, size_t total) |
| Divides nodes only considering edges. More... | |
| node_id_iterator | node_id_begin () const |
| Returns an iterator to the beginning of the node destination array. More... | |
| node_id_iterator | node_id_end () const |
| Returns an iterator to the end of the node destination array. More... | |
| edge_id_iterator | edge_id_begin () const |
| Returns an iterator to the beginning of the array specifying the index into the destination array where a particular node's edges begin. More... | |
| edge_id_iterator | edge_id_end () const |
| Returns an iterator to the end of the array specifying the index into the destination array where a particular node's edges begin. More... | |
| bool | hasNeighbor (GraphNode N1, GraphNode N2) |
| Determines if an edge with source N1 and destination N2 existed in the currently loaded (local) graph. More... | |
| size_t | size () const |
| Returns the number of nodes in the (sub)graph. More... | |
| size_t | sizeEdges () const |
| Returns the number of edges in the (sub)graph. More... | |
| size_t | edgeSize () const |
| Returns the size of an edge. More... | |
| FileGraph () | |
| Default file graph constructor which initializes fields to null values. More... | |
| FileGraph (const FileGraph &) | |
| Construct graph from another FileGraph. More... | |
| FileGraph & | operator= (const FileGraph &) |
| Copy constructor operator for FileGraph. More... | |
| FileGraph (FileGraph &&) | |
| Move constructor for FileGraph. More... | |
| FileGraph & | operator= (FileGraph &&) |
| Move constructor operator for FileGraph. More... | |
| ~FileGraph () | |
| Destructor. More... | |
| void | fromFile (const std::string &filename) |
| Given a file name, mmap the entire file into memory. More... | |
| void | partFromFile (const std::string &filename, NodeRange nrange, EdgeRange erange, bool numaMap=false) |
| Loads/mmaps particular portions of a graph corresponding to a node range and edge range into memory. More... | |
| template<typename EdgeTy > | |
| void | fromFileInterleaved (const std::string &filename, typename std::enable_if<!std::is_void< EdgeTy >::value >::type *=0) |
| Reads graph connectivity information from file. More... | |
| template<typename EdgeTy > | |
| void | fromFileInterleaved (const std::string &filename, typename std::enable_if< std::is_void< EdgeTy >::value >::type *=0) |
| Reads graph connectivity information from file. More... | |
| template<typename T > | |
| T * | fromGraph (FileGraph &g) |
| Reads graph connectivity information from graph but not edge data. More... | |
| void | toFile (const std::string &file) |
| Write current contents of mappings to a file. More... | |
Protected Member Functions | |
| void * | fromArrays (uint64_t *outIdx, uint64_t numNodes, void *outs, uint64_t numEdges, char *edgeData, size_t sizeofEdgeData, uint64_t nodeOffset, uint64_t edgeOffset, bool converted, int oGraphVersion=1) |
| Copies graph connectivity information from arrays. More... | |
Graph that mmaps Galois gr files for access.
| typedef boost::transform_iterator<Convert64, uint64_t*> galois::graphs::FileGraph::edge_id_iterator |
edge iterator
| using galois::graphs::FileGraph::edge_iterator = boost::counting_iterator<uint64_t> |
Edge iterators (boost iterator)
| typedef std::pair<edge_iterator, edge_iterator> galois::graphs::FileGraph::EdgeRange |
pair specifying an edge range
| using galois::graphs::FileGraph::GraphNode = uint64_t |
type of a node
| typedef std::pair<NodeRange, EdgeRange> galois::graphs::FileGraph::GraphRange |
pair of a NodeRange and an EdgeRange
| typedef boost::counting_iterator<uint64_t> galois::graphs::FileGraph::iterator |
uint64 boost counting iterator
| typedef boost::transform_iterator<Convert32, uint32_t*> galois::graphs::FileGraph::neighbor_iterator |
iterator over neighbors
| typedef boost::transform_iterator<Convert32, uint32_t*> galois::graphs::FileGraph::node_id_iterator |
iterator over node ids
| typedef std::pair<iterator, iterator> galois::graphs::FileGraph::NodeRange |
pair specifying a node range
| galois::graphs::FileGraph::FileGraph | ( | ) |
Default file graph constructor which initializes fields to null values.
| galois::graphs::FileGraph::FileGraph | ( | const FileGraph & | o | ) |
Construct graph from another FileGraph.
| o | Other filegraph to initialize from. |
| galois::graphs::FileGraph::~FileGraph | ( | ) |
Destructor.
Un-mmaps mmap'd things and closes opened files.
| FileGraph::iterator galois::graphs::FileGraph::begin | ( | ) | const |
Gets the first node of the loaded graph.
|
inline |
Checks if a node is in the graph (already added)
| auto galois::graphs::FileGraph::divideByEdge | ( | size_t | nodeSize, |
| size_t | edgeSize, | ||
| size_t | id, | ||
| size_t | total | ||
| ) |
Divides nodes only considering edges.
IMPORTANT: Note that it may potentially not return all nodes in the graph (it will return up to the last node with edges).
| nodeSize | Weight of nodes |
| edgeSize | Weight of edges |
| id | Division id |
| total | Total number of divisions |
| auto galois::graphs::FileGraph::divideByNode | ( | size_t | nodeSize, |
| size_t | edgeSize, | ||
| size_t | id, | ||
| size_t | total | ||
| ) |
Given a division and a total number of divisions, return a range for that particular division to work on.
(i.e. this divides labor among divisions depending on how much weight is given to nodes/edges).
| nodeSize | Weight of nodes |
| edgeSize | Weight of edges |
| id | Division id |
| total | Total number of divisions |
| FileGraph::edge_iterator galois::graphs::FileGraph::edge_begin | ( | GraphNode | N | ) |
Returns the index to the beginning of global node N's outgoing edges in the outgoing edges array.
| N | global node id of edge begin to get |
|
inline |
|
inline |
| FileGraph::edge_iterator galois::graphs::FileGraph::edge_end | ( | GraphNode | N | ) |
Returns the index to the end of global node N's outgoing edges in the outgoing edges array.
| N | global node id of edge end to get |
| FileGraph::edge_id_iterator galois::graphs::FileGraph::edge_id_begin | ( | ) | const |
Returns an iterator to the beginning of the array specifying the index into the destination array where a particular node's edges begin.
| FileGraph::edge_id_iterator galois::graphs::FileGraph::edge_id_end | ( | ) | const |
Returns an iterator to the end of the array specifying the index into the destination array where a particular node's edges begin.
|
inline |
Returns the edges of node N as a range that can be iterated through by C++ foreach.
|
inline |
Returns the size of an edge.
| FileGraph::iterator galois::graphs::FileGraph::end | ( | ) | const |
Gets the end of the nodes of the loaded graph.
|
protected |
Copies graph connectivity information from arrays.
Returns a pointer to array to populate with edge data.
| outIdx | Out index information in an array |
| numNodes | number of nodes |
| outs | edge destination array |
| numEdges | number of edges |
| edgeData | array of edge data |
| sizeofEdgeData | The size of the edge data |
| nodeOffset | how many nodes from the beginning will this graph start from |
| edgeOffset | how many edges from the beginning will this edge start from |
| converted | whether values in arrays are in host byte ordering (false) or in FileGraph byte ordering (true) |
| oGraphVersion | Galois graph version to use |
| void galois::graphs::FileGraph::fromFile | ( | const std::string & | filename | ) |
Given a file name, mmap the entire file into memory.
Should be a graph with some specific layout.
| filename | Graph file to load |
|
inline |
Reads graph connectivity information from file.
Tries to balance memory evenly across system. Cannot be called during parallel execution.
Edge data version.
|
inline |
Reads graph connectivity information from file.
Tries to balance memory evenly across system. Cannot be called during parallel execution.
No edge data version.
|
inline |
Reads graph connectivity information from graph but not edge data.
Returns a pointer to array to populate with edge data.
|
inline |
Get edge data of an edge between 2 nodes.
|
inline |
Get edge data given an edge iterator.
| FileGraph::GraphNode galois::graphs::FileGraph::getEdgeDst | ( | edge_iterator | it | ) |
Gets the destination of some edge.
| it | local edge id of edge destination to get |
Determines if an edge with source N1 and destination N2 existed in the currently loaded (local) graph.
| N1 | global node id of neighbor 1 (source) |
| N2 | global node id of neighbor 2 (destination) |
|
inline |
Gets an iterator to the first neighbor of node N.
|
inline |
Gets an iterator to the end of node N's neighbors.
| FileGraph::node_id_iterator galois::graphs::FileGraph::node_id_begin | ( | ) | const |
Returns an iterator to the beginning of the node destination array.
| FileGraph::node_id_iterator galois::graphs::FileGraph::node_id_end | ( | ) | const |
Returns an iterator to the end of the node destination array.
|
inline |
Return all bytes read.
Copy constructor operator for FileGraph.
Move constructor operator for FileGraph.
|
inline |
Returns the edges of node N as a range that can be iterated through by C++ foreach.
| void galois::graphs::FileGraph::partFromFile | ( | const std::string & | filename, |
| NodeRange | nrange, | ||
| EdgeRange | erange, | ||
| bool | numaMap = false |
||
| ) |
Loads/mmaps particular portions of a graph corresponding to a node range and edge range into memory.
Note that it makes the object work on a LOCAL scale (i.e. there are now local ids corresponding to the subgraph). Most functions will still handle global ids, though. (see below)
| filename | File to load |
| nrange | Node range to load |
| erange | Edge range to load |
| numaMap | if true, does interleaved numa allocation for data structures |
|
inline |
Reset the num bytes counters.
|
inline |
Returns the number of nodes in the (sub)graph.
|
inline |
Returns the number of edges in the (sub)graph.
|
inline |
Sorts outgoing edges of a node.
Comparison function is over EdgeSortValue<EdgeTy>.
|
inline |
Sorts outgoing edges of a node.
Comparison function is over EdgeTy.
| void galois::graphs::FileGraph::toFile | ( | const std::string & | file | ) |
Write current contents of mappings to a file.
| file | File to write to |