Skip to content

networkx.generators.directed.scale_free_graph (migrated from Trac #664) #652

Closed

Description

@networkx-trac

Original ticket https://networkx.lanl.gov/trac/ticket/664
Reported 2011-12-12 by a.pilaszkiewicz, assigned to @hagberg.

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.

Activity

  1. networkx-trac commented on Jul 20, 2012

    @networkx-trac
    Author

    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.

  2. networkx-trac commented on Jul 20, 2012

    @networkx-trac
    Author

    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.

  3. networkx-trac commented on Jul 20, 2012

    @networkx-trac
    Author

    Comment in Trac by @hagberg, 2011-12-14

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions