File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -315,6 +315,9 @@ class grapht
315
315
std::vector<node_indext> get_predecessors (const node_indext &n) const ;
316
316
std::vector<node_indext> get_successors (const node_indext &n) const ;
317
317
void output_dot (std::ostream &out) const ;
318
+ void for_each_predecessor (
319
+ const node_indext &n,
320
+ std::function<void (const node_indext &)> f) const ;
318
321
void for_each_successor (
319
322
const node_indext &n,
320
323
std::function<void (const node_indext &)> f) const ;
@@ -961,6 +964,17 @@ grapht<N>::get_successors(const node_indext &n) const
961
964
return result;
962
965
}
963
966
967
+ template <class N >
968
+ void grapht<N>::for_each_predecessor(
969
+ const node_indext &n,
970
+ std::function<void (const node_indext &)> f) const
971
+ {
972
+ std::for_each (
973
+ nodes[n].in .begin (),
974
+ nodes[n].in .end (),
975
+ [&](const std::pair<node_indext, edget> &edge) { f (edge.first ); });
976
+ }
977
+
964
978
template <class N >
965
979
void grapht<N>::for_each_successor(
966
980
const node_indext &n,
You can’t perform that action at this time.
0 commit comments