static void test_walk(GraphWalker *gwlk, RepeatWalker *rptwlk, dBNode node0, dBNodeBuffer *nbuf, const dBGraph *graph, size_t expnkmers, const char *ans) { db_node_buf_reset(nbuf); graph_walker_init(gwlk, graph, 0, 0, node0); do { db_node_buf_add(nbuf, gwlk->node); } while(graph_walker_next(gwlk) && rpt_walker_attempt_traverse(rptwlk, gwlk)); // db_nodes_print(nbuf->data, nbuf->len, graph, stdout); // printf("\n"); // printf("%s\n", graph_step_str[gwlk->last_step.status]); TASSERT2(nbuf->len == expnkmers, "%zu / %zu", nbuf->len, expnkmers); char tmp[nbuf->len+MAX_KMER_SIZE]; db_nodes_to_str(nbuf->data, nbuf->len, graph, tmp); TASSERT2(strcmp(tmp,ans) == 0, "%s vs %s", tmp, ans); graph_walker_finish(gwlk); rpt_walker_fast_clear(rptwlk, nbuf->data, nbuf->len); }
void graph_crawler_reset_rpt_walker(RepeatWalker *rptwlk, const GraphCache *cache, uint32_t pathid) { rpt_walker_fast_clear(rptwlk, NULL, 0); const GCachePath *path = graph_cache_path(cache, pathid); const GCacheStep *step = graph_cache_step(cache, path->first_step), *endstep; const GCacheSnode *snode; const dBNode *node0, *node1; // Loop over supernodes in the path for(endstep = step + path->num_steps; step < endstep; step++) { // We don't care about orientation here snode = graph_cache_snode(cache, step->supernode); node0 = graph_cache_first_node(cache, snode); node1 = graph_cache_last_node(cache, snode); rpt_walker_fast_clear_single_node(rptwlk, *node0); rpt_walker_fast_clear_single_node(rptwlk, *node1); } }
static inline void reset(GraphWalker *wlk, RepeatWalker *rptwlk, const dBNodeBuffer *nbuf) { graph_walker_finish(wlk); rpt_walker_fast_clear(rptwlk, nbuf->b, nbuf->len); }