20 #ifndef GALOIS_GRAPHS_LC_CSR_GRAPH_H
21 #define GALOIS_GRAPHS_LC_CSR_GRAPH_H
24 #include <type_traits>
26 #include <boost/archive/binary_oarchive.hpp>
27 #include <boost/archive/binary_iarchive.hpp>
28 #include <boost/serialization/split_member.hpp>
29 #include <boost/serialization/binary_object.hpp>
30 #include <boost/serialization/serialization.hpp>
32 #include "galois/config.h"
39 namespace galois::graphs {
58 template <
typename NodeTy,
typename EdgeTy,
bool HasNoLockable =
false,
60 bool UseNumaAlloc =
false,
bool HasOutOfLineLockable =
false,
61 typename FileEdgeTy = EdgeTy>
64 private boost::noncopyable,
65 private internal::LocalIteratorFeature<UseNumaAlloc>,
66 private internal::OutOfLineLockableFeature<HasOutOfLineLockable &&
68 template <
typename Graph>
72 template <
bool _has_
id>
77 template <
typename _node_data>
79 typedef LC_CSR_Graph<_node_data, EdgeTy, HasNoLockable, UseNumaAlloc,
80 HasOutOfLineLockable, FileEdgeTy>
84 template <
typename _edge_data>
86 typedef LC_CSR_Graph<NodeTy, _edge_data, HasNoLockable, UseNumaAlloc,
87 HasOutOfLineLockable, FileEdgeTy>
91 template <
typename _file_edge_data>
93 typedef LC_CSR_Graph<NodeTy, EdgeTy, HasNoLockable, UseNumaAlloc,
94 HasOutOfLineLockable, _file_edge_data>
99 template <
bool _has_no_lockable>
101 typedef LC_CSR_Graph<NodeTy, EdgeTy, _has_no_lockable, UseNumaAlloc,
102 HasOutOfLineLockable, FileEdgeTy>
105 template <
bool _has_no_lockable>
107 LC_CSR_Graph<NodeTy, EdgeTy, _has_no_lockable, UseNumaAlloc,
108 HasOutOfLineLockable, FileEdgeTy>;
112 template <
bool _use_numa_alloc>
114 typedef LC_CSR_Graph<NodeTy, EdgeTy, HasNoLockable, _use_numa_alloc,
115 HasOutOfLineLockable, FileEdgeTy>
118 template <
bool _use_numa_alloc>
120 LC_CSR_Graph<NodeTy, EdgeTy, HasNoLockable, _use_numa_alloc,
121 HasOutOfLineLockable, FileEdgeTy>;
124 template <
bool _has_out_of_line_lockable>
126 typedef LC_CSR_Graph<NodeTy, EdgeTy, HasNoLockable, UseNumaAlloc,
127 _has_out_of_line_lockable, FileEdgeTy>
136 typedef internal::NodeInfoBaseTypes<NodeTy,
137 !HasNoLockable && !HasOutOfLineLockable>
139 typedef internal::NodeInfoBase<NodeTy,
140 !HasNoLockable && !HasOutOfLineLockable>
153 boost::counting_iterator<typename EdgeIndData::value_type>;
154 using iterator = boost::counting_iterator<typename EdgeDst::value_type>;
168 typedef internal::EdgeSortIterator<
188 template <
bool _A1 = HasNoLockable,
bool _A2 = HasOutOfLineLockable>
190 typename std::enable_if<!_A1 && !_A2>::type* = 0) {
194 template <
bool _A1 = HasOutOfLineLockable,
bool _A2 = HasNoLockable>
196 typename std::enable_if<_A1 && !_A2>::type* = 0) {
197 this->outOfLineAcquire(
getId(N), mflag);
200 template <
bool _A1 = HasOutOfLineLockable,
bool _A2 = HasNoLockable>
202 typename std::enable_if<_A2>::type* = 0) {}
208 typename std::enable_if<!_A1 || _A2>::type* = 0) {
217 typename std::enable_if<_A1 && !_A2>::type* = 0) {
226 friend class boost::serialization::access;
228 template <
typename Archive>
229 void save(Archive& ar,
const unsigned int)
const {
239 template <
typename Archive>
240 void load(Archive& ar,
const unsigned int) {
252 this->outOfLineAllocateBlocked(numNodes);
255 this->outOfLineAllocateInterleaved(numNodes);
259 for (
size_t n = 0; n <
numNodes; ++n) {
268 BOOST_SERIALIZATION_SPLIT_MEMBER()
341 template <
typename EdgeNumFnTy,
typename EdgeDstFnTy,
typename EdgeDataFnTy>
342 LC_CSR_Graph(uint32_t _numNodes, uint64_t _numEdges, EdgeNumFnTy edgeNum,
343 EdgeDstFnTy _edgeDst, EdgeDataFnTy _edgeData)
344 : numNodes(_numNodes), numEdges(_numEdges) {
348 edgeIndData.allocateBlocked(numNodes);
349 edgeDst.allocateBlocked(numEdges);
350 edgeData.allocateBlocked(numEdges);
352 this->outOfLineAllocateBlocked(numNodes,
false);
355 edgeIndData.allocateInterleaved(numNodes);
356 edgeDst.allocateInterleaved(numEdges);
357 edgeData.allocateInterleaved(numEdges);
358 this->outOfLineAllocateInterleaved(numNodes);
360 for (
size_t n = 0; n <
numNodes; ++n) {
364 for (
size_t n = 0; n <
numNodes; ++n) {
366 edgeIndData[n] = cur;
369 for (
size_t n = 0; n <
numNodes; ++n) {
370 for (uint64_t e = 0, ee = edgeNum(n); e < ee; ++e) {
372 edgeData.set(cur, _edgeData(n, e));
373 edgeDst[cur] = _edgeDst(n, e);
400 return edgeData[*ni];
448 auto e = std::lower_bound(
456 return internal::make_no_deref_range(
edge_begin(N, mflag),
462 return edges(N, mflag);
468 template <
typename CompTy>
470 const CompTy& comp = std::less<EdgeTy>(),
483 template <
typename CompTy>
497 [=](
const EdgeSortVal& e1,
const EdgeSortVal& e2) {
498 return e1.dst < e2.dst;
514 numNodes = graph.
size();
518 edgeIndData.allocateBlocked(numNodes);
519 edgeDst.allocateBlocked(numEdges);
520 edgeData.allocateBlocked(numEdges);
521 this->outOfLineAllocateBlocked(numNodes);
524 edgeIndData.allocateInterleaved(numNodes);
525 edgeDst.allocateInterleaved(numEdges);
526 edgeData.allocateInterleaved(numEdges);
527 this->outOfLineAllocateInterleaved(numNodes);
537 edgeIndData.allocateBlocked(numNodes);
538 edgeDst.allocateBlocked(numEdges);
539 edgeData.allocateBlocked(numEdges);
540 this->outOfLineAllocateBlocked(numNodes);
543 edgeIndData.allocateInterleaved(numNodes);
544 edgeDst.allocateInterleaved(numEdges);
545 edgeData.allocateInterleaved(numEdges);
546 this->outOfLineAllocateInterleaved(numNodes);
557 edgeIndData.allocateBlocked(numNodes);
558 edgeDst.allocateBlocked(numEdges);
559 edgeData.allocateBlocked(numEdges);
560 this->outOfLineAllocateBlocked(numNodes);
563 edgeIndData.allocateInterleaved(numNodes);
564 edgeDst.allocateInterleaved(numEdges);
565 edgeData.allocateInterleaved(numEdges);
566 this->outOfLineAllocateInterleaved(numNodes);
571 #ifndef GALOIS_GRAPH_CONSTRUCT_SERIAL
572 for (uint32_t x = 0; x <
numNodes; ++x) {
574 this->outOfLineConstructAt(x);
581 this->outOfLineConstructAt(x);
591 edgeIndData.deallocate();
592 edgeIndData.destroy();
594 edgeDst.deallocate();
597 edgeData.deallocate();
603 edgeData.set(e, val);
609 void fixEndEdge(uint32_t n, uint64_t e) { edgeIndData[n] = e; }
640 edgeIndData_old[n] = edgeIndData[n];
641 edgeIndData_temp[n] = 0;
649 auto dst = edgeDst[e];
650 edgeDst_old[e] = dst;
653 __sync_add_and_fetch(&edgeIndData_temp[dst], 1);
659 for (uint32_t n = 1; n <
numNodes; ++n) {
660 edgeIndData_temp[n] += edgeIndData_temp[n - 1];
666 [&](uint64_t n) { edgeIndData[n] = edgeIndData_temp[n]; },
672 edgeIndData_temp[0] = 0;
675 [&](uint64_t n) { edgeIndData_temp[n] = edgeIndData[n - 1]; },
683 uint64_t e = (src == 0) ? 0 : edgeIndData_old[src - 1];
687 while (e < edgeIndData_old[src]) {
689 auto dst = edgeDst_old[e];
691 auto e_new = __sync_fetch_and_add(&(edgeIndData_temp[dst]), 1);
693 edgeDst[e_new] = src;
705 [&](uint64_t e) {
edgeDataCopy(edgeData, edgeData_new, e, e); },
712 template <
bool is_non_
void = EdgeData::has_value>
715 typename std::enable_if<is_non_void>::type* = 0) {
716 edgeData_new[e_new] = edgeData[e];
719 template <
bool is_non_
void = EdgeData::has_value>
721 typename std::enable_if<!is_non_void>::type* = 0) {
725 template <
typename E = EdgeTy,
726 std::enable_if_t<!std::is_same<E, void>::value,
int>* =
nullptr>
728 const bool readUnweighted =
false) {
733 NodeData::size_of::value + EdgeIndData::size_of::value +
734 LC_CSR_Graph::size_of_out_of_line::value,
735 EdgeDst::size_of::value + EdgeData::size_of::value, tid, total)
738 this->setLocalRange(*r.first, *r.second);
742 edgeIndData[*ii] = *graph.
edge_end(*ii);
744 this->outOfLineConstructAt(*ii);
749 if (readUnweighted) {
750 edgeData.set(*nn, {});
759 template <
typename E = EdgeTy,
760 std::enable_if_t<std::is_same<E, void>::value,
int>* =
nullptr>
762 const bool GALOIS_UNUSED(readUnweighted) =
false) {
767 NodeData::size_of::value + EdgeIndData::size_of::value +
768 LC_CSR_Graph::size_of_out_of_line::value,
769 EdgeDst::size_of::value + EdgeData::size_of::value, tid, total)
772 this->setLocalRange(*r.first, *r.second);
776 edgeIndData[*ii] = *graph.
edge_end(*ii);
778 this->outOfLineConstructAt(*ii);
797 auto divideByNode(
size_t nodeSize,
size_t edgeSize,
size_t id,
size_t total) {
799 numNodes, numEdges, nodeSize, edgeSize,
id, total, edgeIndData);
808 std::vector<uint64_t>& prefix_sum,
809 std::vector<std::vector<uint32_t>>& edges_id,
810 std::vector<std::vector<EdgeTy>>& edges_data) {
819 [&](uint32_t n) { edgeIndData[n] = prefix_sum[n]; });
823 if (edgeIndData[n] > 0) {
824 std::copy(edges_id[n].
begin(), edges_id[n].
end(), edgeDst.begin());
825 std::copy(edges_data[n].
begin(), edges_data[n].
end(),
829 if (edgeIndData[n] - edgeIndData[n - 1] > 0) {
830 std::copy(edges_id[n].
begin(), edges_id[n].
end(),
831 edgeDst.begin() + edgeIndData[n - 1]);
832 std::copy(edges_data[n].
begin(), edges_data[n].
end(),
833 edgeData.begin() + edgeIndData[n - 1]);
841 uint32_t numNodes, uint64_t numEdges, std::vector<uint64_t>& prefix_sum,
843 std::vector<std::vector<EdgeTy>>& edges_data) {
848 [&](uint32_t n) { edgeIndData[n] = prefix_sum[n]; });
852 if (edgeIndData[n] > 0) {
853 std::copy(edges_id[n].
begin(), edges_id[n].
end(), edgeDst.begin());
854 std::copy(edges_data[n].
begin(), edges_data[n].
end(),
858 if (edgeIndData[n] - edgeIndData[n - 1] > 0) {
859 std::copy(edges_id[n].
begin(), edges_id[n].
end(),
860 edgeDst.begin() + edgeIndData[n - 1]);
861 std::copy(edges_data[n].
begin(), edges_data[n].
end(),
862 edgeData.begin() + edgeIndData[n - 1]);
879 typename std::enable_if<!std::is_void<EdgeTy>::value, U>::type* =
nullptr>
881 std::ifstream graphFile(filename.c_str());
882 if (!graphFile.is_open()) {
886 graphFile.read(reinterpret_cast<char*>(header),
sizeof(uint64_t) * 4);
887 uint64_t version = header[0];
888 numNodes = header[2];
889 numEdges = header[3];
891 ", Number of Edges: ", numEdges,
"\n");
897 assert(edgeIndData.data());
898 if (!edgeIndData.data()) {
903 uint64_t readPosition = (4 *
sizeof(uint64_t));
904 graphFile.seekg(readPosition);
905 graphFile.read(reinterpret_cast<char*>(edgeIndData.data()),
910 assert(edgeDst.data());
911 if (!edgeDst.data()) {
915 readPosition = ((4 +
numNodes) *
sizeof(uint64_t));
916 graphFile.seekg(readPosition);
918 graphFile.read(reinterpret_cast<char*>(edgeDst.data()),
921 ((4 +
numNodes) *
sizeof(uint64_t) + numEdges *
sizeof(uint32_t));
924 readPosition +=
sizeof(uint32_t);
926 }
else if (version == 2) {
927 graphFile.read(reinterpret_cast<char*>(edgeDst.data()),
930 ((4 +
numNodes) *
sizeof(uint64_t) + numEdges *
sizeof(uint64_t));
932 readPosition +=
sizeof(uint64_t);
935 GALOIS_DIE(
"unknown file version: ", version);
940 assert(edgeData.data());
941 if (!edgeData.data()) {
944 graphFile.seekg(readPosition);
945 graphFile.read(reinterpret_cast<char*>(edgeData.data()),
961 typename std::enable_if<std::is_void<EdgeTy>::value, U>::type* =
nullptr>
963 std::ifstream graphFile(filename.c_str());
964 if (!graphFile.is_open()) {
968 graphFile.read(reinterpret_cast<char*>(header),
sizeof(uint64_t) * 4);
969 uint64_t version = header[0];
970 numNodes = header[2];
971 numEdges = header[3];
973 ", Number of Edges: ", numEdges,
"\n");
979 assert(edgeIndData.data());
980 if (!edgeIndData.data()) {
984 uint64_t readPosition = (4 *
sizeof(uint64_t));
985 graphFile.seekg(readPosition);
986 graphFile.read(reinterpret_cast<char*>(edgeIndData.data()),
991 assert(edgeDst.data());
992 if (!edgeDst.data()) {
995 readPosition = ((4 +
numNodes) *
sizeof(uint64_t));
996 graphFile.seekg(readPosition);
998 graphFile.read(reinterpret_cast<char*>(edgeDst.data()),
1000 }
else if (version == 2) {
1001 graphFile.read(reinterpret_cast<char*>(edgeDst.data()),
1004 GALOIS_DIE(
"unknown file version: ", version);
1018 this->setLocalRange(*r.first, *r.second);
void destroyAndAllocateFrom(uint32_t nNodes, uint64_t nEdges)
Definition: LC_CSR_Graph.h:550
void set(difference_type x, const_reference v)
Definition: LargeArray.h:197
const_local_iterator local_end() const
Definition: LC_CSR_Graph.h:415
void constructFrom(FileGraph &graph, unsigned tid, unsigned total, const bool GALOIS_UNUSED(readUnweighted)=false)
Definition: LC_CSR_Graph.h:761
runtime::iterable< NoDerefIterator< edge_iterator > > out_edges(GraphNode N, MethodFlag mflag=MethodFlag::WRITE)
Definition: LC_CSR_Graph.h:461
void acquireNode(GraphNode, MethodFlag, typename std::enable_if< _A2 >::type *=0)
Definition: LC_CSR_Graph.h:201
void destroy()
Definition: LargeArray.h:277
EdgeIndData edgeIndData
Definition: LC_CSR_Graph.h:161
size_t size() const
Definition: LC_CSR_Graph.h:405
LC_CSR_Graph< NodeTy, EdgeTy, HasNoLockable, UseNumaAlloc, HasOutOfLineLockable, _file_edge_data > type
Definition: LC_CSR_Graph.h:95
edge_iterator edge_begin(GraphNode N)
Returns the index to the beginning of global node N's outgoing edges in the outgoing edges array...
Definition: FileGraph.cpp:641
void edgeDataCopy(EdgeData &edgeData_new, EdgeData &edgeData, uint64_t e_new, uint64_t e, typename std::enable_if< is_non_void >::type *=0)
Definition: LC_CSR_Graph.h:713
Contains FileGraph and FileGraphWriter class declarations.
iterator const_local_iterator
Definition: LC_CSR_Graph.h:157
LargeArray< EdgeTy > EdgeData
Definition: LC_CSR_Graph.h:134
NodeInfoTypes::reference node_data_reference
Definition: LC_CSR_Graph.h:151
size_t size() const
Returns the number of nodes in the (sub)graph.
Definition: FileGraph.h:545
edge_data_reference getEdgeData(edge_iterator ni, MethodFlag GALOIS_UNUSED(mflag)=MethodFlag::UNPROTECTED)
Definition: LC_CSR_Graph.h:397
NodeTy node_data_type
Definition: LC_CSR_Graph.h:149
void edgeDataCopy(EdgeData &, EdgeData &, uint64_t, uint64_t, typename std::enable_if<!is_non_void >::type *=0)
Definition: LC_CSR_Graph.h:720
edge_sort_iterator edge_sort_begin(GraphNode N)
Definition: LC_CSR_Graph.h:180
Local computation graph (i.e., graph structure does not change).
Definition: LC_CSR_Graph.h:62
void constructEdgeValue(FileGraph &, typename FileGraph::edge_iterator nn, typename std::enable_if< _A1 &&!_A2 >::type *=0)
Definition: LC_CSR_Graph.h:216
void sortEdges(GraphNode N, const CompTy &comp, MethodFlag mflag=MethodFlag::WRITE)
Sorts outgoing edges of a node.
Definition: LC_CSR_Graph.h:484
LC_CSR_Graph< NodeTy, _edge_data, HasNoLockable, UseNumaAlloc, HasOutOfLineLockable, FileEdgeTy > type
Definition: LC_CSR_Graph.h:88
uint64_t value_type
Definition: LargeArray.h:60
boost::counting_iterator< uint64_t > iterator
uint64 boost counting iterator
Definition: FileGraph.h:408
uint64_t numNodes
Definition: LC_CSR_Graph.h:165
auto divideNodesBinarySearch(NodeType numNodes, uint64_t numEdges, size_t nodeWeight, size_t edgeWeight, size_t id, size_t total, PrefixSumType &edgePrefixSum, std::vector< unsigned > scaleFactor=std::vector< unsigned >(), uint64_t edgeOffset=0, uint64_t nodeOffset=0)
Returns 2 ranges (one for nodes, one for edges) for a particular division.
Definition: GraphHelpers.h:141
read_default_graph_tag read_tag
Definition: LC_CSR_Graph.h:131
LC_CSR_Graph type
Definition: LC_CSR_Graph.h:74
GraphNode getEdgeDst(edge_iterator it)
Gets the destination of some edge.
Definition: FileGraph.cpp:669
Definition: LC_CSR_Graph.h:85
boost::counting_iterator< uint64_t > edge_iterator
Edge iterators (boost iterator)
Definition: FileGraph.h:248
Definition: Iterable.h:36
internal::EdgeSortIterator< GraphNode, typename EdgeIndData::value_type, EdgeDst, EdgeData > edge_sort_iterator
Definition: LC_CSR_Graph.h:170
void fixEndEdge(uint32_t n, uint64_t e)
Definition: LC_CSR_Graph.h:609
uint64_t operator[](uint64_t n)
Accesses the "prefix sum" of this graph; takes advantage of the fact that edge_end(n) is basically pr...
Definition: LC_CSR_Graph.h:339
iterator end() const
Definition: LC_CSR_Graph.h:409
void deSerializeNodeData(boost::archive::binary_iarchive &ar)
Deserializes a Boost archive containing node data to the local node data variable.
Definition: LC_CSR_Graph.h:292
size_t sizeEdges() const
Definition: LC_CSR_Graph.h:406
void transpose(const char *regionName=NULL)
Perform an in-memory transpose of the graph, replacing the original CSR to CSC.
Definition: LC_CSR_Graph.h:615
const char * loopname
Definition: Executor_ParaMeter.h:145
#define GALOIS_DIE(...)
Definition: gIO.h:96
edge_iterator raw_end(GraphNode N) const
Definition: LC_CSR_Graph.h:176
bool shouldLock(const galois::MethodFlag g)
Helper function to decide if the conflict detection lock should be taken.
Definition: libgalois/include/galois/runtime/Context.h:189
void allocateFrom(uint32_t nNodes, uint64_t nEdges)
Definition: LC_CSR_Graph.h:531
node_data_reference getData(GraphNode N, MethodFlag mflag=MethodFlag::WRITE)
Definition: LC_CSR_Graph.h:388
friend void swap(LC_CSR_Graph &lhs, LC_CSR_Graph &rhs)
Definition: LC_CSR_Graph.h:379
iterator const_iterator
Definition: LC_CSR_Graph.h:155
EdgeData edgeData
Definition: LC_CSR_Graph.h:163
EdgeDst edgeDst
Definition: LC_CSR_Graph.h:162
local_iterator local_begin()
Definition: LC_CSR_Graph.h:419
LC_CSR_Graph(uint32_t _numNodes, uint64_t _numEdges, EdgeNumFnTy edgeNum, EdgeDstFnTy _edgeDst, EdgeDataFnTy _edgeData)
Definition: LC_CSR_Graph.h:342
void sort(RandomAccessIterator first, RandomAccessIterator last, Compare comp)
Definition: ParallelSTL.h:247
Definition: LC_CSR_Graph.h:78
Modify a LC_Graph to have in and out edges.
Definition: LC_InOut_Graph.h:39
NodeData nodeData
Definition: LC_CSR_Graph.h:160
void deSerializeGraph(boost::archive::binary_iarchive &ar)
Deserializes a Boost archive to the local graph.
Definition: LC_CSR_Graph.h:317
const_local_iterator local_begin() const
Definition: LC_CSR_Graph.h:411
LC_CSR_Graph< _node_data, EdgeTy, HasNoLockable, UseNumaAlloc, HasOutOfLineLockable, FileEdgeTy > type
Definition: LC_CSR_Graph.h:81
void serializeNodeData(boost::archive::binary_oarchive &ar) const
Serializes node data using Boost.
Definition: LC_CSR_Graph.h:282
edge_iterator findEdgeSortedByDst(GraphNode N1, GraphNode N2)
Definition: LC_CSR_Graph.h:447
void sortEdgesByDst(GraphNode N, MethodFlag mflag=MethodFlag::WRITE)
Sorts outgoing edges of a node.
Definition: LC_CSR_Graph.h:493
void constructEdgeValue(FileGraph &graph, typename FileGraph::edge_iterator nn, typename std::enable_if<!_A1||_A2 >::type *=0)
Definition: LC_CSR_Graph.h:206
void allocateInterleaved(size_type n)
[allocatefunctions] Allocates interleaved across NUMA (memory) nodes.
Definition: LargeArray.h:206
iterator local_iterator
Definition: LC_CSR_Graph.h:156
std::vector< T, Pow2Alloc< T >> Vector
[STL vector using Pow_2_VarSizeAlloc]
Definition: gstl.h:52
value_type & reference
Definition: LargeArray.h:63
GraphNode getEdgeDst(edge_iterator ni)
Definition: LC_CSR_Graph.h:403
edge_iterator edge_begin(GraphNode N, MethodFlag mflag=MethodFlag::WRITE)
Definition: LC_CSR_Graph.h:427
LargeArray< NodeInfo > NodeData
Definition: LC_CSR_Graph.h:143
const EdgeIndData & getEdgePrefixSum() const
Returns the reference to the edgeIndData LargeArray (a prefix sum of edges)
Definition: LC_CSR_Graph.h:795
void constructNodes()
Definition: LC_CSR_Graph.h:570
edge_iterator raw_begin(GraphNode N) const
Definition: LC_CSR_Graph.h:172
void gPrint(Args &&...args)
Prints a sequence of things.
Definition: gIO.h:47
Proxy object for internal EdgeSortReference.
Definition: Details.h:56
runtime::iterable< NoDerefIterator< edge_iterator > > edges(GraphNode N, MethodFlag mflag=MethodFlag::WRITE)
Definition: LC_CSR_Graph.h:455
If true, use NUMA-aware graph allocation; otherwise, use NUMA interleaved allocation.
Definition: LC_CSR_Graph.h:113
local_iterator local_end()
Definition: LC_CSR_Graph.h:423
LargeArray< uint64_t > EdgeIndData
Definition: LC_CSR_Graph.h:142
void constructEdge(uint64_t e, uint32_t dst, const typename EdgeData::value_type &val)
Definition: LC_CSR_Graph.h:601
void acquire(Lockable *lockable, galois::MethodFlag m)
Master function which handles conflict detection used to acquire a lockable thing.
Definition: libgalois/include/galois/runtime/Context.h:218
void sortAllEdgesByDst(MethodFlag mflag=MethodFlag::WRITE)
Sorts all outgoing edges of all nodes in parallel.
Definition: LC_CSR_Graph.h:506
If true, store abstract locks separate from nodes.
Definition: LC_CSR_Graph.h:125
void constructFrom(uint32_t numNodes, uint64_t numEdges, std::vector< uint64_t > &prefix_sum, galois::gstl::Vector< galois::PODResizeableArray< uint32_t >> &edges_id, std::vector< std::vector< EdgeTy >> &edges_data)
Definition: LC_CSR_Graph.h:840
MethodFlag
What should the runtime do when executing a method.
Definition: MethodFlags.h:34
boost::counting_iterator< typename EdgeIndData::value_type > edge_iterator
Definition: LC_CSR_Graph.h:153
void acquireNode(GraphNode N, MethodFlag mflag, typename std::enable_if<!_A1 &&!_A2 >::type *=0)
Definition: LC_CSR_Graph.h:189
GraphNode getNode(size_t n)
Definition: LC_CSR_Graph.h:223
uint64_t numEdges
Definition: LC_CSR_Graph.h:166
iterator begin() const
Definition: LC_CSR_Graph.h:408
void do_all(const RangeFunc &rangeMaker, FunctionTy &&fn, const Args &...args)
Standard do-all loop.
Definition: Loops.h:71
void serializeGraph(boost::archive::binary_oarchive &ar) const
Serializes graph using Boost.
Definition: LC_CSR_Graph.h:301
void initializeLocalRanges()
Given a manually created graph, initialize the local ranges on this graph so that threads can iterate...
Definition: LC_CSR_Graph.h:1015
void start()
Definition: Timer.cpp:82
void on_each(FunctionTy &&fn, const Args &...args)
Low-level parallel loop.
Definition: Loops.h:86
void constructFrom(uint32_t numNodes, uint64_t numEdges, std::vector< uint64_t > &prefix_sum, std::vector< std::vector< uint32_t >> &edges_id, std::vector< std::vector< EdgeTy >> &edges_data)
custom allocator for vector<vector<>> Adding for Louvain clustering TODO: Find better way to do this ...
Definition: LC_CSR_Graph.h:807
LargeArray< uint32_t > EdgeDst
Definition: LC_CSR_Graph.h:135
void constructFrom(FileGraph &graph, unsigned tid, unsigned total, const bool readUnweighted=false)
Definition: LC_CSR_Graph.h:727
EdgeData::reference edge_data_reference
Definition: LC_CSR_Graph.h:150
size_t getId(GraphNode N)
Definition: LC_CSR_Graph.h:221
EdgeTy & getEdgeData(GraphNode src, GraphNode dst)
Get edge data of an edge between 2 nodes.
Definition: FileGraph.h:241
LC_CSR_Graph< NodeTy, EdgeTy, _has_no_lockable, UseNumaAlloc, HasOutOfLineLockable, FileEdgeTy > type
Definition: LC_CSR_Graph.h:103
edge_iterator findEdge(GraphNode N1, GraphNode N2)
Definition: LC_CSR_Graph.h:442
void constructAt(size_type n, Args &&...args)
Definition: LargeArray.h:260
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...
Definition: FileGraph.cpp:480
edge_iterator edge_end(GraphNode N)
Returns the index to the end of global node N's outgoing edges in the outgoing edges array...
Definition: FileGraph.cpp:655
size_t sizeEdges() const
Returns the number of edges in the (sub)graph.
Definition: FileGraph.h:548
const_pointer data() const
Definition: LargeArray.h:292
void allocateBlocked(size_type n)
Allocates using blocked memory policy.
Definition: LargeArray.h:213
Definition: LC_CSR_Graph.h:92
static const bool has_value
Definition: LargeArray.h:69
Definition: LC_CSR_Graph.h:73
Graph that mmaps Galois gr files for access.
Definition: FileGraph.h:57
auto iterate(C &cont)
Definition: Range.h:323
This is a container that encapsulates a resizeable array of plain-old-datatype (POD) elements...
Definition: PODResizeableArray.h:40
void constructEdge(uint64_t e, uint32_t dst)
Definition: LC_CSR_Graph.h:607
internal::NodeInfoBase< NodeTy,!HasNoLockable &&!HasOutOfLineLockable > NodeInfo
Definition: LC_CSR_Graph.h:141
internal::NodeInfoBaseTypes< NodeTy,!HasNoLockable &&!HasOutOfLineLockable > NodeInfoTypes
Definition: LC_CSR_Graph.h:138
InputIterator find_if(InputIterator first, InputIterator last, Predicate pred)
Definition: ParallelSTL.h:70
void sortEdgesByEdgeData(GraphNode N, const CompTy &comp=std::less< EdgeTy >(), MethodFlag mflag=MethodFlag::WRITE)
Sorts outgoing edges of a node.
Definition: LC_CSR_Graph.h:469
void allocateFrom(const FileGraph &graph)
Definition: LC_CSR_Graph.h:513
If true, do not use abstract locks in graph.
Definition: LC_CSR_Graph.h:100
T value_type
Definition: Executor_ParaMeter.h:111
edge_sort_iterator edge_sort_end(GraphNode N)
Definition: LC_CSR_Graph.h:184
EdgeTy edge_data_type
Definition: LC_CSR_Graph.h:147
LC_CSR_Graph< NodeTy, EdgeTy, HasNoLockable, UseNumaAlloc, _has_out_of_line_lockable, FileEdgeTy > type
Definition: LC_CSR_Graph.h:128
auto divideByNode(size_t nodeSize, size_t edgeSize, size_t id, size_t total)
Definition: LC_CSR_Graph.h:797
void deallocate()
Definition: LC_CSR_Graph.h:587
void deallocate()
Definition: LargeArray.h:271
uint32_t GraphNode
Definition: LC_CSR_Graph.h:146
LC_CSR_Graph< NodeTy, EdgeTy, HasNoLockable, _use_numa_alloc, HasOutOfLineLockable, FileEdgeTy > type
Definition: LC_CSR_Graph.h:116
void stop()
Definition: Timer.cpp:87
edge_iterator edge_end(GraphNode N, MethodFlag mflag=MethodFlag::WRITE)
Definition: LC_CSR_Graph.h:437
void readGraphFromGRFile(const std::string &filename)
Reads the GR files directly into in-memory data-structures of LC_CSR graphs using freads...
Definition: LC_CSR_Graph.h:880
Galois Timer that automatically reports stats upon destruction Provides statistic interface around ti...
Definition: Timer.h:63
FileEdgeTy file_edge_data_type
Definition: LC_CSR_Graph.h:148
void acquireNode(GraphNode N, MethodFlag mflag, typename std::enable_if< _A1 &&!_A2 >::type *=0)
Definition: LC_CSR_Graph.h:195
boost::counting_iterator< typename EdgeDst::value_type > iterator
Definition: LC_CSR_Graph.h:154