/**

\page graph_io_util Graph I/O and Utility Tools
\tableofcontents
@section graphio Graph Input and Output

@subsection readwrite Reading Graphs

Read in graphs by using galois::graphs::readGraph, which expects the following parameters:
<ul>
<li> The first parameter is the graph to be read in.
<li> The second parameter is either a file name or a galois::graphs::FileGraph representing the graph of outgoing neighbors.
<li> When the graph is a galois::graphs::LC_InOut_Graph and is asymmetric, it is required to pass in the third parameter, which is either a file name or a galois::graphs::FileGraph representing the graph of incoming edges.
</ul>

The file representing the graph should be a binary representation consistent with the in-memory representation of the graph object to be loaded in. An example can be seen in {@link lonestar/tutorial_examples/GraphTraversalSerial.cpp}:

@snippet lonestar/tutorial_examples/GraphTraversalSerial.cpp Read a graph

If you want to load a .gr (binary Galois graph) into your own graph types, then you need to read in graphs through galois::graphs::FileGraph. Specifically, use galois::graphs::FileGraph::fromFile to mmap a binary format of graphs into a galois::graphs::FileGraph object, and then construct your graph from the galois::graphs::FileGraph object. galois::graphs::LC_CSR_Graph::constructFrom implements exactly this functionality for galois::graphs::LC_CSR_Graph.


@subsection writegraph Writing Graphs

Use galois::graphs::FileGraph::toFile to write a galois::graphs::FileGraph to a binary file. Use galois::graphs::FileGraphWriter to construct a galois::graphs::FileGraph by the following steps:
<ol>
<li> Set the number of nodes by calling galois::graphs::FileGraphWriter::setNumNodes.
<li> Set the number of edges by calling galois::graphs::FileGraphWriter::setNumEdges.
<li> Set the size of edge data by calling galois::graphs::FileGraphWriter::setSizeofEdgeData.
<li> Call galois::graphs::FileGraphWriter::phase1 to allocate space for arrays of row pointers, edge destination and edge data.
<li> Set the degree of each node by calling galois::graphs::FileGraphWriter::incrementDegree for each node.
<li> Call galois::graphs::FileGraphWriter::phase2 to calculate the prefix sum of node degree to have row pointers.
<li> Add edges by calling galois::graphs::FileGraphWriter::addNeighbor for each edge. The function returns for the edge the index into the edge destination array, which can be used to maintain the edge data array if required.
<li> Call galois::graphs::FileGraphWriter::finish to get a pointer which points to the memory location where the edge data can be saved. Copy the edge data array to the space pointed by the pointer.
</ol>

The code snippet below shows an example of writing to a galois::graphs::FileGraph from a galois::graphs::MorphGraph using a galois::graphs::FileGraphWriter.

@snippet lonestar/surveypropagation/SurveyPropagation.cpp write to a FileGraph


@section garph_utility Utility Tools for Graphs

@subsection graphconvert Tools to Convert Graphs Among Different Formats

Use graph-convert in the directory of tools/graph-convert to convert the graph files among different formats. Launch graph-convert with -help parameter will give the detailed parameters for converting and supported formats. In particular, graph-convert can convert a few ASCII-format graph files, e.g. edge list, into binary format which can be directly loaded in by galois::graphs::readGraph or galois::graphs::FileGraph::fromFile.

@subsection graphstats Tools to Get Graph Statistics

Use graph-stats in the directory of tools/graph-stats to get the statistics of a given graph in .gr format (Galois binary graph). Launch graph-stats with -help parameter to get the detailed parameters for reporting statistics, e.g. number of nodes and edges, out-degree/in-degree histogram, etc.

*/
