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

Method addSingleParent

src/function/gds/bfs_graph.cpp:76–87  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

74}
75
76void DenseBFSGraph::addSingleParent(uint16_t iter, nodeID_t boundNodeID, relID_t edgeID,
77 nodeID_t nbrNodeID, bool fwdEdge, ObjectBlock<ParentList>* block) {
78 auto parent = reserveParent(boundNodeID, edgeID, fwdEdge, block);
79 parent->setIter(iter);
80 ParentList* expected = nullptr;
81 if (curData[nbrNodeID.offset].compare_exchange_strong(expected, parent)) {
82 parent->setNextPtr(expected);
83 } else {
84 // Other thread has added the parent. Do NOT add parent and revert reserved slot.
85 block->revertLast();
86 }
87}
88
89static double getCost(ParentList* parentList) {
90 return parentList == nullptr ? std::numeric_limits<double>::max() : parentList->getCost();

Callers 1

edgeComputeMethod · 0.80

Calls 6

reserveParentFunction · 0.85
setIterMethod · 0.80
setNextPtrMethod · 0.80
revertLastMethod · 0.80
containsMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected