Galois
|
Simplifies writing graphs. More...
#include <FileGraph.h>
Public Member Functions | |
FileGraphWriter () | |
Constructor: initializes nodes, edges, and edge data to 0. More... | |
void | setNumNodes (size_t n) |
Set number of nodes to write to n. More... | |
void | setNumEdges (size_t n) |
Set number of edges to write to n. More... | |
void | setSizeofEdgeData (size_t n) |
Set the size of the edge data to write to n. More... | |
void | phase1 () |
Marks the transition to next phase of parsing: counting the degree of nodes. More... | |
void | incrementDegree (size_t id, int delta=1) |
Increments degree of id by delta. More... | |
void | phase2 () |
Marks the transition to next phase of parsing, adding edges. More... | |
size_t | addNeighbor (size_t src, size_t dst) |
Adds a neighbor between src and dst. More... | |
template<typename T > | |
T * | finish () |
Finish making graph. More... | |
Public Member Functions inherited from galois::graphs::FileGraph | |
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... | |
Additional Inherited Members | |
Public Types inherited from galois::graphs::FileGraph | |
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... | |
Protected Member Functions inherited from galois::graphs::FileGraph | |
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... | |
Simplifies writing graphs.
Writer your file in rounds:
|
inline |
Constructor: initializes nodes, edges, and edge data to 0.
|
inline |
Adds a neighbor between src and dst.
|
inline |
Finish making graph.
Returns pointer to block of memory that should be used to store edge data.
|
inline |
Increments degree of id by delta.
|
inline |
Marks the transition to next phase of parsing: counting the degree of nodes.
|
inline |
Marks the transition to next phase of parsing, adding edges.
|
inline |
Set number of edges to write to n.
n | number of edges to set to |
|
inline |
Set number of nodes to write to n.
n | number of nodes to set to |
|
inline |
Set the size of the edge data to write to n.
n | size of edge data to write |