vertex_average#
- graph_tool.stats.vertex_average(g, deg)[source]#
Return the average of the given degree or vertex 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.
- g
- Returns:
- averagefloat
The average of the given degree or property.
- stdfloat
The standard deviation of the average.
See also
vertex_hist
Vertex histograms.
edge_hist
Edge histograms.
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_average(g, "in")) (5.028, 0.071240...)