mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-06-28 16:41:01 +03:00
ng_misc_opt: use small_color_map
This commit is contained in:
parent
48f9a6d518
commit
03c1af1173
@ -69,6 +69,7 @@
|
|||||||
#include "util/charreach.h"
|
#include "util/charreach.h"
|
||||||
#include "util/container.h"
|
#include "util/container.h"
|
||||||
#include "util/graph_range.h"
|
#include "util/graph_range.h"
|
||||||
|
#include "util/graph_small_color_map.h"
|
||||||
#include "util/ue2_containers.h"
|
#include "util/ue2_containers.h"
|
||||||
#include "ue2common.h"
|
#include "ue2common.h"
|
||||||
|
|
||||||
@ -552,16 +553,17 @@ bool mergeCyclicDotStars(NGHolder &g) {
|
|||||||
|
|
||||||
struct PrunePathsInfo {
|
struct PrunePathsInfo {
|
||||||
explicit PrunePathsInfo(const NGHolder &g)
|
explicit PrunePathsInfo(const NGHolder &g)
|
||||||
: color_map(num_vertices(g)), bad(num_vertices(g)) {}
|
: color_map(make_small_color_map(g)), bad(num_vertices(g)) {}
|
||||||
|
|
||||||
void clear() {
|
void clear() {
|
||||||
no_explore.clear();
|
no_explore.clear();
|
||||||
fill(color_map.begin(), color_map.end(), boost::white_color);
|
color_map.fill(small_color::white);
|
||||||
bad.reset();
|
bad.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
flat_set<NFAEdge> no_explore;
|
flat_set<NFAEdge> no_explore;
|
||||||
vector<boost::default_color_type> color_map;
|
using color_map_type = decltype(make_small_color_map(NGHolder()));
|
||||||
|
color_map_type color_map;
|
||||||
boost::dynamic_bitset<> bad;
|
boost::dynamic_bitset<> bad;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -597,9 +599,6 @@ void findDependentVertices(const NGHolder &g, PrunePathsInfo &info,
|
|||||||
auto filtered_g =
|
auto filtered_g =
|
||||||
make_filtered_graph(g, make_bad_edge_filter(&info.no_explore));
|
make_filtered_graph(g, make_bad_edge_filter(&info.no_explore));
|
||||||
|
|
||||||
auto color = make_iterator_property_map(info.color_map.begin(),
|
|
||||||
get(vertex_index, g));
|
|
||||||
|
|
||||||
// We use a bitset to track bad vertices, rather than filling a (potentially
|
// We use a bitset to track bad vertices, rather than filling a (potentially
|
||||||
// very large) set structure.
|
// very large) set structure.
|
||||||
auto recorder = make_vertex_index_bitset_recorder(info.bad);
|
auto recorder = make_vertex_index_bitset_recorder(info.bad);
|
||||||
@ -608,7 +607,7 @@ void findDependentVertices(const NGHolder &g, PrunePathsInfo &info,
|
|||||||
if (b != g.start && g[b].char_reach.isSubsetOf(g[v].char_reach)) {
|
if (b != g.start && g[b].char_reach.isSubsetOf(g[v].char_reach)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
boost::depth_first_visit(filtered_g, b, recorder, color);
|
boost::depth_first_visit(filtered_g, b, recorder, info.color_map);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user