edge_average

Contents

edge_average#

graph_tool.stats.edge_average(g, eprop)[source]#

Return the average of the given degree or vertex property.

Parameters:
gGraph

Graph to be used.

epropEdgePropertyMap

Edge property to be used for the histogram.

Returns:
averagefloat

The average of the given property.

stdfloat

The standard deviation of the average.

See also

vertex_hist

Vertex histograms.

edge_hist

Edge histograms.

vertex_average

Average of vertex degree, properties.

distance_histogram

Shortest-distance histogram.

Notes

The algorithm runs in \(O(|E|)\) 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 import arange
>>> from numpy.random import random
>>> g = gt.random_graph(1000, lambda: (5, 5))
>>> eprop = g.new_edge_property("double")
>>> eprop.get_array()[:] = random(g.num_edges())
>>> print(gt.edge_average(g, eprop))
(0.49683199099042286, 0.004095628750806015)