Tiago Peixoto wrote
They are not the same because the direction of the edge is used to determine the source and target. Although the out- and in-degrees are swapped in the reversed graphs, so are the sources and targets.
Thank you for your kind response I realized my mistake by playing with a python function which replicates the results of avg_neighbour_corr for both "in" and "out" neighbors using an integer vertex property for p1 (the equivalent to "source_deg" in the original function). I posted my own response in the forum, but I don't know if it got to the mailing list... problems with posting before subscription confirmation Just in case, here it goes: scuenda wrote
def avg_nn_corr(g, nn_dir, p1, p2): kmax = p1.a.max() dnorm = np.zeros(kmax+1, dtype = float) dsum = np.zeros(kmax+1, dtype = float) dsum2 = np.zeros(kmax+1, dtype = float) if nn_dir == "in": neighbours = lambda v: v.in_neighbours() elif nn_dir == "out": neighbours = lambda v: v.out_neighbours() for v in g.vertices(): k1 = p1[v] k2v = np.array([p2[w] for w in neighbours(v)]) dnorm[k1] += len(k2v) s = k2v.sum() s2 = (k2v**2).sum() dsum[k1] += s dsum2[k1] += s2 pnn = dsum/dnorm snn = np.sqrt((dsum2/dnorm - pnn**2)/(dnorm)) return pnn , snn
-- 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.