Hi gogurt, It seems you can keep the state of vertices in a boolean property map and queue the vertices whose neighbors you gotta visit in a python list. []s ale On Thu, Aug 20, 2015 at 3:40 PM, gogurt <gogurt@gmail.com> wrote:
Hi all,
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 infected forever.
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 infection.
*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?
-- View this message in context: http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/... Sent from the Main discussion list for the graph-tool project mailing list archive at Nabble.com. _______________________________________________ graph-tool mailing list graph-tool@skewed.de http://lists.skewed.de/mailman/listinfo/graph-tool