From a network, I want to plot the probability of two nodes to be connected as a function of their distance to each other.
I have two pandas series, one (distance) is the distance between each pair of node and the other (adjacency) is filled with zeros and ones and tells if the nodes are connected.
My idea was to use cut and value_counts to first compute the number of pairs having a distance inside bins, which works fine:
factor = pandas.cut(distance, 100)
num_bin = pandas.value_counts(factor)
Now if had a vector of the same size of num_bin with the number of connected nodes inside each bins, i would have my probability. but how to compute this vector?
My problem is how to know among, lets says the 3 couple of nodes inside the second bin, how many are connected?
thanks