I want to generate spatial scale-free networks for my project. Are there any python libraries that enable it?

I read about the BA model (https://www.science.org/doi/pdf/10.1126/science.286.5439.509) which seems like the pioneer of scale-free networks but I am not sure it takes the spatial aspect into the account.

Can anyone explain:

  1. What is the difference between a spatial and non-spatial scale-free network?
  2. Python libraries to generate a spatial scale-free network.

1 Answer 1


In each iteration, with probability $p$ you create an edge, and otherwise a new vertex.

When creating edges, you consider the degree of the two vertices, and scale by $1/f(\text{dist}(v,u))$, where dist is typically the Euclidean distance.

When adding a new vertex, you put it randomly in $n$-dimensional space and connect it to some predefined number of vertices, subject to degree and scaled down similarly as above.

  • $\begingroup$ Reference: Modeling the Internet’s large-scale topology Yook*, Jeong*†, Baraba´ si*‡ $\endgroup$
    – Pål GD
    Dec 5, 2022 at 19:58
  • $\begingroup$ Thanks! Are you aware of any python libraries or github implementation that allows you do it? $\endgroup$ Dec 7, 2022 at 14:17
  • $\begingroup$ You can use networkx. You have to do some work yourself, but it's enough to get you started. $\endgroup$
    – Pål GD
    Dec 7, 2022 at 18:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.