List of non-neighbours

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.

Sincerely yours,


You are probably better off working with sets:

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