avg_combined_corr

avg_combined_corr#

graph_tool.correlations.avg_combined_corr(g, deg1, deg2, bins=[0, 1])[source]#

Obtain the single-vertex combined correlation histogram for the given graph.

Parameters:
gGraph

Graph to be used.

deg1string or VertexPropertyMap

first degree type (“in”, “out” or “total”) or vertex property map.

deg2string or VertexPropertyMap

second degree type (“in”, “out” or “total”) or vertex property map.

binslist (optional, default: [0, 1])

Bins to be used for the first degrees. If the list has size 2, it is used as the constant width of an automatically generated bin range, starting from the first value.

Returns:
bin_avgnumpy.ndarray

Array with the deg2 average for the deg1 bins.

bin_devnumpy.ndarray

Array with the standard deviation of the deg2 average for the deg1 bins.

binsnumpy.ndarray

The deg1 bins.

See also

assortativity

assortativity coefficient

scalar_assortativity

scalar assortativity coefficient

corr_hist

vertex-vertex correlation histogram

combined_corr_hist

combined single-vertex correlation histogram

avg_neighbor_corr

average nearest-neighbor correlation

avg_combined_corr

average combined single-vertex correlation

Notes

Parallel implementation.

If enabled during compilation, this algorithm will run in parallel using OpenMP. See the parallel algorithms section for information about how to control several aspects of parallelization.

Examples

>>> def sample_k(max):
...     accept = False
...     while not accept:
...         i = np.random.randint(1,max+1)
...         j = np.random.randint(1,max+1)
...         accept = np.random.random() < (sin(i/pi)*sin(j/pi)+1)/2
...     return i,j
...
>>> g = gt.random_graph(10000, lambda: sample_k(40))
>>> h = gt.avg_combined_corr(g, "in", "out")
>>> clf()
>>> xlabel("In-degree")
Text(...)
>>> ylabel("Out-degree")
Text(...)
>>> errorbar(h[2][:-1], h[0], yerr=h[1], fmt="o")
<...>
>>> savefig("combined_avg_corr.svg")
../_images/combined_avg_corr.svg

Average combined in/out-degree correlation.#