0

I'm working on yet another graph problem. This time, we have to sort it topologically, using a DFS Based algorithm. I've been able to write most of it down, but there is one for loop that confuses me. Our instructor did not make it very clear as to how it should loop though. As of now I have:

```
private static void dfsOut(Graph<City> g, int i, boolean seen[], int linearOrder[], int count)
{
int w = 0;
City cTo;
City cFrom = g.retrieveVertex(new City(i));
seen[i] = true;
for(w ) { \\This is where I'm stuck
if( seen[w] == false)
dfsOut(g, w, seen, linearOrder, count);
}
linearOrder[count] = i;
count--;
}
```

The city variable is the vertex. Not sure I need the city variable, but at least that lets you see how I declared it :lol: This method is called from the actual Topological sort method. He did give me a line that says

For each vertex w such that there is another vertex v and there is an edge

between the two vertices.

Any help would be much appreciated ;)