So I've scoured the documentation for this but I've been indoctrinated in
the ways of NetworkX, so I'm pretty confused.
I want to implement a simple discrete-time epidemic process on a network.
For example, starting out with one infected vertex, I want to explore all
its out-neighbors and infect those with probability p, and then the
neighbors of those out-neighbors, etc. Once you're infected, you are
The way I've done this in NetworkX is to essentially keep track of 3 lists
of nodes (infected, active, unexplored) and update them in a simple loop.
Then at the end of the process when the epidemic dies or hits a threshold, I
just subset the graph and get the subgraph which represents the path of the
*My question is: *what's the most efficient way to do this using graph-tool?
At first I thought the same approach (subsetting vertices, which would mean
working with vertex iterables) would be the fastest way, but then I thought
maybe working on the original graph with a vertex PropertyMap would be
better. But my intuition is extremely poor on this (e.g. is it even possible
to subset vertices in a graph based on their values in a PropertyMap
object?). Any pointers?