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 @@ -312,6 +312,7 @@ class grapht
312312
313313 std::list<node_indext> topsort () const ;
314314
315+ std::vector<node_indext> get_predecessors (const node_indext &n) const ;
315316 std::vector<node_indext> get_successors (const node_indext &n) const ;
316317 void output_dot (std::ostream &out) const ;
317318 void for_each_successor (
@@ -934,6 +935,19 @@ void output_dot_generic(
934935 });
935936}
936937
938+ template <class N >
939+ std::vector<typename grapht<N>::node_indext>
940+ grapht<N>::get_predecessors(const node_indext &n) const
941+ {
942+ std::vector<node_indext> result;
943+ std::transform (
944+ nodes[n].in .begin (),
945+ nodes[n].in .end (),
946+ std::back_inserter (result),
947+ [&](const std::pair<node_indext, edget> &edge) { return edge.first ; });
948+ return result;
949+ }
950+
937951template <class N >
938952std::vector<typename grapht<N>::node_indext>
939953grapht<N>::get_successors(const node_indext &n) const
You can’t perform that action at this time.
0 commit comments