DFS cause stack overflow
<p>I write a simple code about dfs in a data file with 720 thousand vertex pair and find stack overflow. I am not quite sure whether it is caused by large data set or problems of my code. Any ideas is appreciated. Code part is showed below:</p>

<pre><code>private void dfs(Graph G, int v) {
    dfsMarked[v] = true;
    for (Edge e : G.adj(v)) {
        int w = e.other(v);  
        if (!dfsMarked[w]) {
            dfsEdgeTo[w] = v;
            dfs(G, w);
        }
    }
}
</code></pre>