From 03c1af117348428ee5776f2f8067866fba519cc4 Mon Sep 17 00:00:00 2001 From: Justin Viiret Date: Thu, 29 Jun 2017 10:38:46 +1000 Subject: [PATCH] ng_misc_opt: use small_color_map --- src/nfagraph/ng_misc_opt.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/nfagraph/ng_misc_opt.cpp b/src/nfagraph/ng_misc_opt.cpp index c55a02e6..c8dfcbab 100644 --- a/src/nfagraph/ng_misc_opt.cpp +++ b/src/nfagraph/ng_misc_opt.cpp @@ -69,6 +69,7 @@ #include "util/charreach.h" #include "util/container.h" #include "util/graph_range.h" +#include "util/graph_small_color_map.h" #include "util/ue2_containers.h" #include "ue2common.h" @@ -552,16 +553,17 @@ bool mergeCyclicDotStars(NGHolder &g) { struct PrunePathsInfo { 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() { no_explore.clear(); - fill(color_map.begin(), color_map.end(), boost::white_color); + color_map.fill(small_color::white); bad.reset(); } flat_set no_explore; - vector color_map; + using color_map_type = decltype(make_small_color_map(NGHolder())); + color_map_type color_map; boost::dynamic_bitset<> bad; }; @@ -597,9 +599,6 @@ void findDependentVertices(const NGHolder &g, PrunePathsInfo &info, auto filtered_g = 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 // very large) set structure. 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)) { continue; } - boost::depth_first_visit(filtered_g, b, recorder, color); + boost::depth_first_visit(filtered_g, b, recorder, info.color_map); } }