vertex_hist#
- graph_tool.stats.vertex_hist(g, deg, bins=[0, 1], float_count=True)[source]#
Return the vertex histogram of the given degree type or property.
- Parameters:
- g
Graph
Graph to be used.
- degstring or
VertexPropertyMap
Degree or property to be used for the histogram. It can be either “in”, “out” or “total”, for in-, out-, or total degree of the vertices. It can also be a vertex property map.
- binslist of bins (optional, default: [0, 1])
List of bins to be used for the histogram. The values given represent the edges of the bins (i.e. lower and upper bounds). If the list contains two values, this will be used to automatically create an appropriate bin range, with a constant width given by the second value, and starting from the first value.
- float_countbool (optional, default: True)
If True, the counts in each histogram bin will be returned as floats. If False, they will be returned as integers.
- g
- Returns:
- counts
numpy.ndarray
The bin counts.
- bins
numpy.ndarray
The bin edges.
- counts
See also
edge_hist
Edge histograms.
vertex_average
Average of vertex properties, degrees.
edge_average
Average of edge properties.
distance_histogram
Shortest-distance histogram.
Notes
The algorithm runs in \(O(|V|)\) time.
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
>>> from numpy.random import poisson >>> g = gt.random_graph(1000, lambda: (poisson(5), poisson(5))) >>> print(gt.vertex_hist(g, "out")) [array([ 11., 28., 88., 141., 169., 165., 151., 111., 60., 42., 20., 10., 3., 1.]), array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], dtype=uint64)]