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

Method dfsFast

src/function/gds/output_writer.cpp:87–123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

85}
86
87void 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
125void PathsOutputWriter::dfsSlow(ParentList* firstParent, FactorizedTable& fTable,
126 LimitCounter* counter) {

Callers

nothing calls this directly

Calls 10

getTopFunction · 0.85
getIterMethod · 0.80
getNextPtrMethod · 0.80
getParentListHeadMethod · 0.80
push_backMethod · 0.45
emptyMethod · 0.45
sizeMethod · 0.45
getNodeIDMethod · 0.45
appendMethod · 0.45
pop_backMethod · 0.45

Tested by

no test coverage detected