How can I find the number of immediate common neighbors between all the nodes in a given graph and represent it as a matrix. i have attached the graph. Please provide some inputs. connectivity11.gz <http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/file/n4026036/connectivity11.gz> -- 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 16.03.2015 02:18, dushyanthbn wrote:
How can I find the number of immediate common neighbors between all the nodes in a given graph and represent it as a matrix. i have attached the graph. Please provide some inputs. connectivity11.gz <http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/file/n4026036/connectivity11.gz>
m = zeros((g.num_vertices(), g.num_vertices())) for v in g.vertices(): nv = set(v.all_neighbours()) for w in g.vertices(): nw = set(w.all_neighbours()) m[v, w] = len(nv.intersection(nw)) -- Tiago de Paula Peixoto <tiago@skewed.de>
participants (2)
-
dushyanthbn -
Tiago de Paula Peixoto