| vertex_hist (g, deg[, bins, float_count]) | Return the vertex histogram of the given degree type or property. |
| edge_hist (g, eprop[, bins, float_count]) | Return the edge histogram of the given property. |
| vertex_average (g, deg) | Return the average of the given degree or vertex property. |
| edge_average (g, eprop) | Return the average of the given degree or vertex property. |
| label_parallel_edges (g[, eprop]) | Label edges which are parallel, i.e, have the same source and target vertices. For each parallel edge set PE, the labelling starts from 0 to |PE|-1. If the eprop parameter is given (a PropertyMap), the labelling is stored there. |
| remove_parallel_edges (g) | Remove all parallel edges from the graph. Only one edge from each parallel edge set is left. |
| label_self_loops (g[, eprop]) | Label edges which are self-loops, i.e, the source and target vertices are the same. Self-loops are labeled with 1 and others with 0. If the eprop parameter is given (a PropertyMap), the labelling is stored there. |
| remove_self_loops (g) | Remove all self-loops edges from the graph. |
| remove_labeled_edges (g, label) | Remove every edge e such that label[e] != 0. |
| distance_histogram (g[, weight, bins, samples, ...]) | Return the shortest-distance histogram for each vertex pair in the graph. |
Return the vertex histogram of the given degree type or property.
| Parameters: | g : Graph
deg : string or PropertyMap
bins : list of bins
float_count : bool (optional, default: True)
|
|---|---|
| Returns: | counts : ndarray
bins : ndarray
|
See also
Notes
The algorithm runs in O(|V|) time.
If enabled during compilation, this algorithm runs in parallel.
Examples
>>> from numpy.random import poisson, seed
>>> seed(42)
>>> g = gt.random_graph(1000, lambda: (poisson(5), poisson(5)))
>>> print gt.vertex_hist(g, "out")
[array([ 10., 30., 86., 138., 166., 154., 146., 129., 68.,
36., 23., 8., 3., 2., 0., 1.]), array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], dtype=uint64)]
Return the edge histogram of the given property.
| Parameters: | g : Graph
eprop : PropertyMap
bins : list of bins
float_count : bool (optional, default: True)
|
|---|---|
| Returns: | counts : ndarray
bins : ndarray
|
See also
Notes
The algorithm runs in O(|E|) time.
If enabled during compilation, this algorithm runs in parallel.
Examples
>>> from numpy import arange
>>> from numpy.random import random, seed
>>> seed(42)
>>> g = gt.random_graph(1000, lambda: (5, 5))
>>> eprop = g.new_edge_property("double")
>>> eprop.get_array()[:] = random(g.num_edges())
>>> print gt.edge_hist(g, eprop, arange(0, 1, 0.1))
[array([ 525., 504., 502., 502., 468., 499., 531., 471., 520., 478.]), array([ 0. , 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9])]
Return the average of the given degree or vertex property.
| Parameters: | g : Graph
deg : string or PropertyMap
|
|---|---|
| Returns: | average : float
std : float
|
See also
Notes
The algorithm runs in O(|V|) time.
If enabled during compilation, this algorithm runs in parallel.
Examples
>>> from numpy.random import poisson, seed
>>> seed(42)
>>> g = gt.random_graph(1000, lambda: (poisson(5), poisson(5)))
>>> print gt.vertex_average(g, "in")
(5.0919999999999996, 0.071885575743677543)
Return the average of the given degree or vertex property.
| Parameters: | g : Graph
eprop : PropertyMap
|
|---|---|
| Returns: | average : float
std : float
|
See also
Notes
The algorithm runs in O(|E|) time.
If enabled during compilation, this algorithm runs in parallel.
Examples
>>> from numpy import arange
>>> from numpy.random import random, seed
>>> seed(42)
>>> 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.49674035434130187, 0.0040946040690938677)
Return the shortest-distance histogram for each vertex pair in the graph.
| Parameters: | g : Graph
weight : PropertyMap (optional, default: None)
bins : list (optional, default: [1])
samples : int (optional, default: None)
float_count : bool (optional, default: True)
|
|---|---|
| Returns: | counts : ndarray
bins : ndarray
|
See also
Notes
The algorithm runs in O(V^2) time, or O(V^2\log V) if weight != None. If samples is supplied, the complexities are O(\text{samples}\times V) and O(\text{samples}\times V\log V), respectively.
If enabled during compilation, this algorithm runs in parallel.
Examples
>>> from numpy.random import random, seed
>>> seed(42)
>>> g = gt.random_graph(100, lambda: (3, 3))
>>> hist = gt.distance_histogram(g)
>>> print hist
[array([ 0., 300., 857., 2186., 3894., 2511., 152.]), array([0, 1, 2, 3, 4, 5, 6], dtype=uint64)]
>>> hist = gt.distance_histogram(g, samples=10)
>>> print hist
[array([ 0., 30., 88., 222., 384., 251., 15.]), array([0, 1, 2, 3, 4, 5, 6], dtype=uint64)]