Something wrong with graph-tool documentation.
Its Math Processsing Error , Everywhere! http://graph-tool.skewed.de/static/doc/generation.html Examples This is a degree sampler which uses rejection sampling to sample from the distribution [Math Processing Error], up to a maximum.
def sample_k(max): ... accept = False ... while not accept: ... k = randint(1,max+1) ... accept = random() < 1.0/k ... return k ... The following generates a random undirected graph with degree distribution [Math Processing Error] (with k_max=40) and an *assortative*degree correlation of the form: [Math Processing Error] g = gt.random_graph(1000, lambda: sample_k(40), model="probabilistic", ... vertex_corr=lambda i, k: 1.0 / (1 + abs(i - k)), directed=False, ... n_iter=100) gt.scalar_assortativity(g, "out") (0.6321636468713748, 0.01082292099309249) The following samples an in,out-degree pair from the joint distribution: [Math Processing Error] with [Math Processing Error] and [Math Processing Error].
participants (2)
-
Phyo Arkar Lwin -
Tiago de Paula Peixoto