| 26 | */ |
| 27 | template <typename Graph> |
| 28 | size_t markAmbiguous(Graph* g) |
| 29 | { |
| 30 | typedef typename Graph::iterator iterator; |
| 31 | |
| 32 | Timer timer(__func__); |
| 33 | size_t progress = 0; |
| 34 | size_t countv = 0, counte = 0; |
| 35 | for (iterator it = g->begin(); it != g->end(); ++it) { |
| 36 | if (it->second.deleted()) |
| 37 | continue; |
| 38 | |
| 39 | if (++progress % 1000000 == 0) |
| 40 | logger(1) << "Splitting: " << progress << '\n'; |
| 41 | |
| 42 | if (!opt::ss && it->first.isPalindrome()) { |
| 43 | countv += 2; |
| 44 | g->mark(it->first); |
| 45 | counte += markNeighbours(g, *it, SENSE); |
| 46 | } else { |
| 47 | for (extDirection sense = SENSE; |
| 48 | sense <= ANTISENSE; ++sense) { |
| 49 | if (it->second.getExtension(sense).isAmbiguous() |
| 50 | || (!opt::ss && it->first.isPalindrome(sense))) { |
| 51 | countv++; |
| 52 | g->mark(it->first, sense); |
| 53 | counte += markNeighbours(g, *it, sense); |
| 54 | } |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | g->pumpNetwork(); |
| 59 | } |
| 60 | tempCounter[5] = countv; |
| 61 | logger(0) << "Marked " << counte << " edges of " << countv |
| 62 | << " ambiguous vertices." << std::endl; |
| 63 | |
| 64 | return countv; |
| 65 | } |
| 66 | |
| 67 | /** Remove the edges of marked and deleted vertices. |
| 68 | * @return the number of branches removed |
no test coverage detected