Graph-tool is a great and ultra-fast library. It saved me tons of hours
doing some statistics with heavy graphs. Thank you so much for your great
work. However, right now I'm having some troubles with the function
avg_neighbour_corr. I must missing something, but I don't know what it is.

Imagine we consider a directed graph g, and its reverse graph h. Then, if we
calculate
goo = avg_neighbour_corr(g, "out", "out")
hii = avg_neighbour_corr(h, "in", "in")
I guessed both results should be the same, but they are not. It must be
related to the results of the function corr_hist, which returns the
transposed matrix of g for h. However, I fail to see why, considering that
the in-degree vertex property of h is the same as the out-degree vertex
property of g, and all edges are reversed in h.

Any help, please? Thanks in advance.

Best,
Sara.

PS: Here is the code of a dummy example for a network g given by:
(2) <==> (0) ----> (1) ----> (2)
#### code
g = gt.Graph()
g.add_edge_list([(0,1), (0,2), (1,2), (2,0)])
h = gt.GraphView(g, reversed = True)
goo = avg_neighbour_corr(g, "out", "out")
hii = avg_neighbour_corr(h, "in", "in")
#### end of code
#### results
# >>> goo[0]
# array([ nan, 1.5, 1. ])
# >>> hii[0]
# array([ nan, 1.66666667, 1. ])

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.

For example, if we have an edge:

(a) -> (b)

and the in,out-degrees of a and b are (0, 3) and (4, 1),
respectively. This edge will count the value "4" in the average for
sources with out-degree 0. Once we transpose the graph we have

(a) <- (b)

with in,out-degrees (3, 0), (1, 4). This edge now will contribute the
value "3" in the average for sources with in-degree 1. It is not quite
the same as before.

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