Introduce custom adjacency-list based graph

This commit is contained in:
Alex Coyte
2016-08-24 16:12:51 +10:00
committed by Matthew Barr
parent 05683655cb
commit e1e9010cac
92 changed files with 3730 additions and 1812 deletions

View File

@@ -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) {