Search code examples
pythonnetwork-programmingnetworkx

How to create a directed scale free network in python with special average degree?


I found this function in networkX:

scale_free_graph(n, alpha=0.41, beta=0.54, gamma=0.05, 
                delta_in=0.2, delta_out=0, 
                create_using=None, seed=None) 

but I don't understand how can I able to change these parameter to have a directed scale free graph by special mean degree (for example: mean degree = 4)


Solution

  • The probability of adding a node and an edge is Alpha + Gamma. The probability of adding just an edge is Beta. Therefore, if you'd like to get an average degree of N, the ratio between beta and (alpha + gamma) should be N-1. In other words:

    beta / (alpha+gamma) == degree - 1
    

    For gamma of 0.05, and an average degree of 4, use the following values:

    • Beta: .75
    • Gamma: 0.05
    • Alpha: 1-Beta-Gamma

    Here's a chart that shows the mean degree for gamma = 0.05 and different values of beta.

    enter image description here