Lines Matching refs:state
186 Path DfsBuildCycleInfo(DfsStack &dfsStack, DfsState state)
189 VIdx originIdx = state.childIdx;
190 result.vertices.push_back(v_[state.childIdx].data);
191 result.vertices.push_back(v_[state.currentIdx].data);
192 result.edges.push_back(e_[state.currentIdx][state.childIdx]);
193 VIdx prevIdx = state.currentIdx;
207 DfsAction DfsVisitChildren(DfsStack &dfsStack, DfsState &state)
209 for (; state.childIdx < NumVertices(); ++state.childIdx) {
210 if (HasEdge(state.currentIdx, state.childIdx)) {
212 if (VertexColor(state.childIdx) == Graph::VColor::BLACK) {
216 if (VertexColor(state.childIdx) == Graph::VColor::GREY) {
221 VIdx nextChild = state.childIdx + 1 < NumVertices() ? state.childIdx + 1 : Graph::INVALID_V_IDX;
222 dfsStack.push(DfsState {state.currentIdx, nextChild});
223 state.currentIdx = state.childIdx;
224 state.childIdx = 0;
228 state.childIdx = Graph::INVALID_V_IDX;
232 bool DfsPopState(DfsStack &dfsStack, DfsState &state)
235 state = dfsStack.top();
237 if (state.childIdx != Graph::INVALID_V_IDX) {
240 Mark(state.currentIdx, Graph::VColor::BLACK);
248 DfsState state {seedVertexIdx, 0};
252 Mark(state.currentIdx, Graph::VColor::GREY);
253 DfsAction a = DfsVisitChildren(dfsStack, state);
256 return DfsBuildCycleInfo(dfsStack, state);
263 Mark(state.currentIdx, Graph::VColor::BLACK);
264 areUnprocessedVerticesLeft = DfsPopState(dfsStack, state);