| 85 | } |
| 86 | |
| 87 | void PathsOutputWriter::dfsFast(ParentList* firstParent, FactorizedTable& fTable, |
| 88 | LimitCounter* counter) { |
| 89 | std::vector<ParentList*> curPath; |
| 90 | curPath.push_back(firstParent); |
| 91 | auto backtracking = false; |
| 92 | while (!curPath.empty()) { |
| 93 | if (context->interrupted()) { |
| 94 | throw InterruptException{}; |
| 95 | } |
| 96 | auto top = curPath[curPath.size() - 1]; |
| 97 | auto topNodeID = top->getNodeID(); |
| 98 | if (top->getIter() == 1) { |
| 99 | writePath(curPath); |
| 100 | fTable.append(vectors); |
| 101 | if (updateCounterAndTerminate(counter)) { |
| 102 | return; |
| 103 | } |
| 104 | backtracking = true; |
| 105 | } |
| 106 | if (backtracking) { |
| 107 | auto next = getTop(curPath)->getNextPtr(); |
| 108 | if (isNextViable(next, curPath)) { |
| 109 | curPath[curPath.size() - 1] = next; |
| 110 | backtracking = false; |
| 111 | } else { |
| 112 | curPath.pop_back(); |
| 113 | } |
| 114 | } else { |
| 115 | auto parent = bfsGraph.getParentListHead(topNodeID); |
| 116 | while (parent->getIter() != top->getIter() - 1) { |
| 117 | parent = parent->getNextPtr(); |
| 118 | } |
| 119 | curPath.push_back(parent); |
| 120 | backtracking = false; |
| 121 | } |
| 122 | } |
| 123 | } |
| 124 | |
| 125 | void PathsOutputWriter::dfsSlow(ParentList* firstParent, FactorizedTable& fTable, |
| 126 | LimitCounter* counter) { |
nothing calls this directly
no test coverage detected