On 01/15/2014 12:54 PM, julien.siebert wrote:
> Hi everyone,
>
> I do not think there is a graph_tool method to return the non neigbours of a
> given vertex.
> I am wondering if there is a faster/ more efficient way than calling:
>
> non_neigbours = [g.vertex_index[v] for v in g.vertices() if v not in
> mynode.all_neighbours() and v != mynode]
>
> where g is a graph and mynode is a given vertex.

You are probably better off working with sets:

    vertices = set(g.vertices())
    neighbours = set(mynode.all_neighbours())
    non_neighbours = vertices - neighbours

Best,
Tiago

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

Attachment: signature.asc
Description: OpenPGP digital signature

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

Reply via email to