On 04/26/2014 08:35 PM, Jimmy Jin wrote: > However... this seems kind of like overkill. I was thinking another > way to do this is to generate only one graph, but give each node and > edge an "age" attribute (as in the example in the tutorial). Then you > could get the time-k subgraph by selecting only nodes and edges that > have age less than k. > > Is there an obvious way to implement this in graph-tool? Specifically, > for each time-k subgraph I'd want to be able to access the degree > distribution at that time, and also the usual properties of the graph > such as neighbors of a given node, etc.
Yes, the "age" is simply the index of the node/edge, since they are
added sequentially. The first vertex added has index 0, the second has
index 1, and so on. To extract the graph at a given age you just
construct a GraphView, i.e.
u = GraphView(g, vfilt=lambda v: int(v) < 1000)
will give you the graph at time step 1000.
Best,
Tiago
--
Tiago de Paula Peixoto <[email protected]>
signature.asc
Description: OpenPGP digital signature
_______________________________________________ graph-tool mailing list [email protected] http://lists.skewed.de/mailman/listinfo/graph-tool
