Skip to main content
smallworld
==========

| Generate and analyze small-world networks according to the revised
Watts-Strogatz model where the randomization
| at *β* = 1 is truly equal to the Erdős-Rényi network model.

The Watts-Strogatz model each node is asked to rewire its *k*/2
rightmost edges with probality *β*. This means thaeach node has halways
minimum degree *k*/2. Also, at *β* = 1, each edge has been rewired.
Hence the probability of it existing is 0, contrary to the ER model.

In the adjusted model, each pair of nodes is connected with a certain
connection probability. If the lattice distance between the potentially
connected nodes is d(i,j) <= *k*/2 then they are connected with
short-range probability ``p_S = k / (k + β (N-1-k))``, otherwise they're
connected with long-range probability ``p_L = β * p_S``.

Install
-------

::

pip install smallworld

Beware: ``smallworld`` only works with Python 3!

Example
-------

In the following example you can see how to generate and draw according
to the model described above.

.. code:: python

from smallworld.draw import draw_network
from smallworld import get_smallworld_graph

import matplotlib.pyplot as pl

# define network parameters
N = 21
k_over_2 = 2
betas = [0, 0.025, 1.0]
labels = [ r'$\beta=0$', r'$\beta=0.025$', r'$\beta=1$']

focal_node = 0

fig, ax = pl.subplots(1,3,figsize=(9,3))


# scan beta values
for ib, beta in enumerate(betas):

# generate small-world graphs and draw
G = get_smallworld_graph(N, k_over_2, beta)
draw_network(G,k_over_2,focal_node=focal_node,ax=ax[ib])

ax[ib].set_title(labels[ib],fontsize=11)

# show
pl.subplots_adjust(wspace=0.3)
pl.show()

|visualization example|

.. |visualization example| image:: https://github.com/benmaier/smallworld/raw/master/sandbox/small_worlds.png

Metadata

Release files for smallworld 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for smallworld 0.0.1
File Size Uploaded Provenance Actions
smallworld-0.0.1.tar.gz 7.6 kB Without provenance Details for smallworld-0.0.1.tar.gz

Release files / smallworld-0.0.1.tar.gz

Download URL smallworld-0.0.1.tar.gz
Size 7.6 kB
Tags Source
SHA-256 checksum
How to use checksums
7059509d4145dbf605a97edc85780f762e894c2dd74a2f5849a35f33c1775198
BLAKE2b-256 checksum
How to use checksums
0947a41fdaed2973af7477178716417daa7f41c857c1b7eff68cf365f2db37bb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1

Security for smallworld 0.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page