There is a class that reads edges (in the (2, 4) format) and solves the problem of strongly connected components. Everything works fine. But when the edges are not 19, for example, 10,000 a stack overflow occurs due to the DFSR function
void Graph::DFSR(std::vector<std::pair<int, int>> G, int vertex) { m_ReadyTest.push_back(vertex); // V как протестированная // для каждого ребра (s, v) в G for (auto i : G) { if (vertex == i.first) { bool go(false); // если V еще не протестирован for_each(m_ReadyTest.begin(), m_ReadyTest.end(), [=, &go] (int x) { if (x == i.second) go = true; }); if (!go) { // DFSR(G, V) DFSR(G, i.second); } } } ++m_time; auto tmpProcT = make_pair(vertex, m_time); // t = t + 1 m_ProcessingTime.push_back(tmpProcT); // f[V] = t время завершения обработки вершины V } Actually, as I did not try to rewrite the function without recursion (I used the + stack cycle) ... it crashes, it does not correctly count. In general, I need your help.
ps or as an option. Explain in detail how to increase the stack in VisualStudio 15 pss thanks in advance!
Here is my option:
void Graph::DFS(vector<pair<int, int>> G, int vertex) { /*1*/ m_ReadyTest.push_back(vertex); // V как протестированная /*2*/ stack<int> iStack; iStack.push(vertex); // V ложим на вершину стека /*3*/ while (!iStack.empty()) // пока стек НЕ пустой { /*4*/ int iU = iStack.top(); for (auto i : G) // ищим все V для U { if (iU == i.first) // i.second -- V { /*5*/ bool go(false); // если V еще не протестирован for_each(m_ReadyTest.begin(), m_ReadyTest.end(), [=, &go](int x) { if (x == i.second) // V протестирован go = true; }); if (!go) { /*6*/ m_ReadyTest.push_back(i.second); // V как протестировану /*7*/ iStack.push(i.second); // V в голову стеку } } }// вершина обработана... if (!iStack.empty() && iU == iStack.top()) { iStack.pop();// удаляем U из стека ++m_time; auto tmpProcT = make_pair(iU, m_time); // t = t + 1 m_ProcessingTime.push_back(tmpProcT); // f[V] = t время завершения обработки вершины V } } } The results of small tests are the same, the test result for 55k edges: 
I'm afraid that when solving a problem, and there are 5105043 edges (as far as I remember), the result will be very bad. ps Though kill, I do not understand what else is wrong with my DFS function.
int iU = iStack.top();: in any case, you need to remove the top from the stack as you pass it. And for the tested vertices, get betterunordered_set. And local, and then suddenly there will be something from the past run. - VladD