Galois
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
LC_Morph_Graph.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 
26 #ifndef GALOIS_GRAPHS_LC_MORPH_GRAPH_H
27 #define GALOIS_GRAPHS_LC_MORPH_GRAPH_H
28 
29 #include <type_traits>
30 
31 #include <boost/mpl/if.hpp>
32 
33 #include "galois/Bag.h"
34 #include "galois/config.h"
35 #include "galois/LargeArray.h"
37 #include "galois/graphs/Details.h"
38 
39 namespace galois {
40 namespace graphs {
41 
46 template <typename NodeTy, typename EdgeTy, bool HasNoLockable = false,
47  bool UseNumaAlloc = false, bool HasOutOfLineLockable = false,
48  bool HasId = false, typename FileEdgeTy = EdgeTy>
50  : private boost::noncopyable,
51  private internal::OutOfLineLockableFeature<HasOutOfLineLockable &&
52  !HasNoLockable> {
54  template <typename Graph>
55  friend class LC_InOut_Graph;
56 
57 public:
63  template <bool _has_id>
64  struct with_id {
65  using type = LC_Morph_Graph<NodeTy, EdgeTy, HasNoLockable, UseNumaAlloc,
66  HasOutOfLineLockable, _has_id, FileEdgeTy>;
67  };
68 
73  template <typename _node_data>
74  struct with_node_data {
75  using type = LC_Morph_Graph<_node_data, EdgeTy, HasNoLockable, UseNumaAlloc,
76  HasOutOfLineLockable, HasId, FileEdgeTy>;
77  };
78 
83  template <typename _edge_data>
84  struct with_edge_data {
85  using type = LC_Morph_Graph<NodeTy, _edge_data, HasNoLockable, UseNumaAlloc,
86  HasOutOfLineLockable, HasId, FileEdgeTy>;
87  };
88 
93  template <typename _file_edge_data>
95  using type = LC_Morph_Graph<NodeTy, EdgeTy, HasNoLockable, UseNumaAlloc,
96  HasOutOfLineLockable, HasId, _file_edge_data>;
97  };
98 
103  template <bool _has_no_lockable>
105  using type = LC_Morph_Graph<NodeTy, EdgeTy, _has_no_lockable, UseNumaAlloc,
106  HasOutOfLineLockable, HasId, FileEdgeTy>;
107  };
108 
113  template <bool _use_numa_alloc>
115  using type = LC_Morph_Graph<NodeTy, EdgeTy, HasNoLockable, _use_numa_alloc,
116  HasOutOfLineLockable, HasId, FileEdgeTy>;
117  };
118 
123  template <bool _has_out_of_line_lockable>
125  using type = LC_Morph_Graph<NodeTy, EdgeTy, HasNoLockable, UseNumaAlloc,
126  _has_out_of_line_lockable,
127  _has_out_of_line_lockable || HasId, FileEdgeTy>;
128  };
129 
132 
133 protected:
134  // Forward declaration of class (defined below)
135  class NodeInfo;
136 
138  using EdgeInfo = internal::EdgeInfoBase<NodeInfo*, EdgeTy>;
142  using NodeInfoTypes =
143  internal::NodeInfoBaseTypes<NodeTy,
144  !HasNoLockable && !HasOutOfLineLockable>;
145 
148  struct EdgeHolder {
155  };
156 
161  class NodeInfo
162  : public internal::NodeInfoBase<NodeTy,
163  !HasNoLockable && !HasOutOfLineLockable> {
164  using Super =
165  internal::NodeInfoBase<NodeTy, !HasNoLockable && !HasOutOfLineLockable>;
166  friend class LC_Morph_Graph;
167 
168  EdgeInfo* edgeBegin;
169  EdgeInfo* edgeEnd;
170 #ifndef NDEBUG
171  EdgeInfo* trueEdgeEnd;
172 #endif
173 
174  public:
176  template <typename... Args>
177  NodeInfo(Args&&... args) : Super(std::forward<Args>(args)...) {}
178  }; // end NodeInfo
179 
181  struct makeGraphNode : public std::unary_function<NodeInfo&, NodeInfo*> {
183  NodeInfo* operator()(NodeInfo& data) const { return &data; }
184  };
185 
190  struct dst_equals {
194  dst_equals(NodeInfo* d) : dst(d) {}
197  bool operator()(const EdgeInfo& edge) { return edge.dst == dst; }
198  };
199 
200 public:
202  using GraphNode = NodeInfo*;
204  using file_edge_data_type = FileEdgeTy;
206  using edge_data_type = EdgeTy;
208  using node_data_type = NodeTy;
210  using node_data_reference = typename NodeInfoTypes::reference;
216  using iterator =
217  boost::transform_iterator<makeGraphNode, typename Nodes::iterator>;
219  using const_iterator =
220  boost::transform_iterator<makeGraphNode, typename Nodes::const_iterator>;
227 
228 protected:
233 
241  template <bool _A1 = HasNoLockable, bool _A2 = HasOutOfLineLockable>
243  typename std::enable_if<!_A1 && !_A2>::type* = 0) {
244  galois::runtime::acquire(N, mflag);
245  }
246 
255  template <bool _A1 = HasOutOfLineLockable, bool _A2 = HasNoLockable>
257  typename std::enable_if<_A1 && !_A2>::type* = 0) {
258  this->outOfLineAcquire(getId(N), mflag);
259  }
260 
265  template <bool _A1 = EdgeInfo::has_value,
268  typename FileGraph::edge_iterator nn, GraphNode src,
269  GraphNode dst,
270  typename std::enable_if<!_A1 || _A2>::type* = 0) {
271  if (EdgeInfo::has_value) {
272  // type of edge data in file graph
273  using FEDV = typename LargeArray<FileEdgeTy>::value_type;
274  // add an edge with edge data
276  graph.getEdgeData<FEDV>(nn));
277  } else {
278  // add an edge without edge data
280  }
281  }
282 
287  template <bool _A1 = EdgeInfo::has_value,
290  GraphNode src, GraphNode dst,
291  typename std::enable_if<_A1 && !_A2>::type* = 0) {
293  }
294 
298  template <bool _A1 = HasOutOfLineLockable, bool _A2 = HasNoLockable>
300  typename std::enable_if<_A2>::type* = 0) {}
301 
305  template <bool _Enable = HasId>
306  size_t getId(GraphNode N, typename std::enable_if<_Enable>::type* = 0) {
307  return N->getId();
308  }
309 
310 public:
316  for (typename Nodes::iterator ii = nodes.begin(), ei = nodes.end();
317  ii != ei; ++ii) {
318  NodeInfo& n = *ii;
319  EdgeInfo* edgeBegin = n.edgeBegin;
320  EdgeInfo* edgeEnd = n.edgeEnd;
321 
322  if (EdgeInfo::has_value) {
323  while (edgeBegin != edgeEnd) {
324  edgeBegin->destroy();
325  ++edgeBegin;
326  }
327  }
328  }
329  }
330 
335  MethodFlag mflag = MethodFlag::WRITE) {
336  // galois::runtime::checkWrite(mflag, false);
337  acquireNode(N, mflag);
338  return N->getData();
339  }
340 
346  // galois::runtime::checkWrite(mflag, false);
347  acquireNode(ni->dst, mflag);
348  return ni->get();
349  }
350 
355  // galois::runtime::checkWrite(mflag, false);
356  // acquireNode(ni->dst, mflag);
357  return GraphNode(ni->dst);
358  }
359 
364  return boost::make_transform_iterator(nodes.begin(), makeGraphNode());
365  }
366 
369  return boost::make_transform_iterator(nodes.end(), makeGraphNode());
370  }
371 
374  return boost::make_transform_iterator(nodes.local_begin(), makeGraphNode());
375  }
376 
379  return boost::make_transform_iterator(nodes.local_end(), makeGraphNode());
380  }
381 
386  acquireNode(N, mflag);
387  // Locks all destinations before returning edge iterator.
388  if (galois::runtime::shouldLock(mflag)) {
389  for (edge_iterator ii = N->edgeBegin, ee = N->edgeEnd; ii != ee; ++ii) {
390  acquireNode(ii->dst, mflag);
391  }
392  }
393  return N->edgeBegin;
394  }
395 
400  MethodFlag GALOIS_UNUSED(mflag) = MethodFlag::WRITE) {
401  return N->edgeEnd;
402  }
403 
409  return internal::make_no_deref_range(edge_begin(N, mflag),
410  edge_end(N, mflag));
411  }
412 
417  internal::EdgesIterator<LC_Morph_Graph>
419  return internal::EdgesIterator<LC_Morph_Graph>(*this, N, mflag);
420  }
421 
429  template <typename... Args>
430  GraphNode createNode(int nedges, Args&&... args) {
431  NodeInfo* N = &nodes.emplace(std::forward<Args>(args)...);
433  EdgeHolder*& local_edges = *edgesL.getLocal();
434 
435  // Allocate space for a new EdgeHolder object if necessary
436  if (!local_edges ||
437  std::distance(local_edges->begin, local_edges->end) < nedges) {
438  EdgeHolder* old = local_edges;
439  // FIXME: this seems to leak
440  size_t size = runtime::pagePoolSize();
441  void* block = runtime::pagePoolAlloc();
442  local_edges = reinterpret_cast<EdgeHolder*>(block);
443  local_edges->next = old;
444 
445  size -= sizeof(EdgeHolder);
446  block = reinterpret_cast<char*>(block) + sizeof(EdgeHolder);
447 
448  if (!std::align(std::alignment_of_v<EdgeInfo>, sizeof(EdgeInfo), block,
449  size)) {
450  GALOIS_DIE("not enough space for EdgeInfo");
451  }
452 
453  local_edges->begin = reinterpret_cast<EdgeInfo*>(block);
454  local_edges->end = local_edges->begin;
455  local_edges->end += size / sizeof(EdgeInfo);
456  if (std::distance(local_edges->begin, local_edges->end) < nedges) {
457  GALOIS_DIE("not enough space for EdgeInfo");
458  }
459  }
460 
461  // Set the memory aside for the new node in the edge holder object
462  N->edgeBegin = N->edgeEnd = local_edges->begin;
463  local_edges->begin += nedges;
464 #ifndef NDEBUG
465  N->trueEdgeEnd = local_edges->begin;
466 #endif
467  return GraphNode(N);
468  }
469 
478  template <typename... Args>
480  Args&&... args) {
481  // galois::runtime::checkWrite(mflag, true);
482  acquireNode(src, mflag);
483  auto it = std::find_if(src->edgeBegin, src->edgeEnd, dst_equals(dst));
484  if (it == src->edgeEnd) {
485  it->dst = dst;
486  it->construct(std::forward<Args>(args)...);
487  src->edgeEnd++;
488  assert(src->edgeEnd <= src->trueEdgeEnd);
489  }
490  return it;
491  }
492 
503  template <typename... Args>
505  galois::MethodFlag mflag, Args&&... args) {
506  acquireNode(src, mflag);
507  auto it = src->edgeEnd;
508  it->dst = dst;
509  it->construct(std::forward<Args>(args)...);
510  src->edgeEnd++;
511  assert(src->edgeEnd <= src->trueEdgeEnd);
512  return it;
513  }
514 
522  // galois::runtime::checkWrite(mflag, true);
523  acquireNode(src, mflag);
524  src->edgeEnd--;
525  assert(src->edgeBegin <= src->edgeEnd);
526  std::swap(*dst, *src->edgeEnd);
527  src->edgeEnd->destroy();
528  }
529 
535  // galois::runtime::checkWrite(mflag, true); // TODO: double check 'true'
536  // here
537  acquireNode(src, mflag);
538  return std::find_if(src->edgeBegin, src->edgeEnd, dst_equals(dst));
539  }
540 
550  size_t numNodes = graph.size();
551 
552  if (UseNumaAlloc) {
553  aux.allocateLocal(numNodes);
554  this->outOfLineAllocateLocal(numNodes);
555  } else {
556  aux.allocateInterleaved(numNodes);
557  this->outOfLineAllocateInterleaved(numNodes);
558  }
559  }
560 
570  void constructNodesFrom(FileGraph& graph, unsigned tid, unsigned total,
571  ReadGraphAuxData& aux) {
572  // get the portion of the graph that this thread is responsible for
573  // creating
574  auto r = graph
575  .divideByNode(sizeof(NodeInfo) +
576  LC_Morph_Graph::size_of_out_of_line::value,
577  sizeof(EdgeInfo), tid, total)
578  .first;
579 
580  // create nodes of portion we are responsible for only
581  for (FileGraph::iterator ii = r.first, ei = r.second; ii != ei; ++ii) {
582  aux[*ii] =
583  createNode(std::distance(graph.edge_begin(*ii), graph.edge_end(*ii)));
584  }
585  }
586 
598  void constructEdgesFrom(FileGraph& graph, unsigned tid, unsigned total,
599  const ReadGraphAuxData& aux) {
600  auto r = graph
601  .divideByNode(sizeof(NodeInfo) +
602  LC_Morph_Graph::size_of_out_of_line::value,
603  sizeof(EdgeInfo), tid, total)
604  .first;
605 
606  for (FileGraph::iterator ii = r.first, ei = r.second; ii != ei; ++ii) {
607  for (FileGraph::edge_iterator nn = graph.edge_begin(*ii),
608  en = graph.edge_end(*ii);
609  nn != en; ++nn) {
610  constructEdgeValue(graph, nn, aux[*ii], aux[graph.getEdgeDst(nn)]);
611  }
612  }
613  }
614 };
615 
616 } // namespace graphs
617 } // namespace galois
618 
619 #endif /* LC_MORPH_GRAPH_H_ */
boost::transform_iterator< makeGraphNode, typename Nodes::iterator > iterator
Iterator over nodes.
Definition: LC_Morph_Graph.h:217
void acquireNode(GraphNode N, MethodFlag mflag, typename std::enable_if<!_A1 &&!_A2 >::type *=0)
Acquire a node for the scope in which the function is called.
Definition: LC_Morph_Graph.h:242
EdgeTy edge_data_type
Type of edge data.
Definition: LC_Morph_Graph.h:206
Struct used to define the type of node data through the template parameter.
Definition: LC_Morph_Graph.h:74
typename NodeInfoTypes::reference node_data_reference
Reference type to node data.
Definition: LC_Morph_Graph.h:210
reference emplace(Args &&...args)
Thread safe bag insertion.
Definition: Bag.h:260
internal::EdgeInfoBase< NodeInfo *, EdgeTy > EdgeInfo
EdgeInfo keeps destination of edges.
Definition: LC_Morph_Graph.h:138
GraphNode createNode(int nedges, Args &&...args)
Creates a new node with a cap on the number of edges.
Definition: LC_Morph_Graph.h:430
edge_iterator edge_begin(GraphNode N)
Returns the index to the beginning of global node N&#39;s outgoing edges in the outgoing edges array...
Definition: FileGraph.cpp:641
Contains FileGraph and FileGraphWriter class declarations.
void constructEdgesFrom(FileGraph &graph, unsigned tid, unsigned total, const ReadGraphAuxData &aux)
Constructs the LCMorphGraph edges given a FileGraph to construct it from and pointers to already crea...
Definition: LC_Morph_Graph.h:598
NodeInfo * dst
Destination to compare with.
Definition: LC_Morph_Graph.h:192
iterator begin()
Definition: Bag.h:238
size_t size() const
Returns the number of nodes in the (sub)graph.
Definition: FileGraph.h:545
GraphNode getEdgeDst(edge_iterator ni)
Get the destination of an edge given an iterator to the edge.
Definition: LC_Morph_Graph.h:354
T value_type
Definition: LargeArray.h:60
boost::counting_iterator< uint64_t > iterator
uint64 boost counting iterator
Definition: FileGraph.h:408
Nodes nodes
Nodes in this graph.
Definition: LC_Morph_Graph.h:230
~LC_Morph_Graph()
Destructor.
Definition: LC_Morph_Graph.h:315
internal::EdgesIterator< LC_Morph_Graph > out_edges(GraphNode N, MethodFlag mflag=MethodFlag::WRITE)
Returns an object with begin() and end() methods to iterate over the outgoing edges of N...
Definition: LC_Morph_Graph.h:418
GraphNode getEdgeDst(edge_iterator it)
Gets the destination of some edge.
Definition: FileGraph.cpp:669
local_iterator local_begin()
Return an iterator to the beginning of the local nodes of the graph.
Definition: LC_Morph_Graph.h:373
boost::counting_iterator< uint64_t > edge_iterator
Edge iterators (boost iterator)
Definition: FileGraph.h:248
Definition: Iterable.h:36
local_iterator local_begin()
Definition: Bag.h:243
EdgeInfo * end
End of memory for this block.
Definition: LC_Morph_Graph.h:152
FileEdgeTy file_edge_data_type
Type of edge data in file.
Definition: LC_Morph_Graph.h:204
iterator begin()
Returns an iterator to all the nodes in the graph.
Definition: LC_Morph_Graph.h:363
#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
void allocateLocal(size_type n)
Allocates using Thread Local memory policy.
Definition: LargeArray.h:220
Class that stores node info (e.g.
Definition: LC_Morph_Graph.h:161
boost::transform_iterator< makeGraphNode, typename Nodes::const_iterator > const_iterator
Constant iterator over nodes.
Definition: LC_Morph_Graph.h:220
Functor that returns pointers to NodeInfo objects given references.
Definition: LC_Morph_Graph.h:181
Struct used to define the UseNumaAlloc template parameter.
Definition: LC_Morph_Graph.h:114
Modify a LC_Graph to have in and out edges.
Definition: LC_InOut_Graph.h:39
EdgeInfo * begin
Beginning of memory for this block.
Definition: LC_Morph_Graph.h:150
runtime::iterable< NoDerefIterator< edge_iterator > > edges(GraphNode N, MethodFlag mflag=MethodFlag::WRITE)
Return a range for edges of a node for use by C++ for_each loops.
Definition: LC_Morph_Graph.h:408
iterator end()
Definition: Bag.h:239
EdgeTy & reference
Definition: LazyObject.h:96
edge_iterator edge_end(GraphNode N, MethodFlag GALOIS_UNUSED(mflag)=MethodFlag::WRITE)
Return an iterator to the end of edges of a particular node.
Definition: LC_Morph_Graph.h:399
void allocateInterleaved(size_type n)
[allocatefunctions] Allocates interleaved across NUMA (memory) nodes.
Definition: LargeArray.h:206
Local computation graph that allows addition of nodes (but not removals) if the maximum degree of a n...
Definition: LC_Morph_Graph.h:49
Struct used to define the HasNoLockable template parameter.
Definition: LC_Morph_Graph.h:104
size_t getId(GraphNode N, typename std::enable_if< _Enable >::type *=0)
Get the ID of a graph node if they&#39;re enabled in the class.
Definition: LC_Morph_Graph.h:306
Struct used to define the type of file edge data through the template parameter.
Definition: LC_Morph_Graph.h:94
NodeInfo(Args &&...args)
Calls NodeInfoBase constructor.
Definition: LC_Morph_Graph.h:177
size_t pagePoolSize()
Definition: PagePool.cpp:50
void allocateFrom(FileGraph &graph, ReadGraphAuxData &aux)
Allocate memory for nodes given a file graph with a particular number of nodes.
Definition: LC_Morph_Graph.h:549
Definition: PerThreadStorage.h:88
edge_data_reference getEdgeData(edge_iterator ni, MethodFlag mflag=MethodFlag::UNPROTECTED)
Get edge data of an edge given an iterator to the edge.
Definition: LC_Morph_Graph.h:344
Linked list structure holding together blocks of memory that stores edges.
Definition: LC_Morph_Graph.h:148
local_iterator local_end()
Return an iterator to the end of the local nodes of the graph.
Definition: LC_Morph_Graph.h:378
edge_iterator edge_begin(GraphNode N, MethodFlag mflag=MethodFlag::WRITE)
Return an iterator to the first edge of a particular node.
Definition: LC_Morph_Graph.h:385
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
Large array of objects with proper specialization for void type and supporting various allocation and...
Definition: LargeArray.h:53
internal::NodeInfoBaseTypes< NodeTy,!HasNoLockable &&!HasOutOfLineLockable > NodeInfoTypes
Type of nodes.
Definition: LC_Morph_Graph.h:144
bool operator()(const EdgeInfo &edge)
Given an edge, check if the edge destination matches the node that this functor was constructed with...
Definition: LC_Morph_Graph.h:197
MethodFlag
What should the runtime do when executing a method.
Definition: MethodFlags.h:34
iterator local_iterator
Local iterator is just an iterator.
Definition: LC_Morph_Graph.h:222
NodeInfo * operator()(NodeInfo &data) const
Returns a pointer to the NodeInfo reference passed into this functor.
Definition: LC_Morph_Graph.h:183
void * pagePoolAlloc()
Low level page pool (individual pages, use largeMalloc for large blocks)
Definition: PagePool.cpp:41
EdgeTy & getEdgeData(GraphNode src, GraphNode dst)
Get edge data of an edge between 2 nodes.
Definition: FileGraph.h:241
Struct used to define the type of edge data through the template parameter.
Definition: LC_Morph_Graph.h:84
dst_equals(NodeInfo *d)
Constructor: takes a node to compare edge destinations with.
Definition: LC_Morph_Graph.h:194
void acquireNode(GraphNode, MethodFlag, typename std::enable_if< _A2 >::type *=0)
No-op acquire node when HasNoLockable is true.
Definition: LC_Morph_Graph.h:299
void constructNodesFrom(FileGraph &graph, unsigned tid, unsigned total, ReadGraphAuxData &aux)
Constructs the LCMorphGraph nodes given a FileGraph to construct it from.
Definition: LC_Morph_Graph.h:570
typename EdgeInfo::reference edge_data_reference
Reference type to edge data.
Definition: LC_Morph_Graph.h:212
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&#39;s outgoing edges in the outgoing edges array...
Definition: FileGraph.cpp:655
void constructEdgeValue(FileGraph &graph, typename FileGraph::edge_iterator nn, GraphNode src, GraphNode dst, typename std::enable_if<!_A1||_A2 >::type *=0)
Given a FileGraph and an edge in it, add it to the LCMorphGraph.
Definition: LC_Morph_Graph.h:267
Functor: contains an operator to compare the destination of an edge with a particular node...
Definition: LC_Morph_Graph.h:190
node_data_reference getData(const GraphNode &N, MethodFlag mflag=MethodFlag::WRITE)
Get the data of a node N.
Definition: LC_Morph_Graph.h:334
galois::substrate::PerThreadStorage< EdgeHolder * > edgesL
Memory for edges in this graph (memory held in EdgeHolders)
Definition: LC_Morph_Graph.h:232
Graph that mmaps Galois gr files for access.
Definition: FileGraph.h:57
void acquireNode(GraphNode N, MethodFlag mflag, typename std::enable_if< _A1 &&!_A2 >::type *=0)
Acquire a node for the scope in which the function is called.
Definition: LC_Morph_Graph.h:256
edge_iterator addMultiEdge(GraphNode src, GraphNode dst, galois::MethodFlag mflag, Args &&...args)
Construct a new edge for a node.
Definition: LC_Morph_Graph.h:504
NodeInfo * GraphNode
A graph node is a NodeInfo object.
Definition: LC_Morph_Graph.h:202
void constructEdgeValue(FileGraph &, typename FileGraph::edge_iterator, GraphNode src, GraphNode dst, typename std::enable_if< _A1 &&!_A2 >::type *=0)
Given a FileGraph and an edge in it, add it to the LCMorphGraph.
Definition: LC_Morph_Graph.h:289
InputIterator find_if(InputIterator first, InputIterator last, Predicate pred)
Definition: ParallelSTL.h:70
edge_iterator findEdge(GraphNode src, GraphNode dst, galois::MethodFlag mflag=MethodFlag::WRITE)
Finds an edge between 2 nodes and returns the iterator to it if it exists.
Definition: LC_Morph_Graph.h:533
Struct that allows activation of the HasId template parameter Example: using Graph = LC_Morph_Graph::...
Definition: LC_Morph_Graph.h:64
void removeEdge(GraphNode src, edge_iterator dst, galois::MethodFlag mflag=MethodFlag::WRITE)
Remove an edge from the graph.
Definition: LC_Morph_Graph.h:520
Iterator< NodeInfo > iterator
Definition: Bag.h:234
iterator end()
Returns the end of the node iterator. Not thread-safe.
Definition: LC_Morph_Graph.h:368
local_iterator local_end()
Definition: Bag.h:246
NodeTy node_data_type
Type of node data.
Definition: LC_Morph_Graph.h:208
Struct used to define the HasOutOfLineLockable template parameter.
Definition: LC_Morph_Graph.h:124
EdgeHolder * next
Pointer to another block of memory for edges (if it exists).
Definition: LC_Morph_Graph.h:154
const_iterator const_local_iterator
Const local iterator is just an const_iterator.
Definition: LC_Morph_Graph.h:224
EdgeInfo * edge_iterator
Iterator over EdgeInfo objects (edges)
Definition: LC_Morph_Graph.h:214
edge_iterator addEdge(GraphNode src, GraphNode dst, galois::MethodFlag mflag, Args &&...args)
Adds an edge if it doesn&#39;t already exist.
Definition: LC_Morph_Graph.h:479