My question is about infecting an entire graph with the smallest set of vertices that will be deemed as infected. The question goes something like this. For a vertex A in a (not necessarily simple) directed graph, A will become infected if for all in-edges of the form (A, B) (it's a directed graph so A will be pointing towards B) B is also infected. If we were to take a specific example:
In this case, if the vertices E, A were infected:
Iteration 1:
vertices F, D are infected because of the fact that the only vertex that points to them is E and E is infected.
Iteration 2:
The vertex B is infected as both vertices A and D are infected.
Iteration 3:
Finally the vertex C is infected as a result of the infection of vertex B from Iteration 2.
In this case, the infected set {E, A} that I chose was able to infect the entire graph. Obviously, this isn't always possible as in the case with the infected set of {B} (the vertex A doesn't end up infected as B doesn't point to it and thus there is no way of reaching it) or the infected set of {A} (the vertex B is not infected as it has a perfectly healthy parent in D).
I really want to find an algorithm that finds the smallest set of infected vertices that will end up infecting the entire graph after an arbitrary number of iterations. Does something like this already exist?
Just for clarification, for vertices that are a self-loop, it would necessarily have to be in the infected set as that's the only way that it can get infected.
btilly gave a response about how the problem is NP-hard. Could someone suggest a good approximation algorithm then? It doesn't need to be too too efficient. After all I only need to run it once albeit on a large graph. It has around 750,000 nodes and around 10 edges for each of them.
