12#ifndef MCRL2_UTILITIES_REACHABLE_NODES_H
13#define MCRL2_UTILITIES_REACHABLE_NODES_H
15#include <boost/graph/adjacency_list.hpp>
16#include <boost/graph/depth_first_search.hpp>
17#include <boost/tuple/tuple.hpp>
31template <
typename Graph>
32struct reachable_nodes_recorder:
public boost::default_dfs_visitor
34 typedef typename Graph::vertex_descriptor vertex_descriptor;
35 std::vector<std::size_t>& m_result;
37 reachable_nodes_recorder(std::vector<std::size_t>& result)
44 void discover_vertex(vertex_descriptor u,
const Graph& g)
46 m_result.push_back(boost::get(boost::vertex_index, g)[u]);
58template <
typename Graph,
typename Iter>
61 typedef boost::color_traits<boost::default_color_type> Color;
63 std::vector<std::size_t> result;
64 detail::reachable_nodes_recorder<Graph> recorder(result);
65 std::vector<boost::default_color_type> colormap(boost::num_vertices(g), Color::white());
67 for (Iter i = first; i != last; ++i)
69 boost::default_color_type c = Color::white();
70 boost::depth_first_visit(g,
73 boost::make_iterator_property_map(colormap.begin(), boost::get(boost::vertex_index, g), c)
std::vector< std::size_t > reachable_nodes(const Graph &g, Iter first, Iter last)
Compute reachable nodes in a graph.
A class that takes a linear process specification and checks all tau-summands of that LPS for conflue...