MCPcopy Create free account
hub / github.com/LadybugDB/ladybug / edgeCompute

Method edgeCompute

src/function/gds/asp_paths.cpp:22–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20 }
21
22 std::vector<nodeID_t> edgeCompute(nodeID_t boundNodeID, graph::NbrScanState::Chunk& resultChunk,
23 bool fwdEdge) override {
24 std::vector<nodeID_t> activeNodes;
25 resultChunk.forEach([&](auto neighbors, auto propertyVectors, auto i) {
26 auto nbrNodeID = neighbors[i];
27 auto iter = frontierPair->getNextFrontierValue(nbrNodeID.offset);
28 // We should update in 2 cases: 1) if nbrID is being visited
29 // for the first time, i.e., when its value in the pathLengths frontier is
30 // PathLengths::UNVISITED. Or 2) if nbrID has already been visited but in this
31 // iteration, so it's value is curIter + 1.
32 auto shouldUpdate =
33 iter == FRONTIER_UNVISITED || iter == frontierPair->getCurrentIter();
34 if (shouldUpdate) {
35 if (!block->hasSpace()) {
36 block = bfsGraphManager->getCurrentGraph()->addNewBlock();
37 }
38 auto edgeID = propertyVectors[0]->template getValue<nodeID_t>(i);
39 bfsGraphManager->getCurrentGraph()->addParent(frontierPair->getCurrentIter(),
40 boundNodeID, edgeID, nbrNodeID, fwdEdge, block);
41 }
42 if (iter == FRONTIER_UNVISITED) {
43 activeNodes.push_back(nbrNodeID);
44 }
45 });
46 return activeNodes;
47 }
48
49 std::unique_ptr<EdgeCompute> copy() override {
50 return std::make_unique<ASPPathsEdgeCompute>(frontierPair, bfsGraphManager);

Callers

nothing calls this directly

Calls 7

getNextFrontierValueMethod · 0.80
hasSpaceMethod · 0.80
addNewBlockMethod · 0.80
getCurrentGraphMethod · 0.80
addParentMethod · 0.80
forEachMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected