20 #ifndef GALOIS_GRAPH_MORPH_SEPINOUT_GRAPH_H
21 #define GALOIS_GRAPH_MORPH_SEPINOUT_GRAPH_H
26 #include <type_traits>
29 #include <boost/container/small_vector.hpp>
30 #include <boost/functional.hpp>
31 #include <boost/iterator/filter_iterator.hpp>
32 #include <boost/iterator/transform_iterator.hpp>
55 template <
typename NTy,
typename ETy,
bool DirectedButNotInOut>
58 template <
typename NTy,
typename ETy>
59 struct UEdgeInfoBase<NTy, ETy, true> {
60 typedef ETy& reference;
69 inline NTy
const* first()
const {
73 inline ETy* second() {
return &Ea; }
74 inline const ETy* second()
const {
return &Ea; }
76 template <
typename... Args>
77 UEdgeInfoBase(NTy* n, ETy*,
bool, Args&&... args)
78 : N(n), Ea(std::forward<Args>(args)...) {}
80 template <
typename... Args>
81 UEdgeInfoBase(NTy* n, ETy& v,
bool, Args&&...) : N(n) {
85 static size_t sizeOfSecond() {
return sizeof(ETy); }
86 bool isInEdge()
const {
return false; }
89 template <
typename NTy,
typename ETy>
90 struct UEdgeInfoBase<NTy, ETy, false> {
91 typedef ETy& reference;
98 return (NTy*)((uintptr_t)N & ~1);
100 inline NTy
const* first()
const {
102 return (NTy*)((uintptr_t)N & ~1);
104 inline ETy* second() {
return Ea; }
105 inline const ETy* second()
const {
return Ea; }
106 template <
typename... Args>
107 UEdgeInfoBase(NTy* n, ETy* v,
bool f, Args&&...)
108 : N((NTy*)((uintptr_t)n | f)), Ea(v) {}
109 static size_t sizeOfSecond() {
return sizeof(ETy); }
110 bool isInEdge()
const {
return (uintptr_t)N & 1; }
113 template <
typename NTy>
114 struct UEdgeInfoBase<NTy, void, true> {
115 typedef char& reference;
118 inline NTy* first() {
return N; }
119 inline NTy
const* first()
const {
return N; }
120 inline char* second()
const {
return static_cast<char*
>(NULL); }
121 inline char* addr()
const {
return second(); }
122 template <
typename... Args>
123 UEdgeInfoBase(NTy* n,
void*,
bool, Args&&...) : N(n) {}
124 static size_t sizeOfSecond() {
return 0; }
125 bool isInEdge()
const {
return false; }
128 template <
typename NTy>
129 struct UEdgeInfoBase<NTy, void, false> {
130 typedef char& reference;
133 inline NTy* first() {
return (NTy*)((uintptr_t)N & ~1); }
134 inline NTy
const* first()
const {
return (NTy*)((uintptr_t)N & ~1); }
135 inline char* second()
const {
return static_cast<char*
>(NULL); }
136 inline char* addr()
const {
return second(); }
137 template <
typename... Args>
138 UEdgeInfoBase(NTy* n,
void*,
bool f, Args&&...)
139 : N((NTy*)((uintptr_t)n | f)) {}
140 static size_t sizeOfSecond() {
return 0; }
141 bool isInEdge()
const {
return (uintptr_t)N & 1; }
149 template <
typename ETy,
bool DirectedNotInOut>
152 template <
typename... Args>
153 ETy* mkEdge(Args&&... args) {
154 return &mem.
emplace(std::forward<Args>(args)...);
156 void delEdge(ETy*) {}
157 bool mustDel()
const {
return false; }
160 template <
typename ETy>
161 struct EdgeFactory<ETy, true> {
162 template <
typename... Args>
163 ETy* mkEdge(Args&&...) {
166 void delEdge(ETy*) {}
167 bool mustDel()
const {
return false; }
171 struct EdgeFactory<void, false> {
172 template <
typename... Args>
173 void* mkEdge(Args&&...) {
174 return static_cast<void*
>(NULL);
176 void delEdge(
void*) {}
177 bool mustDel()
const {
return false; }
233 template <
typename NodeTy,
typename EdgeTy,
bool Directional,
234 bool InOut =
false,
bool HasNoLockable =
false,
235 bool SortedNeighbors =
false,
typename FileEdgeTy = EdgeTy>
239 template <
bool _has_no_lockable>
242 _has_no_lockable, SortedNeighbors, FileEdgeTy>
246 template <
typename _node_data>
249 HasNoLockable, SortedNeighbors, FileEdgeTy>
253 template <
typename _edge_data>
256 HasNoLockable, SortedNeighbors, FileEdgeTy>
260 template <
typename _file_edge_data>
263 HasNoLockable, SortedNeighbors,
268 template <
bool _directional>
271 HasNoLockable, SortedNeighbors, FileEdgeTy>
275 template <
bool _sorted_neighbors>
278 HasNoLockable, _sorted_neighbors, FileEdgeTy>
285 template <
typename T>
286 struct first_eq_and_valid {
288 first_eq_and_valid(T& n) : N2(n) {}
289 template <
typename T2>
291 return ii.first() == N2 && ii.first() && ii.first()->active;
295 struct first_not_valid {
296 template <
typename T2>
298 return !ii.first() || !ii.first()->active;
302 template <
typename T>
304 template <
typename T2>
305 bool operator()(
const T& N2,
const T2& ii)
const {
306 assert(ii.first() &&
"UNEXPECTED: invalid item in edgelist");
307 return N2 < ii.first();
309 template <
typename T2>
310 bool operator()(
const T2& ii,
const T& N2)
const {
311 assert(ii.first() &&
"UNEXPECTED: invalid item in edgelist");
312 return ii.first() < N2;
318 :
public internal::NodeInfoBaseTypes<NodeTy, !HasNoLockable> {
320 typedef internal::UEdgeInfoBase<gNode, EdgeTy, Directional & !InOut>
326 typedef boost::container::small_vector<
330 typedef typename EdgesTy::iterator
iterator;
333 class gNode :
public internal::NodeInfoBase<NodeTy, !HasNoLockable>,
335 friend class Morph_SepInOut_Graph;
336 typedef internal::NodeInfoBase<NodeTy, !HasNoLockable> NodeInfo;
337 typename gNodeTypes::EdgesTy
edges;
338 typename gNodeTypes::EdgesTy
in_edges;
339 typedef typename gNode::iterator
iterator;
340 typedef typename gNode::EdgeInfo EdgeInfo;
350 void erase(
iterator ii,
bool inEdge =
false) {
352 if (SortedNeighbors) {
359 *ii = edgelist.back();
364 void erase(gNode* N,
bool inEdge =
false) {
369 iterator find(gNode* N,
bool inEdge =
false) {
372 if (SortedNeighbors) {
373 assert(std::is_sorted(edgelist.begin(), edgelist.end(),
374 [=](
const EdgeInfo& e1,
const EdgeInfo& e2) {
375 return e1.first() < e2.first();
377 ii = std::lower_bound(edgelist.begin(), edgelist.end(), N,
380 ii = edgelist.begin();
383 first_eq_and_valid<gNode*> checker(N);
385 while (ii != ei && ii->isInEdge() != inEdge) {
394 edgelist.resize(size, EdgeInfo(
new gNode(), 0));
397 template <
typename... Args>
398 iterator createEdge(gNode* N, EdgeTy* v,
bool inEdge, Args&&... args) {
401 if (SortedNeighbors) {
404 ii = std::upper_bound(edgelist.begin(), edgelist.end(), N,
408 return edgelist.insert(
409 ii, EdgeInfo(N, v, inEdge, std::forward<Args>(args)...));
412 template <
typename... Args>
413 iterator createEdgeWithReuse(gNode* N, EdgeTy* v,
bool inEdge,
418 if (SortedNeighbors) {
420 ii = std::lower_bound(edgelist.begin(), edgelist.end(), N,
422 ei = std::upper_bound(ii, edgelist.end(), N, first_lt<gNode*>());
425 ii = edgelist.begin();
431 *ii = EdgeInfo(N, v, inEdge, std::forward<Args>(args)...);
434 return edgelist.insert(
435 ei, EdgeInfo(N, v, inEdge, std::forward<Args>(args)...));
438 template <
bool _A1 = HasNoLockable>
443 template <
bool _A1 = HasNoLockable>
447 template <
typename... Args>
448 gNode(Args&&... args)
449 : NodeInfo(std::forward<Args>(args)...), active(false) {}
456 internal::EdgeFactory<EdgeTy, Directional && !InOut> edgesF;
459 struct is_node :
public std::unary_function<gNode&, bool> {
460 bool operator()(
const gNode& g)
const {
return g.active; }
463 :
public std::unary_function<typename gNodeTypes::EdgeInfo&, bool> {
464 bool operator()(
typename gNodeTypes::EdgeInfo& e)
const {
465 return e.first()->active;
469 :
public std::unary_function<typename gNodeTypes::EdgeInfo&, bool> {
470 bool operator()(
typename gNodeTypes::EdgeInfo& e)
const {
471 return e.first()->active && e.isInEdge();
475 :
public std::unary_function<typename gNodeTypes::EdgeInfo&, bool> {
476 bool operator()(
typename gNodeTypes::EdgeInfo& e)
const {
477 return e.first()->active && !e.isInEdge();
480 struct makeGraphNode :
public std::unary_function<gNode&, gNode*> {
481 gNode*
operator()(gNode& data)
const {
return &data; }
494 typedef typename boost::filter_iterator<is_out_edge,
495 typename gNodeTypes::iterator>
499 typename boost::filter_iterator<is_in_edge, typename gNodeTypes::iterator>
506 typedef boost::transform_iterator<
508 boost::filter_iterator<is_node, typename NodeListTy::iterator>>
527 typename std::conditional<DirectedNotInOut, LargeArray<GraphNode>,
532 template <
typename... Args>
539 typename gNode::iterator ii = src->find(dst);
540 if (ii == src->end()) {
541 if (Directional && !InOut) {
542 ii = src->createEdgeWithReuse(dst, 0,
false,
543 std::forward<Args>(args)...);
546 EdgeTy* e = edgesF.mkEdge(std::forward<Args>(args)...);
547 ii = dst->createEdgeWithReuse(src, e, Directional ?
true :
false,
548 std::forward<Args>(args)...);
549 ii = src->createEdgeWithReuse(dst, e,
false,
550 std::forward<Args>(args)...);
553 return boost::make_filter_iterator(is_out_edge(), ii, src->end());
556 template <
typename... Args>
563 typename gNode::iterator ii = src->end();
564 if (ii == src->end()) {
565 if (Directional && !InOut) {
566 ii = src->createEdge(dst, 0,
false, std::forward<Args>(args)...);
569 EdgeTy* e = edgesF.mkEdge(std::forward<Args>(args)...);
570 ii = dst->createEdge(src, e, Directional ?
true :
false,
571 std::forward<Args>(args)...);
572 ii = src->createEdge(dst, e,
false, std::forward<Args>(args)...);
575 return boost::make_filter_iterator(is_out_edge(), ii, src->end());
582 template <
typename... Args>
589 typename gNode::iterator ii = src->end();
590 if (ii == src->end()) {
592 EdgeTy* e = edgesF.mkEdge(std::forward<Args>(args)...);
593 ii = src->createEdge(dst, e,
false, std::forward<Args>(args)...);
604 template <
typename... Args>
611 typename gNode::iterator ii = dst->end();
612 if (ii == dst->end()) {
614 ii = dst->createEdge(src, e, Directional ?
true :
false,
615 std::forward<Args>(args)...);
619 template <bool _A1 = LargeArray<EdgeTy>::has_value,
620 bool _A2 = LargeArray<FileEdgeTy>::has_value>
624 typename std::enable_if<!_A1 || _A2>::type* = 0) {
626 typedef LargeArray<EdgeTy> ED;
629 graph.getEdgeData<FEDV>(nn));
635 template <bool _A1 = LargeArray<EdgeTy>::has_value,
636 bool _A2 = LargeArray<FileEdgeTy>::has_value>
640 typename std::enable_if<_A1 && !_A2>::type* = 0) {
645 void constructInEdgeValue(FileGraph&, EdgeTy* e,
GraphNode src,
655 template <
typename... Args>
657 gNode* N = &(nodes.
emplace(std::forward<Args>(args)...));
716 src->resizeEdges(size);
717 src->resizeEdges(size,
true);
729 return createEdgeWithReuse(src, dst, mflag);
734 template <
typename... Args>
737 return createEdge(src, dst, mflag, std::forward<Args>(args)...);
746 if (Directional && !InOut) {
747 src->erase(dst.base());
749 dst->first()->acquire(mflag);
752 src, Directional ?
true :
false);
753 src->erase(dst.base());
757 template <
bool _DirectedInOut = (Directional && InOut)>
760 typename std::enable_if<_DirectedInOut>::type* = 0) {
764 src->first()->acquire(mflag);
766 src->first()->erase(dst);
767 dst->erase(src.base(),
true);
776 typename gNodeTypes::iterator ii = src->find(dst), ei = src->end();
777 is_out_edge edge_predicate;
778 if (ii != ei && edge_predicate(*ii)) {
781 if (!edge_predicate(*ii))
786 return boost::make_filter_iterator(edge_predicate, ii, ei);
795 assert(std::is_sorted(src->begin(), src->end(),
796 [=](
const typename gNode::EdgeInfo& e1,
797 const typename gNode::EdgeInfo& e2) {
798 return e1.first() < e2.first();
801 auto ei = src->end();
803 std::lower_bound(src->begin(), src->end(), dst, first_lt<gNode*>());
805 first_eq_and_valid<gNode*> checker(dst);
807 while (ii != ei && ii->isInEdge()) {
812 is_out_edge edge_predicate;
815 if (!edge_predicate(*ii)) {
819 return boost::make_filter_iterator(edge_predicate, ii, ei);
822 template <
bool _Undirected = !Directional>
825 typename std::enable_if<_Undirected>::type* = 0) {
833 template <
bool _DirectedInOut = (Directional && InOut)>
837 typename std::enable_if<_DirectedInOut>::type* = 0) {
841 typename gNodeTypes::iterator ii = dst->find(src,
true),
842 ei = dst->in_edge_end();
843 is_in_edge edge_predicate;
844 if (ii != ei && edge_predicate(*ii)) {
847 if (!edge_predicate(*ii))
852 return boost::make_filter_iterator(edge_predicate, ii, ei);
865 assert(ii->first()->active);
867 ii->first()->acquire(mflag);
868 return *ii->second();
874 assert(ii->first()->active);
876 ii->first()->acquire(mflag);
877 return *ii->second();
882 assert(ii->first()->active);
887 assert(ii->first()->active);
894 typedef typename gNode::EdgeInfo EdgeInfo;
895 auto eDstCompare = [=](
const EdgeInfo& e1,
const EdgeInfo& e2) {
896 return e1.first() < e2.first();
898 std::sort(N->begin(), N->end(), eDstCompare);
899 std::sort(N->in_edge_begin(), N->in_edge_end(), eDstCompare);
917 for (
typename gNode::iterator ii = N->begin(), ee = N->end(); ii != ee;
919 if (ii->first()->active && !ii->isInEdge())
920 ii->first()->acquire(mflag);
923 return boost::make_filter_iterator(is_out_edge(), N->begin(), N->end());
926 template <
bool _Undirected = !Directional>
929 typename std::enable_if<!_Undirected>::type* = 0) {
934 for (
typename gNode::iterator ii = N->in_edge_begin(),
935 ee = N->in_edge_end();
937 if (ii->first()->active && ii->isInEdge())
938 ii->first()->acquire(mflag);
941 return boost::make_filter_iterator(is_in_edge(), N->in_edge_begin(),
945 template <
bool _Undirected = !Directional>
948 typename std::enable_if<_Undirected>::type* = 0) {
960 return boost::make_filter_iterator(is_out_edge(), N->end(), N->end());
963 template <
bool _Undirected = !Directional>
967 typename std::enable_if<!_Undirected>::type* = 0) {
972 return boost::make_filter_iterator(is_in_edge(), N->in_edge_end(),
976 template <
bool _Undirected = !Directional>
979 typename std::enable_if<_Undirected>::type* = 0) {
985 return internal::make_no_deref_range(
edge_begin(N, mflag),
989 template <
bool _Undirected = !Directional>
992 typename std::enable_if<!_Undirected>::type* = 0) {
993 return internal::make_no_deref_range(
in_edge_begin(N, mflag),
997 template <
bool _Undirected = !Directional>
1000 typename std::enable_if<_Undirected>::type* = 0) {
1001 return edges(N, mflag);
1008 internal::EdgesIterator<Morph_SepInOut_Graph>
1010 return internal::EdgesIterator<Morph_SepInOut_Graph>(*
this, N, mflag);
1017 return boost::make_transform_iterator(
1018 boost::make_filter_iterator(is_node(), nodes.
begin(), nodes.
end()),
1024 return boost::make_transform_iterator(
1025 boost::make_filter_iterator(is_node(), nodes.
end(), nodes.
end()),
1032 return boost::make_transform_iterator(
1033 boost::make_filter_iterator(is_node(), nodes.
local_begin(),
1039 return boost::make_transform_iterator(
1040 boost::make_filter_iterator(is_node(), nodes.
local_end(),
1055 size_t numNodes = graph.
size();
1056 aux.nodes.allocateInterleaved(numNodes);
1062 .divideByNode(
sizeof(gNode),
sizeof(
typename gNode::EdgeInfo),
1074 .divideByNode(
sizeof(gNode),
sizeof(
typename gNode::EdgeInfo),
1077 auto& map = aux.inNghs.get();
1081 en = graph.edge_end(*ii);
1083 auto dstID = graph.getEdgeDst(nn);
1084 auto src = aux.nodes[*ii], dst = aux.nodes[dstID];
1085 auto e = constructOutEdgeValue(graph, nn, src, dst);
1086 if (!Directional || InOut) {
1087 map[dstID].push_back({src, e});
1095 if (!Directional || InOut) {
1097 .divideByNode(
sizeof(gNode),
1098 sizeof(
typename gNode::EdgeInfo), tid, total)
1101 for (
size_t i = 0; i < aux.inNghs.numRows(); ++i) {
1102 const auto& map = aux.inNghs.get(i);
1103 auto ii = map.lower_bound(*(r.first));
1104 auto ei = map.lower_bound(*(r.second));
1105 for (; ii != ei; ++ii) {
1106 auto dst = aux.nodes[ii->first];
1107 for (
const auto& ie : ii->second) {
1108 constructInEdgeValue(graph, ie.second, ie.first, dst);
1116 size_t numNodes = graph.
size();
1117 aux.allocateInterleaved(numNodes);
1121 [&](
size_t index) { aux.constructAt(index); });
1125 template <
bool V = DirectedNotInOut>
1130 .
divideByNode(
sizeof(gNode),
sizeof(
typename gNode::EdgeInfo),
1134 auto& auxNode = aux[*ii].get();
1140 template <
bool V = DirectedNotInOut>
1145 .
divideByNode(
sizeof(gNode),
sizeof(
typename gNode::EdgeInfo),
1154 template <
bool V = DirectedNotInOut>
1159 .
divideByNode(
sizeof(gNode),
sizeof(
typename gNode::EdgeInfo),
1167 auto src = aux[*ii].get().n;
1168 auto& dstAux = aux[graph.
getEdgeDst(nn)].get();
1169 auto e = constructOutEdgeValue(graph, nn, src, dstAux.n);
1171 dstAux.inNghs.push_back({src, e});
1172 dstAux.lock.unlock();
1177 template <
bool V = DirectedNotInOut>
1182 .
divideByNode(
sizeof(gNode),
sizeof(
typename gNode::EdgeInfo),
1190 constructOutEdgeValue(graph, nn, aux[*ii], aux[graph.
getEdgeDst(nn)]);
1195 template <
bool V = DirectedNotInOut>
1200 .
divideByNode(
sizeof(gNode),
sizeof(
typename gNode::EdgeInfo),
1205 auto& auxNode = aux[*ii].get();
1206 for (
auto ie : auxNode.inNghs) {
1207 constructInEdgeValue(graph, ie.second, ie.first, auxNode.n);
1212 template <
bool V = DirectedNotInOut>
GraphNode createNode(Args &&...args)
Creates a new node holding the indicated data.
Definition: Morph_SepInOut_Graph.h:656
boost::filter_iterator< is_out_edge, typename gNodeTypes::iterator > edge_iterator
(Out or Undirected) Edge iterator
Definition: Morph_SepInOut_Graph.h:496
in_edge_iterator findInEdge(GraphNode src, GraphNode dst, galois::MethodFlag mflag=MethodFlag::WRITE, typename std::enable_if< _DirectedInOut >::type *=0)
Definition: Morph_SepInOut_Graph.h:835
internal::EdgesIterator< Morph_SepInOut_Graph > out_edges(GraphNode N, MethodFlag mflag=MethodFlag::WRITE)
An object with begin() and end() methods to iterate over the outgoing edges of N. ...
Definition: Morph_SepInOut_Graph.h:1009
reference emplace(Args &&...args)
Thread safe bag insertion.
Definition: Bag.h:260
std::enable_if_t<!V > constructOutEdgesFrom(FileGraph &graph, unsigned tid, unsigned total, ReadGraphAuxData &aux)
Definition: Morph_SepInOut_Graph.h:1155
edge_data_reference getEdgeData(in_edge_iterator ii, galois::MethodFlag mflag=MethodFlag::UNPROTECTED) const
Definition: Morph_SepInOut_Graph.h:872
std::enable_if_t< V > constructNodesFrom(FileGraph &graph, unsigned tid, unsigned total, ReadGraphAuxData &aux)
Definition: Morph_SepInOut_Graph.h:1141
Definition: Morph_SepInOut_Graph.h:247
edge_iterator findEdgeSortedByDst(GraphNode src, GraphNode dst, galois::MethodFlag mflag=MethodFlag::WRITE)
Definition: Morph_SepInOut_Graph.h:790
Definition: Morph_SepInOut_Graph.h:276
void resizeEdges(GraphNode src, size_t size, galois::MethodFlag mflag=MethodFlag::WRITE)
Resize the edges of the node.
Definition: Morph_SepInOut_Graph.h:711
boost::filter_iterator< is_in_edge, typename gNodeTypes::iterator > in_edge_iterator
In Edge iterator.
Definition: Morph_SepInOut_Graph.h:500
Morph_SepInOut_Graph< NodeTy, EdgeTy, Directional, InOut, HasNoLockable, SortedNeighbors, _file_edge_data > type
Definition: Morph_SepInOut_Graph.h:265
Morph_SepInOut_Graph< NodeTy, EdgeTy, Directional, InOut, _has_no_lockable, SortedNeighbors, FileEdgeTy > type
Definition: Morph_SepInOut_Graph.h:243
Definition: CacheLineStorage.h:32
read_with_aux_first_graph_tag read_tag
Definition: Morph_SepInOut_Graph.h:282
static constexpr const bool DirectedNotInOut
Definition: Morph_SepInOut_Graph.h:525
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
Contains FileGraph and FileGraphWriter class declarations.
edge_iterator findEdge(GraphNode src, GraphNode dst, galois::MethodFlag mflag=MethodFlag::WRITE)
Finds if an edge between src and dst exists.
Definition: Morph_SepInOut_Graph.h:771
gNodeTypes::reference node_data_reference
Reference to node data.
Definition: Morph_SepInOut_Graph.h:504
iterator begin()
Definition: Bag.h:238
size_t size() const
Returns the number of nodes in the (sub)graph.
Definition: FileGraph.h:545
galois::substrate::SimpleLock lock
Definition: Morph_SepInOut_Graph.h:519
void removeNode(GraphNode n, galois::MethodFlag mflag=MethodFlag::WRITE)
Removes a node from the graph along with all its outgoing/incoming edges for undirected graphs or out...
Definition: Morph_SepInOut_Graph.h:695
boost::counting_iterator< uint64_t > iterator
uint64 boost counting iterator
Definition: FileGraph.h:408
NodeTy node_data_type
Node data type.
Definition: Morph_SepInOut_Graph.h:492
GraphNode n
Definition: Morph_SepInOut_Graph.h:520
GraphNode getEdgeDst(edge_iterator ii)
Returns the destination of an edge.
Definition: Morph_SepInOut_Graph.h:881
GraphNode getEdgeDst(edge_iterator it)
Gets the destination of some edge.
Definition: FileGraph.cpp:669
node_data_reference getData(const GraphNode &n, galois::MethodFlag mflag=MethodFlag::WRITE) const
Gets the node data for a node.
Definition: Morph_SepInOut_Graph.h:674
local_iterator local_end()
Definition: Morph_SepInOut_Graph.h:1038
boost::counting_iterator< uint64_t > edge_iterator
Edge iterators (boost iterator)
Definition: FileGraph.h:248
iterator begin()
Returns an iterator to all the nodes in the graph.
Definition: Morph_SepInOut_Graph.h:1016
Definition: Iterable.h:36
local_iterator local_begin()
Definition: Bag.h:243
void sortAllEdgesByDst(MethodFlag mflag=MethodFlag::WRITE)
Definition: Morph_SepInOut_Graph.h:902
uint64_t GraphNode
type of a node
Definition: FileGraph.h:60
unsigned int size()
Returns the number of nodes in the graph.
Definition: Morph_SepInOut_Graph.h:1048
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
edge_iterator edge_end(GraphNode N, galois::MethodFlag GALOIS_UNUSED(mflag)=MethodFlag::WRITE)
Returns the end of the neighbor iterator.
Definition: Morph_SepInOut_Graph.h:954
std::enable_if_t<!V > constructNodesFrom(FileGraph &graph, unsigned tid, unsigned total, ReadGraphAuxData &aux)
Definition: Morph_SepInOut_Graph.h:1126
Definition: Morph_SepInOut_Graph.h:269
void allocateFrom(FileGraph &graph, ReadGraphAuxData &aux)
Definition: Morph_SepInOut_Graph.h:1115
void addNode(const GraphNode &n, galois::MethodFlag mflag=MethodFlag::WRITE)
Adds a node to the graph.
Definition: Morph_SepInOut_Graph.h:665
typename galois::substrate::CacheLineStorage< AuxNode > AuxNodePadded
Definition: Morph_SepInOut_Graph.h:523
void sort(RandomAccessIterator first, RandomAccessIterator last, Compare comp)
Definition: ParallelSTL.h:247
gNode * GraphNode
Graph node handle.
Definition: Morph_SepInOut_Graph.h:486
FileEdgeTy file_edge_data_type
Edge data type of file we are loading this graph from.
Definition: Morph_SepInOut_Graph.h:490
Definition: Morph_SepInOut_Graph.h:254
size_t sizeOfEdgeData() const
Returns the size of edge data.
Definition: Morph_SepInOut_Graph.h:1051
iterator local_iterator
Definition: Morph_SepInOut_Graph.h:1029
iterator end()
Definition: Bag.h:239
std::vector< T, Pow2Alloc< T >> Vector
[STL vector using Pow_2_VarSizeAlloc]
Definition: gstl.h:52
Morph_SepInOut_Graph< NodeTy, EdgeTy, Directional, InOut, HasNoLockable, _sorted_neighbors, FileEdgeTy > type
Definition: Morph_SepInOut_Graph.h:279
void sortEdgesByDst(GraphNode N, galois::MethodFlag mflag=MethodFlag::WRITE)
Definition: Morph_SepInOut_Graph.h:891
Unordered collection of elements.
Definition: Bag.h:42
typename std::conditional< DirectedNotInOut, LargeArray< GraphNode >, LargeArray< AuxNodePadded >>::type ReadGraphAuxData
Definition: Morph_SepInOut_Graph.h:528
runtime::iterable< NoDerefIterator< in_edge_iterator > > in_edges(GraphNode N, galois::MethodFlag mflag=MethodFlag::WRITE, typename std::enable_if<!_Undirected >::type *=0)
Definition: Morph_SepInOut_Graph.h:991
Morph_SepInOut_Graph< _node_data, EdgeTy, Directional, InOut, HasNoLockable, SortedNeighbors, FileEdgeTy > type
Definition: Morph_SepInOut_Graph.h:250
std::enable_if_t< V > constructInEdgesFrom(FileGraph &, unsigned, unsigned, ReadGraphAuxData &)
Definition: Morph_SepInOut_Graph.h:1213
Definition: runtime/Mem.h:864
edge_iterator edge_begin(GraphNode N, galois::MethodFlag mflag=MethodFlag::WRITE)
Returns an iterator to the neighbors of a node.
Definition: Morph_SepInOut_Graph.h:911
Morph_SepInOut_Graph< NodeTy, _edge_data, Directional, InOut, HasNoLockable, SortedNeighbors, FileEdgeTy > type
Definition: Morph_SepInOut_Graph.h:257
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
If true, do not use abstract locks in graph.
Definition: Morph_SepInOut_Graph.h:240
Large array of objects with proper specialization for void type and supporting various allocation and...
Definition: LargeArray.h:53
MethodFlag
What should the runtime do when executing a method.
Definition: MethodFlags.h:34
edge_iterator findInEdge(GraphNode src, GraphNode dst, galois::MethodFlag mflag=MethodFlag::WRITE, typename std::enable_if< _Undirected >::type *=0)
Definition: Morph_SepInOut_Graph.h:823
void operator()(void)
Definition: Executor_ParaMeter.h:417
GraphNode getEdgeDst(in_edge_iterator ii)
Definition: Morph_SepInOut_Graph.h:886
std::enable_if_t< V > constructOutEdgesFrom(FileGraph &graph, unsigned tid, unsigned total, const ReadGraphAuxData &aux)
Definition: Morph_SepInOut_Graph.h:1178
local_iterator local_begin()
Definition: Morph_SepInOut_Graph.h:1031
edge_data_reference getEdgeData(edge_iterator ii, galois::MethodFlag mflag=MethodFlag::UNPROTECTED) const
Returns the edge data associated with the edge.
Definition: Morph_SepInOut_Graph.h:863
void do_all(const RangeFunc &rangeMaker, FunctionTy &&fn, const Args &...args)
Standard do-all loop.
Definition: Loops.h:71
std::enable_if_t<!V > constructInEdgesFrom(FileGraph &graph, unsigned tid, unsigned total, ReadGraphAuxData &aux)
Definition: Morph_SepInOut_Graph.h:1196
in_edge_iterator in_edge_end(GraphNode N, galois::MethodFlag GALOIS_UNUSED(mflag)=MethodFlag::WRITE, typename std::enable_if<!_Undirected >::type *=0)
Definition: Morph_SepInOut_Graph.h:965
gNodeTypes::EdgeInfo::reference edge_data_reference
Reference to edge data.
Definition: Morph_SepInOut_Graph.h:502
edge_iterator in_edge_end(GraphNode N, galois::MethodFlag mflag=MethodFlag::WRITE, typename std::enable_if< _Undirected >::type *=0)
Definition: Morph_SepInOut_Graph.h:977
EdgeTy edge_data_type
Edge data type.
Definition: Morph_SepInOut_Graph.h:488
SimpleLock is a spinlock.
Definition: SimpleLock.h:36
bool containsNode(const GraphNode &n, galois::MethodFlag mflag=MethodFlag::WRITE) const
Checks if a node is in the graph.
Definition: Morph_SepInOut_Graph.h:683
void removeInEdge(GraphNode dst, in_edge_iterator src, galois::MethodFlag mflag=MethodFlag::WRITE, typename std::enable_if< _DirectedInOut >::type *=0)
Definition: Morph_SepInOut_Graph.h:758
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
edge_iterator in_edge_begin(GraphNode N, galois::MethodFlag mflag=MethodFlag::WRITE, typename std::enable_if< _Undirected >::type *=0)
Definition: Morph_SepInOut_Graph.h:946
boost::transform_iterator< makeGraphNode, boost::filter_iterator< is_node, typename NodeListTy::iterator > > iterator
Node iterator.
Definition: Morph_SepInOut_Graph.h:509
Definition: PerThreadContainer.h:523
Definition: Morph_SepInOut_Graph.h:518
galois::gstl::Vector< std::pair< GraphNode, EdgeTy * > > inNghs
Definition: Morph_SepInOut_Graph.h:521
Graph that mmaps Galois gr files for access.
Definition: FileGraph.h:57
Morph_SepInOut_Graph< NodeTy, EdgeTy, _directional, InOut, HasNoLockable, SortedNeighbors, FileEdgeTy > type
Definition: Morph_SepInOut_Graph.h:272
auto iterate(C &cont)
Definition: Range.h:323
InputIterator find_if(InputIterator first, InputIterator last, Predicate pred)
Definition: ParallelSTL.h:70
A Graph.
Definition: Morph_SepInOut_Graph.h:236
local_iterator local_end()
Definition: Bag.h:246
T value_type
Definition: Executor_ParaMeter.h:111
runtime::iterable< NoDerefIterator< edge_iterator > > edges(GraphNode N, galois::MethodFlag mflag=MethodFlag::WRITE)
Definition: Morph_SepInOut_Graph.h:984
in_edge_iterator in_edge_begin(GraphNode N, galois::MethodFlag mflag=MethodFlag::WRITE, typename std::enable_if<!_Undirected >::type *=0)
Definition: Morph_SepInOut_Graph.h:928
Definition: Morph_SepInOut_Graph.h:261
runtime::iterable< NoDerefIterator< edge_iterator > > in_edges(GraphNode N, galois::MethodFlag mflag=MethodFlag::WRITE, typename std::enable_if< _Undirected >::type *=0)
Definition: Morph_SepInOut_Graph.h:999
void removeEdge(GraphNode src, edge_iterator dst, galois::MethodFlag mflag=MethodFlag::WRITE)
Removes an edge from the graph.
Definition: Morph_SepInOut_Graph.h:741
iterator end()
Returns the end of the node iterator. Not thread-safe.
Definition: Morph_SepInOut_Graph.h:1023
edge_iterator addMultiEdge(GraphNode src, GraphNode dst, galois::MethodFlag mflag, Args &&...args)
Adds and initializes an edge to graph but does not check for duplicate edges.
Definition: Morph_SepInOut_Graph.h:735
edge_iterator addEdge(GraphNode src, GraphNode dst, galois::MethodFlag mflag=MethodFlag::WRITE)
Adds an edge to graph, replacing existing value if edge already exists.
Definition: Morph_SepInOut_Graph.h:727