diff options
author | thegeorg <thegeorg@yandex-team.ru> | 2022-02-10 16:45:12 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:12 +0300 |
commit | 49116032d905455a7b1c994e4a696afc885c1e71 (patch) | |
tree | be835aa92c6248212e705f25388ebafcf84bc7a1 /contrib/libs/hyperscan/src/nfagraph/ng_repeat.cpp | |
parent | 4e839db24a3bbc9f1c610c43d6faaaa99824dcca (diff) | |
download | ydb-49116032d905455a7b1c994e4a696afc885c1e71.tar.gz |
Restoring authorship annotation for <thegeorg@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/libs/hyperscan/src/nfagraph/ng_repeat.cpp')
-rw-r--r-- | contrib/libs/hyperscan/src/nfagraph/ng_repeat.cpp | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/contrib/libs/hyperscan/src/nfagraph/ng_repeat.cpp b/contrib/libs/hyperscan/src/nfagraph/ng_repeat.cpp index 5808d87440..1f63ad3c6f 100644 --- a/contrib/libs/hyperscan/src/nfagraph/ng_repeat.cpp +++ b/contrib/libs/hyperscan/src/nfagraph/ng_repeat.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Intel Corporation + * Copyright (c) 2015-2018, Intel Corporation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -47,7 +47,7 @@ #include "util/dump_charclass.h" #include "util/graph_range.h" #include "util/graph_small_color_map.h" -#include "util/graph_undirected.h" +#include "util/graph_undirected.h" #include "util/report_manager.h" #include "util/unordered.h" @@ -73,31 +73,31 @@ namespace ue2 { namespace { -/** - * \brief Filter that retains only edges between vertices with the same - * reachability. Special vertices are dropped. - */ +/** + * \brief Filter that retains only edges between vertices with the same + * reachability. Special vertices are dropped. + */ template<class Graph> struct ReachFilter { - ReachFilter() = default; + ReachFilter() = default; explicit ReachFilter(const Graph *g_in) : g(g_in) {} // Convenience typedefs. - using Traits = typename boost::graph_traits<Graph>; - using VertexDescriptor = typename Traits::vertex_descriptor; - using EdgeDescriptor = typename Traits::edge_descriptor; + using Traits = typename boost::graph_traits<Graph>; + using VertexDescriptor = typename Traits::vertex_descriptor; + using EdgeDescriptor = typename Traits::edge_descriptor; - bool operator()(const VertexDescriptor &v) const { + bool operator()(const VertexDescriptor &v) const { assert(g); // Disallow special vertices, as otherwise we will try to remove them // later. - return !is_special(v, *g); - } + return !is_special(v, *g); + } - bool operator()(const EdgeDescriptor &e) const { - assert(g); + bool operator()(const EdgeDescriptor &e) const { + assert(g); // Vertices must have the same reach. - auto u = source(e, *g), v = target(e, *g); + auto u = source(e, *g), v = target(e, *g); const CharReach &cr_u = (*g)[u].char_reach; const CharReach &cr_v = (*g)[v].char_reach; return cr_u == cr_v; @@ -106,8 +106,8 @@ struct ReachFilter { const Graph *g = nullptr; }; -using RepeatGraph = boost::filtered_graph<NGHolder, ReachFilter<NGHolder>, - ReachFilter<NGHolder>>; +using RepeatGraph = boost::filtered_graph<NGHolder, ReachFilter<NGHolder>, + ReachFilter<NGHolder>>; struct ReachSubgraph { vector<NFAVertex> vertices; @@ -301,9 +301,9 @@ void splitSubgraph(const NGHolder &g, const deque<NFAVertex> &verts, unordered_map<NFAVertex, NFAVertex> verts_map; // in g -> in verts_g fillHolder(&verts_g, g, verts, &verts_map); - const auto ug = make_undirected_graph(verts_g); + const auto ug = make_undirected_graph(verts_g); - unordered_map<NFAVertex, u32> repeatMap; + unordered_map<NFAVertex, u32> repeatMap; size_t num = connected_components(ug, make_assoc_property_map(repeatMap)); DEBUG_PRINTF("found %zu connected repeat components\n", num); @@ -312,8 +312,8 @@ void splitSubgraph(const NGHolder &g, const deque<NFAVertex> &verts, vector<ReachSubgraph> rs(num); for (auto v : verts) { - assert(!is_special(v, g)); - auto vu = verts_map.at(v); + assert(!is_special(v, g)); + auto vu = verts_map.at(v); auto rit = repeatMap.find(vu); if (rit == repeatMap.end()) { continue; /* not part of a repeat */ @@ -324,13 +324,13 @@ void splitSubgraph(const NGHolder &g, const deque<NFAVertex> &verts, } for (const auto &rsi : rs) { - if (rsi.vertices.empty()) { - // Empty elements can happen when connected_components finds a - // subgraph consisting entirely of specials (which aren't added to - // ReachSubgraph in the loop above). There's nothing we can do with - // these, so we skip them. - continue; - } + if (rsi.vertices.empty()) { + // Empty elements can happen when connected_components finds a + // subgraph consisting entirely of specials (which aren't added to + // ReachSubgraph in the loop above). There's nothing we can do with + // these, so we skip them. + continue; + } DEBUG_PRINTF("repeat with %zu vertices\n", rsi.vertices.size()); if (rsi.vertices.size() >= minNumVertices) { DEBUG_PRINTF("enqueuing\n"); @@ -1030,16 +1030,16 @@ static void buildReachSubgraphs(const NGHolder &g, vector<ReachSubgraph> &rs, const u32 minNumVertices) { const ReachFilter<NGHolder> fil(&g); - const RepeatGraph rg(g, fil, fil); + const RepeatGraph rg(g, fil, fil); if (!isCompBigEnough(rg, minNumVertices)) { DEBUG_PRINTF("component not big enough, bailing\n"); return; } - const auto ug = make_undirected_graph(rg); + const auto ug = make_undirected_graph(rg); - unordered_map<NFAVertex, u32> repeatMap; + unordered_map<NFAVertex, u32> repeatMap; unsigned int num; num = connected_components(ug, make_assoc_property_map(repeatMap)); @@ -1051,7 +1051,7 @@ void buildReachSubgraphs(const NGHolder &g, vector<ReachSubgraph> &rs, rs.resize(num); for (auto v : topoOrder) { - auto rit = repeatMap.find(v); + auto rit = repeatMap.find(v); if (rit == repeatMap.end()) { continue; /* not part of a repeat */ } |