| 39 | } |
| 40 | |
| 41 | void FrontierTask::run() { |
| 42 | FrontierMorsel morsel; |
| 43 | auto numActiveNodes = 0u; |
| 44 | auto graph = info.graph; |
| 45 | auto scanState = graph->prepareRelScan(*info.relGroupEntry, info.getRelTableID(), |
| 46 | info.getNbrTableID(), info.propertiesToScan); |
| 47 | auto ec = info.edgeCompute.copy(); |
| 48 | auto boundTableID = info.getBoundTableID(); |
| 49 | switch (info.direction) { |
| 50 | case ExtendDirection::FWD: { |
| 51 | while (sharedState->morselDispatcher.getNextRangeMorsel(morsel)) { |
| 52 | for (auto offset = morsel.getBeginOffset(); offset < morsel.getEndOffset(); ++offset) { |
| 53 | if (!sharedState->frontierPair.isActiveOnCurrentFrontier(offset)) { |
| 54 | continue; |
| 55 | } |
| 56 | nodeID_t nodeID = {offset, boundTableID}; |
| 57 | for (auto chunk : graph->scanFwd(nodeID, *scanState)) { |
| 58 | auto activeNodes = ec->edgeCompute(nodeID, chunk, true); |
| 59 | sharedState->frontierPair.addNodesToNextFrontier(activeNodes); |
| 60 | numActiveNodes += activeNodes.size(); |
| 61 | } |
| 62 | } |
| 63 | } |
| 64 | } break; |
| 65 | case ExtendDirection::BWD: { |
| 66 | while (sharedState->morselDispatcher.getNextRangeMorsel(morsel)) { |
| 67 | for (auto offset = morsel.getBeginOffset(); offset < morsel.getEndOffset(); ++offset) { |
| 68 | if (!sharedState->frontierPair.isActiveOnCurrentFrontier(offset)) { |
| 69 | continue; |
| 70 | } |
| 71 | nodeID_t nodeID = {offset, boundTableID}; |
| 72 | for (auto chunk : graph->scanBwd(nodeID, *scanState)) { |
| 73 | auto activeNodes = ec->edgeCompute(nodeID, chunk, false); |
| 74 | sharedState->frontierPair.addNodesToNextFrontier(activeNodes); |
| 75 | numActiveNodes += activeNodes.size(); |
| 76 | } |
| 77 | } |
| 78 | } |
| 79 | } break; |
| 80 | default: |
| 81 | UNREACHABLE_CODE; |
| 82 | } |
| 83 | if (numActiveNodes) { |
| 84 | sharedState->frontierPair.setActiveNodesForNextIter(); |
| 85 | } |
| 86 | } |
| 87 | |
| 88 | void FrontierTask::runSparse() { |
| 89 | auto numActiveNodes = 0u; |
no test coverage detected