combined_corr_hist#
- graph_tool.correlations.combined_corr_hist(g, deg1, deg2, bins=[[0, 1], [0, 1]], float_count=True)[source]#
Obtain the single-vertex combined correlation histogram for the given graph.
- Parameters:
- g
Graph
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 of lists (optional, default: [[0, 1], [0, 1]])
A list of bin edges to be used for the first and second degrees. If any list has size 2, it is used to create an automatically generated bin range starting from the first value, and with constant bin width given by the second value.
- float_countbool (optional, default: True)
If True, the bin counts are converted float variables, which is useful for normalization, and other processing. It False, the bin counts will be unsigned integers.
- g
- Returns:
- bin_counts
numpy.ndarray
Two-dimensional array with the bin counts.
- first_bins
numpy.ndarray
First degree bins
- second_bins
numpy.ndarray
Second degree bins
- bin_counts
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.combined_corr_hist(g, "in", "out") >>> clf() >>> xlabel("In-degree") Text(...) >>> ylabel("Out-degree") Text(...) >>> imshow(h[0].T, interpolation="nearest", origin="lower") <...> >>> colorbar() <...> >>> savefig("combined_corr.svg")