mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-06-28 16:41:01 +03:00
ng_depth: use small_color_map in findLoopReachable
This commit is contained in:
parent
9c046db360
commit
90faea4ce9
@ -34,17 +34,18 @@
|
|||||||
#include "ng_util.h"
|
#include "ng_util.h"
|
||||||
#include "ue2common.h"
|
#include "ue2common.h"
|
||||||
#include "util/graph_range.h"
|
#include "util/graph_range.h"
|
||||||
|
#include "util/graph_small_color_map.h"
|
||||||
|
|
||||||
#include <deque>
|
#include <deque>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include <boost/graph/breadth_first_search.hpp>
|
||||||
#include <boost/graph/dag_shortest_paths.hpp>
|
#include <boost/graph/dag_shortest_paths.hpp>
|
||||||
#include <boost/graph/depth_first_search.hpp>
|
#include <boost/graph/depth_first_search.hpp>
|
||||||
#include <boost/graph/breadth_first_search.hpp>
|
|
||||||
#include <boost/graph/filtered_graph.hpp>
|
#include <boost/graph/filtered_graph.hpp>
|
||||||
|
#include <boost/graph/property_maps/constant_property_map.hpp>
|
||||||
#include <boost/graph/reverse_graph.hpp>
|
#include <boost/graph/reverse_graph.hpp>
|
||||||
#include <boost/graph/topological_sort.hpp>
|
#include <boost/graph/topological_sort.hpp>
|
||||||
#include <boost/graph/property_maps/constant_property_map.hpp>
|
|
||||||
#include <boost/range/adaptor/reversed.hpp>
|
#include <boost/range/adaptor/reversed.hpp>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
@ -137,13 +138,15 @@ vector<bool> findLoopReachable(const Graph &g,
|
|||||||
EdgeSet deadEdges;
|
EdgeSet deadEdges;
|
||||||
BackEdges<EdgeSet> be(deadEdges);
|
BackEdges<EdgeSet> be(deadEdges);
|
||||||
|
|
||||||
depth_first_search(g, visitor(be).root_vertex(src));
|
auto colors = make_small_color_map(g);
|
||||||
|
|
||||||
|
depth_first_search(g, be, colors, src);
|
||||||
auto af = make_bad_edge_filter(&deadEdges);
|
auto af = make_bad_edge_filter(&deadEdges);
|
||||||
auto acyclic_g = make_filtered_graph(g, af);
|
auto acyclic_g = make_filtered_graph(g, af);
|
||||||
|
|
||||||
vector<Vertex> topoOrder; /* actually reverse topological order */
|
vector<Vertex> topoOrder; /* actually reverse topological order */
|
||||||
topoOrder.reserve(deadNodes.size());
|
topoOrder.reserve(deadNodes.size());
|
||||||
topological_sort(acyclic_g, back_inserter(topoOrder));
|
topological_sort(acyclic_g, back_inserter(topoOrder), color_map(colors));
|
||||||
|
|
||||||
for (const auto &e : deadEdges) {
|
for (const auto &e : deadEdges) {
|
||||||
size_t srcIdx = g[source(e, g)].index;
|
size_t srcIdx = g[source(e, g)].index;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user