{"id":15761302,"url":"https://github.com/benmaier/smallworld","last_synced_at":"2025-04-21T03:32:09.683Z","repository":{"id":66124054,"uuid":"158420887","full_name":"benmaier/smallworld","owner":"benmaier","description":"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.","archived":false,"fork":false,"pushed_at":"2021-07-12T15:09:28.000Z","size":480,"stargazers_count":18,"open_issues_count":0,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-11T11:07:07.112Z","etag":null,"topics":["networks","networkx","networkx-drawing-utilities","small-world-networks"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/benmaier.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-11-20T16:38:30.000Z","updated_at":"2023-11-16T01:55:05.000Z","dependencies_parsed_at":null,"dependency_job_id":"2fcad0b8-02a5-4689-b638-5fcc28f257e2","html_url":"https://github.com/benmaier/smallworld","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benmaier%2Fsmallworld","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benmaier%2Fsmallworld/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benmaier%2Fsmallworld/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benmaier%2Fsmallworld/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/benmaier","download_url":"https://codeload.github.com/benmaier/smallworld/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249991089,"owners_count":21357199,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["networks","networkx","networkx-drawing-utilities","small-world-networks"],"created_at":"2024-10-04T11:02:12.210Z","updated_at":"2025-04-21T03:32:09.350Z","avatar_url":"https://github.com/benmaier.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# smallworld\n\nGenerate and analyze small-world networks according to the revised Watts-Strogatz model where the randomization\nat _β_ = 1 is truly equal to the Erdős-Rényi network model.\n\nIn the Watts-Strogatz model each node rewires its _k_/2 rightmost edges with probality _β_. This means each node has halways minimum degree _k_/2. Also, at _β_ = 1, each edge has been rewired. Hence the probability of it existing is \u003c_k_/(_N_-1), contrary to the ER model.\n\nIn 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) \u003c= _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`.\n\n## Install\n\n    pip install smallworld\n\nBeware: `smallworld` only works with Python 3!\n\n## Example\n\nIn the following example you can see how to generate and draw according to the model described above.\n\n```python\nfrom smallworld.draw import draw_network\nfrom smallworld import get_smallworld_graph\n\nimport matplotlib.pyplot as pl\n\n# define network parameters\nN = 21\nk_over_2 = 2\nbetas = [0, 0.025, 1.0]\nlabels = [ r'$\\beta=0$', r'$\\beta=0.025$', r'$\\beta=1$']\n\nfocal_node = 0\n\nfig, ax = pl.subplots(1,3,figsize=(9,3))\n\n\n# scan beta values\nfor ib, beta in enumerate(betas):\n\n    # generate small-world graphs and draw\n    G = get_smallworld_graph(N, k_over_2, beta)\n    draw_network(G,k_over_2,focal_node=focal_node,ax=ax[ib])\n\n    ax[ib].set_title(labels[ib],fontsize=11)\n\n# show\npl.subplots_adjust(wspace=0.3)\npl.show()\n```\n\n![visualization example](https://github.com/benmaier/smallworld/raw/master/sandbox/small_worlds.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenmaier%2Fsmallworld","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbenmaier%2Fsmallworld","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenmaier%2Fsmallworld/lists"}