mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-11-18 10:10:35 +03:00
Introduce custom adjacency-list based graph
This commit is contained in:
@@ -77,6 +77,26 @@ private:
|
||||
ReportID a_rep;
|
||||
ReportID b_rep;
|
||||
};
|
||||
|
||||
/** Comparison functor used to sort by vertex_index. */
|
||||
template<typename Graph>
|
||||
struct VertexIndexOrdering {
|
||||
explicit VertexIndexOrdering(const Graph &g_in) : g(g_in) {}
|
||||
bool operator()(typename Graph::vertex_descriptor a,
|
||||
typename Graph::vertex_descriptor b) const {
|
||||
assert(a == b || g[a].index != g[b].index);
|
||||
return g[a].index < g[b].index;
|
||||
}
|
||||
private:
|
||||
const Graph &g;
|
||||
};
|
||||
|
||||
template<typename Graph>
|
||||
static
|
||||
VertexIndexOrdering<Graph> make_index_ordering(const Graph &g) {
|
||||
return VertexIndexOrdering<Graph>(g);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static
|
||||
@@ -109,7 +129,7 @@ bool is_equal_i(const NGHolder &a, const NGHolder &b,
|
||||
for (size_t i = 0; i < vert_a.size(); i++) {
|
||||
NFAVertex va = vert_a[i];
|
||||
NFAVertex vb = vert_b[i];
|
||||
DEBUG_PRINTF("vertex %u\n", a[va].index);
|
||||
DEBUG_PRINTF("vertex %zu\n", a[va].index);
|
||||
|
||||
// Vertex index must be the same.
|
||||
if (a[va].index != b[vb].index) {
|
||||
|
||||
Reference in New Issue
Block a user