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, Julien -- View this message in context: http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/... Sent from the Main discussion list for the graph-tool project mailing list archive at Nabble.com.
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 <tiago@skewed.de>
participants (2)
-
julien.siebert -
Tiago de Paula Peixoto