Galois
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
OCGraph.h
Go to the documentation of this file.
1 /*
2  * This file belongs to the Galois project, a C++ library for exploiting
3  * parallelism. The code is being released under the terms of the 3-Clause BSD
4  * License (a copy is located in LICENSE.txt at the top-level directory).
5  *
6  * Copyright (C) 2018, The University of Texas at Austin. All rights reserved.
7  * UNIVERSITY EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES CONCERNING THIS
8  * SOFTWARE AND DOCUMENTATION, INCLUDING ANY WARRANTIES OF MERCHANTABILITY,
9  * FITNESS FOR ANY PARTICULAR PURPOSE, NON-INFRINGEMENT AND WARRANTIES OF
10  * PERFORMANCE, AND ANY WARRANTY THAT MIGHT OTHERWISE ARISE FROM COURSE OF
11  * DEALING OR USAGE OF TRADE. NO WARRANTY IS EITHER EXPRESS OR IMPLIED WITH
12  * RESPECT TO THE USE OF THE SOFTWARE OR DOCUMENTATION. Under no circumstances
13  * shall University be liable for incidental, special, indirect, direct or
14  * consequential damages or loss of profits, interruption of business, or
15  * related expenses which may arise from use of Software or Documentation,
16  * including but not limited to those resulting from defects in Software and/or
17  * Documentation, or loss or inaccuracy of data of any kind.
18  */
19 
20 #ifndef GALOIS_GRAPHS_OCGRAPH_H
21 #define GALOIS_GRAPHS_OCGRAPH_H
22 
23 #include <string>
24 #include <type_traits>
25 
26 #include <boost/iterator/counting_iterator.hpp>
27 #include <boost/utility.hpp>
28 
29 #include "galois/config.h"
30 #include "galois/graphs/Details.h"
31 #include "galois/LazyObject.h"
32 #include "galois/LargeArray.h"
33 #include "galois/optional.h"
34 
35 namespace galois {
36 namespace graphs {
37 
42 template <typename Graph>
43 class BindSegmentGraph : private boost::noncopyable {
44  typedef typename Graph::segment_type segment_type;
45 
46  Graph& graph;
47  segment_type segment;
48 
49 public:
50  explicit BindSegmentGraph(Graph& g) : graph(g) {}
51  BindSegmentGraph(Graph& g, segment_type s) : graph(g), segment(s) {}
52 
53  void setSegment(const segment_type& s) { segment = s; }
54 
55  typedef typename Graph::GraphNode GraphNode;
58  typedef typename Graph::edge_data_reference edge_data_reference;
59  typedef typename Graph::node_data_reference node_data_reference;
60  typedef typename Graph::edge_iterator edge_iterator;
61  typedef typename Graph::in_edge_iterator in_edge_iterator;
62  typedef typename Graph::iterator iterator;
63  typedef typename Graph::const_iterator const_iterator;
64  typedef typename Graph::local_iterator local_iterator;
65  typedef typename Graph::const_local_iterator const_local_iterator;
66 
68  MethodFlag mflag = MethodFlag::WRITE) {
69  return graph.getData(N, mflag);
70  }
71 
74  return graph.getEdgeData(segment, ni, mflag);
75  }
76 
78  return graph.getEdgeDst(segment, ni);
79  }
80 
81  size_t size() const { return graph.size(); }
82  size_t sizeEdges() const { return graph.sizeEdges(); }
83 
84  iterator begin() const { return graph.begin(); }
85  iterator end() const { return graph.end(); }
86 
87  local_iterator local_begin() const { return graph.local_begin(); }
88  local_iterator local_end() const { return graph.local_end(); }
89 
91  return graph.edge_begin(segment, N, mflag);
92  }
93 
95  return graph.edge_end(segment, N, mflag);
96  }
97 
100  return internal::make_no_deref_range(edge_begin(N, mflag),
101  edge_end(N, mflag));
102  }
103 
106  return edges(N, mflag);
107  }
108 
111  return graph.getInEdgeData(segment, ni, mflag);
112  }
113 
115  return graph.getInEdgeDst(segment, ni);
116  }
117 
119  MethodFlag mflag = MethodFlag::WRITE) {
120  return graph.in_edge_begin(segment, N, mflag);
121  }
122 
124  MethodFlag mflag = MethodFlag::WRITE) {
125  return graph.in_edge_end(segment, N, mflag);
126  }
127 
128  internal::InEdgesIterator<BindSegmentGraph>
130  return internal::InEdgesIterator<BindSegmentGraph>(*this, N, mflag);
131  }
132 
133  size_t idFromNode(GraphNode N) { return graph.idFromNode(N); }
134 
135  GraphNode nodeFromId(size_t N) { return graph.nodeFromId(N); }
136 };
137 
139 class OCFileGraph : private boost::noncopyable {
140 public:
141  typedef uint32_t GraphNode;
142  typedef boost::counting_iterator<uint32_t> iterator;
143  typedef boost::counting_iterator<uint64_t> edge_iterator;
144  typedef uint64_t* edge_offset_iterator;
145 
146  template <typename EdgeTy>
147  struct EdgeReference {
149  };
150 
151 private:
152 #ifdef HAVE_MMAP64
153  typedef off64_t offset_t;
154 #else
155  typedef off_t offset_t;
156 #endif
157 
158  struct PageSizeConf;
159 
160  class Block {
161  friend class OCFileGraph;
162  void* m_mapping;
163  size_t m_length;
164  char* m_data;
165  size_t m_begin;
166  size_t m_sizeof_data;
167 
168  void unload();
169  void load(int fd, offset_t offset, size_t begin, size_t len,
170  size_t sizeof_data);
171 
172  public:
173  Block() : m_mapping(0) {}
174 
175  char* get(size_t index) const {
176  char* p = m_data + (m_sizeof_data * (index - m_begin));
177  assert(p < reinterpret_cast<char*>(m_mapping) + m_length);
178  assert(m_mapping <= p);
179  return p;
180  }
181  };
182 
183  struct Segment {
184  Block outs;
185  Block edgeData;
186  bool loaded;
187 
188  Segment() : loaded(false) {}
189 
190  void unload() {
191  outs.unload();
192  edgeData.unload();
193  loaded = false;
194  }
195  };
196 
197  void* masterMapping;
198  int masterFD;
199  size_t masterLength;
200  uint64_t numEdges;
201  uint64_t numNodes;
202  uint64_t* outIdx;
203 
204 public:
205  typedef Segment segment_type;
206 
208  : masterMapping(0), masterFD(-1), numEdges(0), numNodes(0), outIdx(0) {}
209  ~OCFileGraph();
210 
211  iterator begin() const { return iterator(0); }
212  iterator end() const { return iterator(numNodes); }
213  size_t size() const { return numNodes; }
214  size_t sizeEdges() const { return numEdges; }
216  return edge_iterator(n == 0 ? 0 : outIdx[n - 1]);
217  }
218  edge_iterator edge_end(GraphNode n) const { return edge_iterator(outIdx[n]); }
219  edge_offset_iterator edge_offset_begin() const { return outIdx; }
220  edge_offset_iterator edge_offset_end() const { return outIdx + numNodes; }
221 
222  template <typename EdgeTy>
224  const segment_type& s, edge_iterator it,
225  typename std::enable_if<!std::is_same<void, EdgeTy>::value>::type* = 0) {
226  EdgeTy* p = reinterpret_cast<EdgeTy*>(s.edgeData.get(*it));
227  return *p;
228  }
229 
230  template <typename EdgeTy>
232  const segment_type&, edge_iterator,
233  typename std::enable_if<std::is_same<void, EdgeTy>::value>::type* = 0) {
234  return 0;
235  }
236 
238  uint32_t* p = reinterpret_cast<uint32_t*>(s.outs.get(*it));
239  return *p;
240  }
241 
242  void unload(segment_type& s) {
243  if (!s.loaded)
244  return;
245 
246  s.outs.unload();
247  s.edgeData.unload();
248  s.loaded = false;
249  }
250 
252  size_t sizeof_data);
253 
254  void fromFile(const std::string& fname);
255 };
256 
258 
259 template <typename NodeTy, typename EdgeTy, bool HasNoLockable = false,
260  // bool UseNumaAlloc=false, // XXX: implement this
261  bool HasOutOfLineLockable = false>
263  : private internal::LocalIteratorFeature<false>,
264  private internal::OutOfLineLockableFeature<HasOutOfLineLockable &&
265  !HasNoLockable> {
266 public:
267  template <bool _has_id>
268  struct with_id {
270  };
271 
272  template <typename _node_data>
273  struct with_node_data {
274  typedef OCImmutableEdgeGraph<_node_data, EdgeTy, HasNoLockable,
275  HasOutOfLineLockable>
277  };
278 
279  template <typename _edge_data>
280  struct with_edge_data {
281  typedef OCImmutableEdgeGraph<NodeTy, _edge_data, HasNoLockable,
282  HasOutOfLineLockable>
284  };
285 
286  template <bool _has_no_lockable>
288  typedef OCImmutableEdgeGraph<NodeTy, EdgeTy, _has_no_lockable,
289  HasOutOfLineLockable>
291  };
292 
293  template <bool _use_numa_alloc>
296  };
297 
298  template <bool _has_out_of_line_lockable>
300  typedef OCImmutableEdgeGraph<NodeTy, EdgeTy, HasNoLockable,
301  _has_out_of_line_lockable>
303  };
304 
306 
307 private:
308  typedef internal::NodeInfoBase<NodeTy,
309  !HasNoLockable && !HasOutOfLineLockable>
310  NodeInfo;
312 
313  NodeData nodeData;
314  OCFileGraph outGraph;
315  OCFileGraph inGraphStorage;
316  OCFileGraph* inGraph;
317 
318  uint64_t numNodes;
319  uint64_t numEdges;
320 
321 public:
322  typedef int tt_is_segmented;
323 
325  typedef EdgeTy edge_data_type;
327  typedef NodeTy node_data_type;
328  typedef typename OCFileGraph::template EdgeReference<EdgeTy>::type
330  typedef typename NodeInfo::reference node_data_reference;
333  typedef typename OCFileGraph::iterator iterator;
335  typedef boost::counting_iterator<GraphNode> local_iterator;
337 
338  class segment_type {
339  template <typename, typename, bool, bool>
340  friend class OCImmutableEdgeGraph;
343  iterator nodeBegin;
344  iterator nodeEnd;
345 
346  public:
348  bool loaded() const { return out.loaded; }
350  explicit operator bool() { return nodeBegin != nodeEnd; }
351  size_t size() const { return std::distance(nodeBegin, nodeEnd); }
352  bool containsNode(size_t n) const { // XXX: hack
353  return *nodeBegin <= n && n < *nodeEnd;
354  }
355  };
356 
357 private:
358  galois::optional<segment_type> memorySegment;
359 
360  segment_type computeSegment(size_t startNode, size_t numEdges) {
361  typedef typename OCFileGraph::edge_offset_iterator edge_offset_iterator;
362 
363  segment_type ret;
364 
365  edge_offset_iterator outStart = outGraph.edge_offset_begin();
366  edge_offset_iterator outEnd = outGraph.edge_offset_end();
367  std::advance(outStart, startNode);
368  if (outStart == outEnd) {
369  ret.nodeBegin = ret.nodeEnd = iterator(0);
370  return ret;
371  }
372  edge_offset_iterator outNext =
373  std::lower_bound(outStart + 1, outEnd, *outStart + numEdges);
374  ptrdiff_t outNodes = std::distance(outStart, outNext);
375 
376  edge_offset_iterator inStart = inGraph->edge_offset_begin();
377  edge_offset_iterator inEnd = inGraph->edge_offset_end();
378  std::advance(inStart, startNode);
379  edge_offset_iterator inNext =
380  std::lower_bound(inStart + 1, inEnd, *inStart + numEdges);
381  ptrdiff_t inNodes = std::distance(inStart, inNext);
382 
383  ptrdiff_t nodes = std::min(outNodes, inNodes);
384 
385  ret.nodeBegin = iterator(startNode);
386  ret.nodeEnd = iterator(startNode + nodes);
387  return ret;
388  }
389 
390  void load(segment_type& seg, size_t sizeof_data) {
391  outGraph.load(seg.out, outGraph.edge_begin(*seg.nodeBegin),
392  outGraph.edge_end(seg.nodeEnd[-1]), sizeof_data);
393  if (inGraph != &outGraph)
394  inGraph->load(seg.in, inGraph->edge_begin(*seg.nodeBegin),
395  inGraph->edge_end(seg.nodeEnd[-1]), sizeof_data);
396  else
397  seg.in = seg.out;
398  }
399 
400  template <bool _A1 = HasNoLockable, bool _A2 = HasOutOfLineLockable>
401  void acquireNode(GraphNode N, MethodFlag mflag,
402  typename std::enable_if<!_A1 && !_A2>::type* = 0) {
403  galois::runtime::acquire(&nodeData[N], mflag);
404  }
405 
406  template <bool _A1 = HasOutOfLineLockable, bool _A2 = HasNoLockable>
407  void acquireNode(GraphNode N, MethodFlag mflag,
408  typename std::enable_if<_A1 && !_A2>::type* = 0) {
409  this->outOfLineAcquire(idFromNode(N), mflag);
410  }
411 
412  template <bool _A1 = HasOutOfLineLockable, bool _A2 = HasNoLockable>
413  void acquireNode(GraphNode, MethodFlag,
414  typename std::enable_if<_A2>::type* = 0) {}
415 
416 public:
418  if (memorySegment) {
419  outGraph.unload(memorySegment->out);
420  if (inGraph != &outGraph)
421  inGraph->unload(memorySegment->in);
422  }
423  }
424 
425  void keepInMemory() {
426  memorySegment = galois::optional<segment_type>(computeSegment(0, numEdges));
427  load(*memorySegment, LazyObject<EdgeTy>::size_of::value);
428  }
429 
435  segment_type nextSegment(size_t edges) {
436  if (memorySegment)
437  return *memorySegment;
438  else
439  return computeSegment(0, edges);
440  }
441 
445  segment_type nextSegment(const segment_type& cur, size_t edges) {
446  return computeSegment(*cur.nodeEnd, edges);
447  }
448 
449  void load(segment_type& seg) {
450  if (memorySegment)
451  return;
452 
454  }
455 
456  void unload(segment_type& seg) {
457  if (memorySegment)
458  return;
459 
460  outGraph.unload(seg.out);
461  if (inGraph != &outGraph)
462  inGraph->unload(seg.in);
463  }
464 
465  iterator begin(const segment_type& cur) { return cur.nodeBegin; }
466  iterator end(const segment_type& cur) { return cur.nodeEnd; }
467 
469  MethodFlag mflag = MethodFlag::WRITE) {
470  // galois::runtime::checkWrite(mflag, false);
471  NodeInfo& NI = nodeData[N];
472  acquireNode(N, mflag);
473  return NI.getData();
474  }
475 
478  MethodFlag GALOIS_UNUSED(mflag) = MethodFlag::UNPROTECTED) {
479  // galois::runtime::checkWrite(mflag, false);
480  return outGraph.getEdgeData<EdgeTy>(segment.out, ni);
481  }
482 
484  return outGraph.getEdgeDst(segment.out, ni);
485  }
486 
487  size_t size() const { return numNodes; }
488  size_t sizeEdges() const { return numEdges; }
489 
490  iterator begin() const { return outGraph.begin(); }
491  iterator end() const { return outGraph.end(); }
492 
494  return const_local_iterator(this->localBegin(numNodes));
495  }
497  return const_local_iterator(this->localEnd(numNodes));
498  }
500  return local_iterator(this->localBegin(numNodes));
501  }
503  return local_iterator(this->localEnd(numNodes));
504  }
505 
507  MethodFlag mflag = MethodFlag::WRITE) {
508  acquireNode(N, mflag);
509  if (galois::runtime::shouldLock(mflag)) {
510  for (edge_iterator ii = outGraph.edge_begin(N), ee = outGraph.edge_end(N);
511  ii != ee; ++ii) {
512  acquireNode(outGraph.getEdgeDst(segment.out, *ii), mflag);
513  }
514  }
515  return outGraph.edge_begin(N);
516  }
517 
519  MethodFlag mflag = MethodFlag::WRITE) {
520  acquireNode(N, mflag);
521  return outGraph.edge_end(N);
522  }
523 
526  MethodFlag GALOIS_UNUSED(mflag) = MethodFlag::UNPROTECTED) {
527  // galois::runtime::checkWrite(mflag, false);
528  return inGraph->getEdgeData<EdgeTy>(segment.in, ni);
529  }
530 
532  return inGraph->getEdgeDst(segment.in, ni);
533  }
534 
536  MethodFlag mflag = MethodFlag::WRITE) {
537  acquireNode(N, mflag);
538  if (galois::runtime::shouldLock(mflag)) {
539  for (in_edge_iterator ii = inGraph->edge_begin(N),
540  ee = inGraph->edge_end(N);
541  ii != ee; ++ii) {
542  acquireNode(inGraph->getEdgeDst(segment.in, ii), mflag);
543  }
544  }
545  return inGraph->edge_begin(N);
546  }
547 
549  MethodFlag mflag = MethodFlag::WRITE) {
550  acquireNode(N, mflag);
551  return inGraph->edge_end(N);
552  }
553 
554  size_t idFromNode(GraphNode N) { return N; }
555 
556  GraphNode nodeFromId(size_t N) { return N; }
557 
559  void createFrom(const std::string& fname) {
560  outGraph.fromFile(fname);
561  numNodes = outGraph.size();
562  numEdges = outGraph.sizeEdges();
563  nodeData.create(numNodes);
564  inGraph = &outGraph;
565  this->outOfLineAllocateInterleaved(numNodes);
566  for (size_t i = 0; i < numNodes; ++i)
567  this->outOfLineConstructAt(i);
568  }
569 
570  void createFrom(const std::string& fname, const std::string& transpose) {
571  outGraph.fromFile(fname);
572  inGraphStorage.fromFile(transpose);
573  numNodes = outGraph.size();
574  if (numNodes != inGraphStorage.size())
575  GALOIS_DIE(
576  "graph does not have the same number of nodes as its transpose");
577  numEdges = outGraph.sizeEdges();
578  nodeData.create(numNodes);
579  inGraph = &inGraphStorage;
580  this->outOfLineAllocateInterleaved(numNodes);
581  for (size_t i = 0; i < numNodes; ++i)
582  this->outOfLineConstructAt(i);
583  }
584 };
585 
586 template <typename GraphTy, typename... Args>
588  Args&&... args) {
589  graph.createFrom(std::forward<Args>(args)...);
590 }
591 
592 } // namespace graphs
593 } // namespace galois
594 
595 #endif
local_iterator local_begin() const
Definition: OCGraph.h:87
EdgeReference< EdgeTy >::type getEdgeData(const segment_type &, edge_iterator, typename std::enable_if< std::is_same< void, EdgeTy >::value >::type *=0)
Definition: OCGraph.h:231
void unload(segment_type &seg)
Definition: OCGraph.h:456
OCFileGraph::iterator iterator
Definition: OCGraph.h:333
edge_data_reference getEdgeData(edge_iterator ni, MethodFlag mflag=MethodFlag::UNPROTECTED)
Definition: OCGraph.h:72
size_t size() const
Definition: OCGraph.h:81
size_t sizeEdges() const
Definition: OCGraph.h:82
iterator end() const
Definition: OCGraph.h:212
NodeTy node_data_type
Definition: OCGraph.h:327
iterator begin() const
Definition: OCGraph.h:211
Graph::edge_iterator edge_iterator
Definition: OCGraph.h:60
EdgeTy edge_data_type
Definition: OCGraph.h:325
Single (uninitialized) object with specialization for void type.
Definition: LazyObject.h:71
iterator end() const
Definition: OCGraph.h:491
Graph::const_local_iterator const_local_iterator
Definition: OCGraph.h:65
size_t idFromNode(GraphNode N)
Definition: OCGraph.h:133
~OCImmutableEdgeGraph()
Definition: OCGraph.h:417
EdgeReference< EdgeTy >::type getEdgeData(const segment_type &s, edge_iterator it, typename std::enable_if<!std::is_same< void, EdgeTy >::value >::type *=0)
Definition: OCGraph.h:223
OCFileGraph::edge_iterator edge_iterator
Definition: OCGraph.h:331
NodeInfo::reference node_data_reference
Definition: OCGraph.h:330
OCImmutableEdgeGraph< _node_data, EdgeTy, HasNoLockable, HasOutOfLineLockable > type
Definition: OCGraph.h:276
void keepInMemory()
Definition: OCGraph.h:425
GraphNode getInEdgeDst(in_edge_iterator ni)
Definition: OCGraph.h:114
iterator end(const segment_type &cur)
Definition: OCGraph.h:466
Segment segment_type
Definition: OCGraph.h:205
OCImmutableEdgeGraph type
Definition: OCGraph.h:295
iterator end() const
Definition: OCGraph.h:85
edge_data_reference getInEdgeData(const segment_type &segment, edge_iterator ni, MethodFlag GALOIS_UNUSED(mflag)=MethodFlag::UNPROTECTED)
Definition: OCGraph.h:525
void setSegment(const segment_type &s)
Definition: OCGraph.h:53
void create(size_type n, Args &&...args)
Allocate and construct.
Definition: LargeArray.h:266
OCFileGraph::template EdgeReference< EdgeTy >::type edge_data_reference
Definition: OCGraph.h:329
void readGraphDispatch(GraphTy &graph, read_oc_immutable_edge_graph_tag, Args &&...args)
Definition: OCGraph.h:587
iterator begin() const
Definition: OCGraph.h:84
edge_data_type file_edge_data_type
Definition: OCGraph.h:326
Definition: Iterable.h:36
bool loaded() const
Returns true if segment has been loaded into memory.
Definition: OCGraph.h:348
node_data_reference getData(GraphNode N, MethodFlag mflag=MethodFlag::WRITE)
Definition: OCGraph.h:468
edge_offset_iterator edge_offset_end() const
Definition: OCGraph.h:220
#define GALOIS_DIE(...)
Definition: gIO.h:96
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
iterator begin(const segment_type &cur)
Definition: OCGraph.h:465
void createFrom(const std::string &fname)
Assumes that the graph is symmetric.
Definition: OCGraph.h:559
in_edge_iterator in_edge_begin(GraphNode N, MethodFlag mflag=MethodFlag::WRITE)
Definition: OCGraph.h:118
runtime::iterable< NoDerefIterator< edge_iterator > > edges(GraphNode N, MethodFlag mflag=MethodFlag::WRITE)
Definition: OCGraph.h:99
void unload(segment_type &s)
Definition: OCGraph.h:242
read_oc_immutable_edge_graph_tag read_tag
Definition: OCGraph.h:305
const_local_iterator local_begin() const
Definition: OCGraph.h:493
Galois version of boost::optional.
Definition: optional.h:34
size_t sizeEdges() const
Definition: OCGraph.h:488
in_edge_iterator in_edge_end(GraphNode N, MethodFlag mflag=MethodFlag::WRITE)
Definition: OCGraph.h:123
local_iterator const_local_iterator
Definition: OCGraph.h:336
OCImmutableEdgeGraph type
Definition: OCGraph.h:269
edge_offset_iterator edge_offset_begin() const
Definition: OCGraph.h:219
Graph::GraphNode GraphNode
Definition: OCGraph.h:55
size_t size() const
Definition: OCGraph.h:213
void createFrom(const std::string &fname, const std::string &transpose)
Definition: OCGraph.h:570
OCFileGraph()
Definition: OCGraph.h:207
void load(segment_type &s, edge_iterator begin, edge_iterator end, size_t sizeof_data)
Definition: OCFileGraph.cpp:105
edge_iterator edge_end(GraphNode n) const
Definition: OCGraph.h:218
Graph::iterator iterator
Definition: OCGraph.h:62
iterator const_iterator
Definition: OCGraph.h:334
size_t size() const
Definition: OCGraph.h:487
edge_data_reference getEdgeData(const segment_type &segment, edge_iterator ni, MethodFlag GALOIS_UNUSED(mflag)=MethodFlag::UNPROTECTED)
Definition: OCGraph.h:477
segment_type nextSegment(size_t edges)
Returns a segment starting from the beginning of the graph with either (1) some number of nodes with ...
Definition: OCGraph.h:435
void fromFile(const std::string &fname)
Definition: OCFileGraph.cpp:136
edge_iterator edge_begin(GraphNode N, MethodFlag mflag=MethodFlag::WRITE)
Definition: OCGraph.h:90
size_t size() const
Definition: OCGraph.h:351
local_iterator local_end()
Definition: OCGraph.h:502
Graph::local_iterator local_iterator
Definition: OCGraph.h:64
edge_iterator edge_end(const segment_type &, GraphNode N, MethodFlag mflag=MethodFlag::WRITE)
Definition: OCGraph.h:518
boost::counting_iterator< uint64_t > edge_iterator
Definition: OCGraph.h:143
GraphNode getEdgeDst(const segment_type &segment, edge_iterator ni)
Definition: OCGraph.h:483
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
MethodFlag
What should the runtime do when executing a method.
Definition: MethodFlags.h:34
Graph::const_iterator const_iterator
Definition: OCGraph.h:63
iterator begin() const
Definition: OCGraph.h:490
OCImmutableEdgeGraph< NodeTy, EdgeTy, _has_no_lockable, HasOutOfLineLockable > type
Definition: OCGraph.h:290
GraphNode getInEdgeDst(const segment_type &segment, in_edge_iterator ni)
Definition: OCGraph.h:531
local_iterator local_begin()
Definition: OCGraph.h:499
Graph::in_edge_iterator in_edge_iterator
Definition: OCGraph.h:61
edge_data_reference getInEdgeData(edge_iterator ni, MethodFlag mflag=MethodFlag::UNPROTECTED)
Definition: OCGraph.h:110
const_local_iterator local_end() const
Definition: OCGraph.h:496
unsigned int node_data_type
Definition: EdgeHostDecls.h:34
Graph::node_data_type node_data_type
Definition: OCGraph.h:57
const Ty min(std::atomic< Ty > &a, const Ty &b)
Definition: AtomicHelpers.h:70
OCImmutableEdgeGraph< NodeTy, EdgeTy, HasNoLockable, _has_out_of_line_lockable > type
Definition: OCGraph.h:302
boost::counting_iterator< GraphNode > local_iterator
Definition: OCGraph.h:335
OCImmutableEdgeGraph< NodeTy, _edge_data, HasNoLockable, HasOutOfLineLockable > type
Definition: OCGraph.h:283
Like FileGraph but allows partial loading of the graph.
Definition: OCGraph.h:139
LazyObject< EdgeTy >::reference type
Definition: OCGraph.h:148
edge_iterator in_edge_iterator
Definition: OCGraph.h:332
edge_iterator edge_begin(const segment_type &segment, GraphNode N, MethodFlag mflag=MethodFlag::WRITE)
Definition: OCGraph.h:506
GraphNode nodeFromId(size_t N)
Definition: OCGraph.h:556
size_t idFromNode(GraphNode N)
Definition: OCGraph.h:554
runtime::iterable< NoDerefIterator< edge_iterator > > out_edges(GraphNode N, MethodFlag mflag=MethodFlag::WRITE)
Definition: OCGraph.h:105
node_data_reference getData(GraphNode N, MethodFlag mflag=MethodFlag::WRITE)
Definition: OCGraph.h:67
boost::counting_iterator< uint32_t > iterator
Definition: OCGraph.h:142
Definition: OCGraph.h:262
GraphNode getEdgeDst(edge_iterator ni)
Definition: OCGraph.h:77
void load(segment_type &seg)
Definition: OCGraph.h:449
bool containsNode(size_t n) const
Definition: OCGraph.h:352
Graph::edge_data_reference edge_data_reference
Definition: OCGraph.h:58
edge_iterator edge_begin(GraphNode n) const
Definition: OCGraph.h:215
GraphNode nodeFromId(size_t N)
Definition: OCGraph.h:135
GraphNode getEdgeDst(const segment_type &s, edge_iterator it)
Definition: OCGraph.h:237
Graph::edge_data_type edge_data_type
Definition: OCGraph.h:56
uint32_t GraphNode
Definition: OCGraph.h:141
Binds the segment parameter of an out-of-core graph so that it can be used in place of a non out-of-c...
Definition: OCGraph.h:43
int tt_is_segmented
Definition: OCGraph.h:322
unsigned edge_data_type
Definition: EdgeHostDecls.h:35
edge_iterator edge_end(GraphNode N, MethodFlag mflag=MethodFlag::WRITE)
Definition: OCGraph.h:94
~OCFileGraph()
Definition: OCFileGraph.cpp:59
OCFileGraph::GraphNode GraphNode
Definition: OCGraph.h:324
size_t sizeEdges() const
Definition: OCGraph.h:214
local_iterator local_end() const
Definition: OCGraph.h:88
in_edge_iterator in_edge_begin(const segment_type &segment, GraphNode N, MethodFlag mflag=MethodFlag::WRITE)
Definition: OCGraph.h:535
internal::InEdgesIterator< BindSegmentGraph > in_edges(GraphNode N, MethodFlag mflag=MethodFlag::WRITE)
Definition: OCGraph.h:129
uint64_t * edge_offset_iterator
Definition: OCGraph.h:144
Graph::node_data_reference node_data_reference
Definition: OCGraph.h:59
BindSegmentGraph(Graph &g)
Definition: OCGraph.h:50
in_edge_iterator in_edge_end(const segment_type &, GraphNode N, MethodFlag mflag=MethodFlag::WRITE)
Definition: OCGraph.h:548
segment_type nextSegment(const segment_type &cur, size_t edges)
Returns the next segment after cur.
Definition: OCGraph.h:445
BindSegmentGraph(Graph &g, segment_type s)
Definition: OCGraph.h:51