On 18.01.2018 04:35, Spencer Gardner wrote:
> Is there a way to efficiently return multiple specific vertices? I'm looking
> for something between graph.vertex(i) and graph.vertices() in which I can
> pass multiple vertex indices and return the corresponding vertex object.
> Something like:
>     
>     graph.vertices([i,j,...])
> 
> Ultimately, these would be needed to pull out the corresponding values from
> a PropertyMap on the vertices, so if there's an efficient way to do it that
> I'm not thinking of I'd love to hear ideas.

Probably the simplest thing you can do is access the property map directly
using its array interface:

    idx = numpy.array([13, 43, 22])  # vertices
    prop.a[idx]                      # corresponding property values

Best,
Tiago

-- 
Tiago de Paula Peixoto <[email protected]>

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
graph-tool mailing list
[email protected]
https://lists.skewed.de/mailman/listinfo/graph-tool

Reply via email to