25 #ifndef GALOIS_GRAPHS_LC_CSR_CSC_GRAPH_H
26 #define GALOIS_GRAPHS_LC_CSR_CSC_GRAPH_H
28 #include "galois/config.h"
51 template <
typename NodeTy,
typename EdgeTy,
bool EdgeDataByValue =
false,
52 bool HasNoLockable =
false,
bool UseNumaAlloc =
false,
53 bool HasOutOfLineLockable =
false,
typename FileEdgeTy = EdgeTy>
55 :
public LC_CSR_Graph<NodeTy, EdgeTy, HasNoLockable, UseNumaAlloc,
56 HasOutOfLineLockable, FileEdgeTy> {
60 HasOutOfLineLockable, FileEdgeTy>;
64 UseNumaAlloc, HasOutOfLineLockable, FileEdgeTy>;
82 boost::counting_iterator<typename EdgeIndData::value_type>;
95 typename std::conditional<EdgeDataByValue, EdgeData, EdgeIndData>::type;
120 template <
bool A = EdgeDataByValue,
121 typename std::enable_if<A>::type* =
nullptr>
133 template <
bool A = EdgeDataByValue,
134 typename std::enable_if<!A>::type* =
nullptr>
136 if (!std::is_void<EdgeTy>::value) {
156 __sync_add_and_fetch(&(dataBuffer[dst]), 1);
161 dataBuffer[n] += dataBuffer[n - 1];
189 if (!std::is_void<EdgeTy>::value) {
204 auto e_new = __sync_fetch_and_add(&(dataBuffer[dst]), 1);
232 incomingEdgeConstructTimer.
start();
238 [&](uint64_t n) { dataBuffer[n] = 0; });
243 incomingEdgeConstructTimer.
stop();
309 return internal::make_no_deref_range(
in_edge_begin(N, mflag),
330 template <
bool A = EdgeDataByValue,
331 typename std::enable_if<A>::type* =
nullptr>
346 template <
bool A = EdgeDataByValue,
347 typename std::enable_if<A>::type* =
nullptr>
362 template <
bool A = EdgeDataByValue,
363 typename std::enable_if<!A>::type* =
nullptr>
378 template <
bool A = EdgeDataByValue,
379 typename std::enable_if<!A>::type* =
nullptr>
402 typename std::conditional<EdgeDataByValue, EdgeTy, uint64_t>::type>;
405 [=](
const EdgeSortVal& e1,
const EdgeSortVal& e2) {
406 return e1.dst < e2.dst;
uint32_t GraphNode
Graph node typedef.
Definition: LC_CSR_CSC_Graph.h:68
LC_CSR_CSC_Graph & operator=(LC_CSR_CSC_Graph &&)=default
default = operator
edge_data_reference getInEdgeData(edge_iterator ni, MethodFlag=MethodFlag::UNPROTECTED)
Given an edge id for in edge, get the data associated with that edge.
Definition: LC_CSR_CSC_Graph.h:348
edge_sort_iterator in_edge_sort_end(GraphNode N)
ending iterator to an edge sorter for in-edges
Definition: LC_CSR_CSC_Graph.h:110
EdgeIndData edgeIndData
Definition: LC_CSR_Graph.h:161
size_t size() const
Definition: LC_CSR_Graph.h:405
typename std::conditional< EdgeDataByValue, EdgeData, EdgeIndData >::type EdgeDataRep
Edge data of inedges can be a value copy of the outedges (i.e.
Definition: LC_CSR_CSC_Graph.h:95
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
Local computation graph (i.e., graph structure does not change).
Definition: LC_CSR_Graph.h:62
void createEdgeData(const uint64_t e_new, const uint64_t e)
Copy the data of outedge by value to inedge.
Definition: LC_CSR_CSC_Graph.h:122
uint64_t value_type
Definition: LargeArray.h:60
uint64_t numNodes
Definition: LC_CSR_Graph.h:165
typename EdgeData::reference edge_data_reference
reference to edge data
Definition: LC_CSR_CSC_Graph.h:84
Definition: Iterable.h:36
internal::EdgeSortIterator< GraphNode, typename EdgeIndData::value_type, EdgeDst, EdgeDataRep > edge_sort_iterator
redefinition of the edge sort iterator in LC_CSR_Graph
Definition: LC_CSR_CSC_Graph.h:102
LargeArray< uint32_t > EdgeDst
large array for edge destinations
Definition: LC_CSR_CSC_Graph.h:75
edge_sort_iterator in_edge_sort_begin(GraphNode N)
beginning iterator to an edge sorter for in-edges
Definition: LC_CSR_CSC_Graph.h:105
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
EdgeData edgeData
Definition: LC_CSR_Graph.h:163
void constructIncomingEdges()
Call only after the LC_CSR_Graph part of this class is fully constructed.
Definition: LC_CSR_CSC_Graph.h:230
EdgeDst edgeDst
Definition: LC_CSR_Graph.h:162
void sort(RandomAccessIterator first, RandomAccessIterator last, Compare comp)
Definition: ParallelSTL.h:247
void determineInEdgeIndices(EdgeIndData &dataBuffer)
Determine the in-edge indices for every node by accumulating how many in-edges each node has...
Definition: LC_CSR_CSC_Graph.h:150
const EdgeIndData & getInEdgePrefixSum() const
Definition: LC_CSR_CSC_Graph.h:388
edge_data_reference getInEdgeData(edge_iterator ni, MethodFlag=MethodFlag::UNPROTECTED) const
Given an edge id for in edge, get the data associated with that edge.
Definition: LC_CSR_CSC_Graph.h:333
void allocateInterleaved(size_type n)
[allocatefunctions] Allocates interleaved across NUMA (memory) nodes.
Definition: LargeArray.h:206
void determineInEdgeDestAndData(EdgeIndData &dataBuffer)
Determine the destination of each in-edge and copy the data associated with an edge (or point to it)...
Definition: LC_CSR_CSC_Graph.h:176
value_type & reference
Definition: LargeArray.h:63
Proxy object for internal EdgeSortReference.
Definition: Details.h:56
edge_iterator in_edge_begin(GraphNode N, MethodFlag mflag=MethodFlag::WRITE)
Wrapper to get the in edge end of a node; lock if necessary.
Definition: LC_CSR_CSC_Graph.h:278
runtime::iterable< NoDerefIterator< edge_iterator > > in_edges(GraphNode N, MethodFlag mflag=MethodFlag::WRITE)
Definition: LC_CSR_CSC_Graph.h:308
EdgeIndData inEdgeIndData
edge index data for the reverse edges
Definition: LC_CSR_CSC_Graph.h:88
An bidirectional LC_CSR_Graph that allows the construction of in-edges from its outedges.
Definition: LC_CSR_CSC_Graph.h:54
MethodFlag
What should the runtime do when executing a method.
Definition: MethodFlags.h:34
void sortInEdgesByDst(GraphNode N, MethodFlag mflag=MethodFlag::WRITE)
Sorts outgoing edges of a node.
Definition: LC_CSR_CSC_Graph.h:397
void readAndConstructBiGraphFromGRFile(const std::string &filename)
Directly reads the GR file to construct CSR graph and then constructs reverse edges based on that...
Definition: LC_CSR_CSC_Graph.h:425
void acquireNode(GraphNode N, MethodFlag mflag, typename std::enable_if<!_A1 &&!_A2 >::type *=0)
Definition: LC_CSR_Graph.h:189
uint64_t numEdges
Definition: LC_CSR_Graph.h:166
void do_all(const RangeFunc &rangeMaker, FunctionTy &&fn, const Args &...args)
Standard do-all loop.
Definition: Loops.h:71
void start()
Definition: Timer.cpp:82
edge_iterator in_raw_begin(GraphNode N) const
Grabs in edge beginning without lock/safety.
Definition: LC_CSR_CSC_Graph.h:256
void sortAllInEdgesByDst(MethodFlag mflag=MethodFlag::WRITE)
Sorts all incoming edges of all nodes in parallel.
Definition: LC_CSR_CSC_Graph.h:414
edge_iterator in_edge_end(GraphNode N, MethodFlag mflag=MethodFlag::WRITE)
Wrapper to get the in edge end of a node; lock if necessary.
Definition: LC_CSR_CSC_Graph.h:297
auto iterate(C &cont)
Definition: Range.h:323
EdgeDataRep inEdgeData
The data for the reverse edges.
Definition: LC_CSR_CSC_Graph.h:97
EdgeDst inEdgeDst
edge destination data for the reverse edges
Definition: LC_CSR_CSC_Graph.h:90
LC_CSR_CSC_Graph()=default
default constructor
GraphNode getInEdgeDst(edge_iterator ni) const
Given an edge id for in edges, get the destination of the edge.
Definition: LC_CSR_CSC_Graph.h:319
boost::counting_iterator< typename EdgeIndData::value_type > edge_iterator
iterator for edges
Definition: LC_CSR_CSC_Graph.h:82
edge_iterator in_raw_end(GraphNode N) const
Grabs in edge end without lock/safety.
Definition: LC_CSR_CSC_Graph.h:267
void stop()
Definition: Timer.cpp:87
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