You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
networkx.generators.directed.scale_free_graph (migrated from Trac #664) #652
function scale_free_graph._choose_node is not consistent with Reference [1]:
In paper it is stated:
Pr(v=vi) = (deg_out(vi) + delta_out)/(t+delta_out_n(t)
Pr(v=vi) = (deg_in(vi) + delta_in)/(t+delta_in_n(t)
where:
t --- number of edges at time t
n(t) --- number of vertices at time t
In function
_choose_node as distribution are passed G.out_degree() and G.in_degree()
which are used as distribution argument and psum is calculated:
psum=float(sum(distribution.values()))+float(delta)*len(distribution)
so in reality in _choose_node, psum is calculated with respect to number of outgoing edges or incoming edges, not total number of edges.
I don't understand exactly what the problem is. There are three cases depending on parameters (alpha, beta, gamma). Each case chooses nodes with a different distribution - either from the in-degree or the out-degree. Which cases are wrong?
If you can point to the lines in the code and the part of the paper that describes this that would help.
My initial thought was that the probability of choosing a node was calculated with the wrong number of edges, however obviously:
num_edges = sum(G.in_degree()) = sum(G.out_degree())
My mistake for thinking otherwise. There is no bug here.
Activity
networkx-trac commentedon Jul 20, 2012
Comment in Trac by @hagberg, 2011-12-12
Thanks for the report.
I don't understand exactly what the problem is. There are three cases depending on parameters (alpha, beta, gamma). Each case chooses nodes with a different distribution - either from the in-degree or the out-degree. Which cases are wrong?
If you can point to the lines in the code and the part of the paper that describes this that would help.
networkx-trac commentedon Jul 20, 2012
Comment in Trac by a.pilaszkiewicz, 2011-12-14
Ok sorry, that was a bad bug report.
My initial thought was that the probability of choosing a node was calculated with the wrong number of edges, however obviously:
num_edges = sum(G.in_degree()) = sum(G.out_degree())
My mistake for thinking otherwise. There is no bug here.
networkx-trac commentedon Jul 20, 2012
Comment in Trac by @hagberg, 2011-12-14