Commit b93fa303 authored by Tiago Peixoto's avatar Tiago Peixoto

Update doctests

parent 581ba9fe
Pipeline #371 passed with stage
in 171 minutes and 44 seconds
......@@ -1828,9 +1828,9 @@ class Graph(object):
--------
>>> g = gt.random_graph(6, lambda: 1, directed=False)
>>> g.get_edges()
array([[0, 4, 0],
[2, 1, 2],
[5, 3, 1]], dtype=uint64)
array([[2, 1, 2],
[3, 4, 0],
[5, 0, 1]], dtype=uint64)
"""
edges = libcore.get_edge_list(self.__graph)
E = edges.shape[0] // 3
......
......@@ -121,7 +121,7 @@ def local_clustering(g, prop=None, undirected=True):
>>> g = gt.random_graph(1000, lambda: (5,5))
>>> clust = gt.local_clustering(g)
>>> print(gt.vertex_average(g, clust))
(0.006177777777777778, 0.00036966184079941211)
(0.008177777777777779, 0.00042080229075093...)
References
----------
......@@ -182,7 +182,7 @@ def global_clustering(g):
>>> g = gt.random_graph(1000, lambda: (5,5))
>>> print(gt.global_clustering(g))
(0.006177777777777778, 0.0003700318726720...)
(0.008177777777777779, 0.0004212235142651...)
References
----------
......@@ -263,11 +263,11 @@ def extended_clustering(g, props=None, max_depth=3, undirected=False):
>>> for i in range(0, 5):
... print(gt.vertex_average(g, clusts[i]))
...
(0.00421, 0.00041685103920811...)
(0.027226666666666666, 0.00100735228307788...)
(0.11549166666666667, 0.00208139908541773...)
(0.4128066666666666, 0.00294792212319872...)
(0.4205716666666667, 0.00315646574114149...)
(0.0050483333333333335, 0.0004393940240073...)
(0.024593787878787878, 0.0009963004021144...)
(0.11238924242424242, 0.001909615401971...)
(0.40252272727272725, 0.003113987400030...)
(0.43629378787878786, 0.003144159256565...)
References
----------
......@@ -349,10 +349,9 @@ def motifs(g, k, p=1.0, motif_list=None, return_maps=False):
>>> g = gt.random_graph(1000, lambda: (5,5))
>>> motifs, counts = gt.motifs(gt.GraphView(g, directed=False), 4)
>>> print(len(motifs))
13
18
>>> print(counts)
[115408, 388542, 1031, 1182, 2662, 2138, 833, 28, 16, 5, 5, 3, 4]
[115557, 390005, 627, 700, 1681, 2815, 820, 12, 27, 44, 15, 7, 12, 4, 6, 1, 2, 1]
References
----------
......@@ -523,7 +522,7 @@ def motif_significance(g, k, n_shuffles=100, p=1.0, motif_list=None,
>>> print(len(motifs))
11
>>> print(zscores)
[0.04162670293683441, 0.046769781223679897, 0.55888261369689918, 0.82906624302416043, -0.41384527710386287, -0.42070845824900477, -1.3262411347517733, 1.82, -0.13, -0.37, -0.22]
[0.22728646681107012, 0.21409572051644973, 0.0070220407889021114, 0.58721419671233477, -0.37770179603294357, -0.34847335047837341, 0.88618118013255021, -0.08, -0.2, -0.38, -0.2]
"""
s_ms, counts = motifs(g, k, p, motif_list)
......
......@@ -231,7 +231,7 @@ def vertex_average(g, deg):
>>> from numpy.random import poisson
>>> g = gt.random_graph(1000, lambda: (poisson(5), poisson(5)))
>>> print(gt.vertex_average(g, "in"))
(4.975, 0.068675869124460318)
(4.96, 0.067988234276233406)
"""
if isinstance(deg, PropertyMap) and "string" in deg.value_type():
......@@ -293,7 +293,7 @@ def edge_average(g, eprop):
>>> eprop = g.new_edge_property("double")
>>> eprop.get_array()[:] = random(g.num_edges())
>>> print(gt.edge_average(g, eprop))
(0.4989741369720412, 0.004101065927783254)
(0.49888156584192045, 0.0040967399234187541)
"""
if "string" in eprop.value_type():
......@@ -426,10 +426,10 @@ def distance_histogram(g, weight=None, bins=[0, 1], samples=None,
>>> g = gt.random_graph(100, lambda: (3, 3))
>>> hist = gt.distance_histogram(g)
>>> print(hist)
[array([ 0., 300., 865., 2214., 3857., 2480., 184.]), array([0, 1, 2, 3, 4, 5, 6, 7], dtype=uint...)]
[array([ 0., 300., 880., 2269., 3974., 2358., 119.]), array([0, 1, 2, 3, 4, 5, 6, 7], dtype=uint64)]
>>> hist = gt.distance_histogram(g, samples=10)
>>> print(hist)
[array([ 0., 30., 88., 226., 391., 240., 15.]), array([0, 1, 2, 3, 4, 5, 6, 7], dtype=uint...)]
[array([ 0., 30., 87., 223., 394., 239., 17.]), array([0, 1, 2, 3, 4, 5, 6, 7], dtype=uint64)]
"""
if samples is not None:
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment