Ni! Hello Phillip,
Don't think there's a boxed method for this task, but you can easily improve your algorithm, though that is no longer a question for graph-tool.
Two possible ways to improve it:
* you could use the fact that the min() function in Python takes an iterable as argument, and pass it something like the generator below:
# chain must be imported from itertools
for v in g.vertices():
g.vp.year[v] = min( g.ep.year[e] for e in chain(v.out_edges(), v.in_edges()) )
* you could iterate only once over g.edges() and then, update the g.vp.year of source and target for each edge.
I would go with something like this:
# this assumes g.vp.year was initlized to a large value by passing 'val' to new_vertex_property()
for e in g.edges():
for v in (e.source(), e.target()):
if g.vp.year[v] > g.ep.year[e]:
g.vp.year[v] = g.ep.year[e]
Yet again, this has little to do with graph tool, you might prefer to look for advice in general programming.
Cheers,
ale
.~'