I am trying to find the set of all vertices for which there is a path from a specific vertex $v_0$ in a directed graph. I am given the set of vertices $V$ in the beginning. I am given the edges of a graph via a stream of edges - so one directed edge $(u, v)$ at a time.
Of course, I could do a breadth or depth first traversal after I get all the edges to see which vertices I can reach from $v_0$. However, can I be determining which vertices I can visit from vertex $v_0$ while I'm reading in the edges? For instance, what if I'd like to know at any moment which vertices I can reach from $v_0$?
As you might posit, I am trying to highly optimize a program.
I tried to maintain a set of vertices that each vertex in the graph could visit, but then had trouble efficiently finding the union of these sets to get the set for $v_0$.