{
"info": {
"author": "Michael Zietz",
"author_email": "michael.zietz@gmail.com",
"bugtrack_url": null,
"classifiers": [],
"description": "# XSwap: Fast degree-preserving network permutation\n\n\n\n
\n\nXSwap is an algorithm for degree-preserving network randomization (permutation) [1].\nPermuted networks can be used for a number of purposes in network analysis, including for generating counterfactual distributions of features when only the network's degree sequence is maintained or for computing a prior probability of an edge given only the network's degree sequence.\nOverall, permuted networks allow one to quantify the effects of degree on analysis and prediction methods.\nUnderstanding this effect is useful when a network's degree sequence is subject to biases.\nThis implementation is a modified version of the algorithm due to Hanhij\u00e4rvi et al. with two additional parameters (`allow_self_loops` and `allow_antiparallel`), which enable greater generalizability to bipartite, directed, and undirected networks.\n\n1. **Randomization Techniques for Graphs**\nSami Hanhij\u00e4rvi, Gemma C. Garriga, Kai Puolam\u00e4ki\n*Proceedings of the 2009 SIAM International Conference on Data Mining* (2009-04-30) \nDOI: [10.1137/1.9781611972795.67](https://doi.org/10.1137/1.9781611972795.67)\n\n## Usage examples\n\n#### Permuting an edge list\n\n```python\n>>> edges = [(0, 1), (1, 0)]\n>>> permuted_edges, permutation_statistics = xswap.permute_edge_list(\n edges, allow_self_loops=True, allow_antiparallel=True,\n multiplier=10)\n>>> permuted_edges\n[(0, 0), (1, 1)]\n>>> permutation_statistics\n{'swap_attempts': 20, 'same_edge': 10, 'self_loop': 0, 'duplicate': 1,\n 'undir_duplicate': 0, 'excluded': 0}\n```\n\n#### Computing degree-sequence based prior probabilities of edges existing\n\n```python\n>>> edges = [(0, 1), (1, 0)]\n>>> prior_prob_df = xswap.prior.compute_xswap_priors(\n edges, n_permutations=10000, shape=(2, 2), allow_self_loops=True,\n allow_antiparallel=True)\n>>> prior_prob_df\n source_id target_id edge source_degree target_degree xswap_prior\n0 0 0 False 1 1 0.5\n1 0 1 True 1 1 0.5\n2 1 0 True 1 1 0.5\n3 1 1 False 1 1 0.5\n```\n\n## Choice of parameters\n\n#### Bipartite networks\n\nBipartite networks should be indexed using the bi-adjacency matrix, meaning that the edge `(0, 0)` is from source node 0 to target node 0, and is not a self-loop.\nMoreover, bipartite networks should be permuted using `allow_self_loops=False` and `allow_antiparallel=True`.\n\n#### Directed and undirected networks\n\nFor non-bipartite networks, the decisions of `allow_self_loops` and `allow_antiparallel` are not always the same.\nFor undirected networks, set `allow_antiparallel=False`, as otherwise the edges (1, 0) and (0, 1), which represent the same edge, will be treated as separate.\nAntiparallel edges may or may not be allowed for directed networks, depending on context.\nSimilarly, self-loops may or may not be allowed for directed or undirected networks, depending on the specific network being permuted.\n\n## Libraries\n\nThe XSwap library includes Roaring Bitmaps (https://github.com/RoaringBitmap/CRoaring), available under the Apache 2.0 license (https://github.com/RoaringBitmap/CRoaring/blob/LICENSE).\n\n## Acknowledgments\n\nDevelopment of this project has largely taken place in the [Greene Lab](http://www.greenelab.com/) at the University of Pennsylvania. However, as an open source project under the `hetio` organization, this repository is grateful for its community of maintainers, contributors, and users.\n\nThis work is funded in part by the Gordon and Betty Moore Foundation\u2019s Data-Driven Discovery Initiative through Grants GBMF4552 to Casey Greene, GBMF4560 to Blair Sullivan, and the National Institutes of Health\u2019s National Human Genome Research Institute R01 HG010067.\n\n\n",
"description_content_type": "text/markdown",
"docs_url": null,
"download_url": "",
"downloads": {
"last_day": -1,
"last_month": -1,
"last_week": -1
},
"home_page": "https://github.com/greenelab/xswap",
"keywords": "",
"license": "BSD 2-Clause",
"maintainer": "",
"maintainer_email": "",
"name": "xswap",
"package_url": "https://pypi.org/project/xswap/",
"platform": "",
"project_url": "https://pypi.org/project/xswap/",
"project_urls": {
"Homepage": "https://github.com/greenelab/xswap"
},
"release_url": "https://pypi.org/project/xswap/0.0.2/",
"requires_dist": null,
"requires_python": ">=3.5",
"summary": "Python-wrapped C/C++ library for degree-preserving network randomization",
"version": "0.0.2"
},
"last_serial": 5618913,
"releases": {
"0.0.2": [
{
"comment_text": "",
"digests": {
"md5": "3fa4aa481ab2c72241c896385bb4321f",
"sha256": "84803392629d7968d54903129b6a7f6bfbce9aa66f8593b4fdd0d2caf324cb14"
},
"downloads": -1,
"filename": "xswap-0.0.2-cp35-cp35m-manylinux1_i686.whl",
"has_sig": false,
"md5_digest": "3fa4aa481ab2c72241c896385bb4321f",
"packagetype": "bdist_wheel",
"python_version": "cp35",
"requires_python": ">=3.5",
"size": 402631,
"upload_time": "2019-08-01T13:54:24",
"url": "https://files.pythonhosted.org/packages/a5/fa/839a0e146cbf7c5d11c2d2749065290ab6630d108ee613b53c6249b34439/xswap-0.0.2-cp35-cp35m-manylinux1_i686.whl"
},
{
"comment_text": "",
"digests": {
"md5": "9b96cf8e6f4c4593ed2fbdf3a90ad233",
"sha256": "613319f79b4a3c8c2068419a80d00f7309850f871e11142b3b4a123d161573cd"
},
"downloads": -1,
"filename": "xswap-0.0.2-cp35-cp35m-manylinux1_x86_64.whl",
"has_sig": false,
"md5_digest": "9b96cf8e6f4c4593ed2fbdf3a90ad233",
"packagetype": "bdist_wheel",
"python_version": "cp35",
"requires_python": ">=3.5",
"size": 470788,
"upload_time": "2019-08-01T13:55:10",
"url": "https://files.pythonhosted.org/packages/b6/50/15a95e994b92afeebf5354589cd7fbe8d2b5fc9331951363c83d8cb131a1/xswap-0.0.2-cp35-cp35m-manylinux1_x86_64.whl"
},
{
"comment_text": "",
"digests": {
"md5": "c9ef9aeff7a3cce349f8ad967aa39bee",
"sha256": "895cd4c5bc9e9d8c1ab19de0f08bd5538644839f8f6bf3f6ed593316ddfcc797"
},
"downloads": -1,
"filename": "xswap-0.0.2-cp35-cp35m-manylinux2010_x86_64.whl",
"has_sig": false,
"md5_digest": "c9ef9aeff7a3cce349f8ad967aa39bee",
"packagetype": "bdist_wheel",
"python_version": "cp35",
"requires_python": ">=3.5",
"size": 470790,
"upload_time": "2019-08-01T13:55:11",
"url": "https://files.pythonhosted.org/packages/66/c8/1ce89c5c1dd07b361100cbbc852c5146dd6efb264618e384a6b89b5f8b2d/xswap-0.0.2-cp35-cp35m-manylinux2010_x86_64.whl"
},
{
"comment_text": "",
"digests": {
"md5": "6b396775f8c8653f92a578fefb25440a",
"sha256": "be43e4272a901e95eba578fdcb507e4be5123f28f049b05501f24460db26ee57"
},
"downloads": -1,
"filename": "xswap-0.0.2-cp36-cp36m-manylinux1_i686.whl",
"has_sig": false,
"md5_digest": "6b396775f8c8653f92a578fefb25440a",
"packagetype": "bdist_wheel",
"python_version": "cp36",
"requires_python": ">=3.5",
"size": 402599,
"upload_time": "2019-08-01T13:54:27",
"url": "https://files.pythonhosted.org/packages/83/6e/9da394d99be4d64abee2af2cefbf9bbea28bf2ec44bd4f1213b23eda67fa/xswap-0.0.2-cp36-cp36m-manylinux1_i686.whl"
},
{
"comment_text": "",
"digests": {
"md5": "683913523cf9373df76636e7a4579a30",
"sha256": "bec28d2ae24c8fb18b31e5a1fac10b8bc5ab9db70ed1775ac3988a0d59f377dc"
},
"downloads": -1,
"filename": "xswap-0.0.2-cp36-cp36m-manylinux1_x86_64.whl",
"has_sig": false,
"md5_digest": "683913523cf9373df76636e7a4579a30",
"packagetype": "bdist_wheel",
"python_version": "cp36",
"requires_python": ">=3.5",
"size": 471478,
"upload_time": "2019-08-01T13:55:13",
"url": "https://files.pythonhosted.org/packages/ec/72/430ea01d631a003edbad07d50d8972ed774e8533d98bc12e743b3b833eef/xswap-0.0.2-cp36-cp36m-manylinux1_x86_64.whl"
},
{
"comment_text": "",
"digests": {
"md5": "4cccf2a6ccddc39193428f7c9d9086ca",
"sha256": "69742fcca57e82664924bcb54fa2a16a28461e37d8758e69c9cd70597d977a47"
},
"downloads": -1,
"filename": "xswap-0.0.2-cp36-cp36m-manylinux2010_x86_64.whl",
"has_sig": false,
"md5_digest": "4cccf2a6ccddc39193428f7c9d9086ca",
"packagetype": "bdist_wheel",
"python_version": "cp36",
"requires_python": ">=3.5",
"size": 471479,
"upload_time": "2019-08-01T13:55:15",
"url": "https://files.pythonhosted.org/packages/45/65/3d4ca9533f18b107917906a09b920b8a8d716772d5fa9c29285256941e89/xswap-0.0.2-cp36-cp36m-manylinux2010_x86_64.whl"
},
{
"comment_text": "",
"digests": {
"md5": "a3eb8337b777619018d168bfbf1223cb",
"sha256": "22b57690c0782d41c0fb93f7d82a3e6858e26f8e1050fc74945e3065e3a6a9da"
},
"downloads": -1,
"filename": "xswap-0.0.2-cp37-cp37m-manylinux1_i686.whl",
"has_sig": false,
"md5_digest": "a3eb8337b777619018d168bfbf1223cb",
"packagetype": "bdist_wheel",
"python_version": "cp37",
"requires_python": ">=3.5",
"size": 402573,
"upload_time": "2019-08-01T13:54:29",
"url": "https://files.pythonhosted.org/packages/2b/7b/86929ad64575b0763f3e6f37230bd591242893c291c2a4b149393763036c/xswap-0.0.2-cp37-cp37m-manylinux1_i686.whl"
},
{
"comment_text": "",
"digests": {
"md5": "782dcb2f9e37680b886b9a69676cc971",
"sha256": "266614df150b830f31cfedf8b68070544b50a213707017ae885554f63f2e7182"
},
"downloads": -1,
"filename": "xswap-0.0.2-cp37-cp37m-manylinux1_x86_64.whl",
"has_sig": false,
"md5_digest": "782dcb2f9e37680b886b9a69676cc971",
"packagetype": "bdist_wheel",
"python_version": "cp37",
"requires_python": ">=3.5",
"size": 426103,
"upload_time": "2019-08-01T13:55:15",
"url": "https://files.pythonhosted.org/packages/bb/52/4f269b43e8e1acd18c9a401bf41e55dccfef07434d33b38827abbd2af8df/xswap-0.0.2-cp37-cp37m-manylinux1_x86_64.whl"
},
{
"comment_text": "",
"digests": {
"md5": "3c4fce450ca173948cf2f989fb7a0214",
"sha256": "ea2d49e1ae4367e595eaf6ec6c6cd498a8059a2cd7e2337ed2a5764ace0a37ba"
},
"downloads": -1,
"filename": "xswap-0.0.2-cp37-cp37m-manylinux2010_x86_64.whl",
"has_sig": false,
"md5_digest": "3c4fce450ca173948cf2f989fb7a0214",
"packagetype": "bdist_wheel",
"python_version": "cp37",
"requires_python": ">=3.5",
"size": 473579,
"upload_time": "2019-08-01T13:55:18",
"url": "https://files.pythonhosted.org/packages/d8/88/f159a7895058706f9fdbfe81d12fb2020a1848b75c3b7466451da96956ca/xswap-0.0.2-cp37-cp37m-manylinux2010_x86_64.whl"
}
]
},
"urls": [
{
"comment_text": "",
"digests": {
"md5": "3fa4aa481ab2c72241c896385bb4321f",
"sha256": "84803392629d7968d54903129b6a7f6bfbce9aa66f8593b4fdd0d2caf324cb14"
},
"downloads": -1,
"filename": "xswap-0.0.2-cp35-cp35m-manylinux1_i686.whl",
"has_sig": false,
"md5_digest": "3fa4aa481ab2c72241c896385bb4321f",
"packagetype": "bdist_wheel",
"python_version": "cp35",
"requires_python": ">=3.5",
"size": 402631,
"upload_time": "2019-08-01T13:54:24",
"url": "https://files.pythonhosted.org/packages/a5/fa/839a0e146cbf7c5d11c2d2749065290ab6630d108ee613b53c6249b34439/xswap-0.0.2-cp35-cp35m-manylinux1_i686.whl"
},
{
"comment_text": "",
"digests": {
"md5": "9b96cf8e6f4c4593ed2fbdf3a90ad233",
"sha256": "613319f79b4a3c8c2068419a80d00f7309850f871e11142b3b4a123d161573cd"
},
"downloads": -1,
"filename": "xswap-0.0.2-cp35-cp35m-manylinux1_x86_64.whl",
"has_sig": false,
"md5_digest": "9b96cf8e6f4c4593ed2fbdf3a90ad233",
"packagetype": "bdist_wheel",
"python_version": "cp35",
"requires_python": ">=3.5",
"size": 470788,
"upload_time": "2019-08-01T13:55:10",
"url": "https://files.pythonhosted.org/packages/b6/50/15a95e994b92afeebf5354589cd7fbe8d2b5fc9331951363c83d8cb131a1/xswap-0.0.2-cp35-cp35m-manylinux1_x86_64.whl"
},
{
"comment_text": "",
"digests": {
"md5": "c9ef9aeff7a3cce349f8ad967aa39bee",
"sha256": "895cd4c5bc9e9d8c1ab19de0f08bd5538644839f8f6bf3f6ed593316ddfcc797"
},
"downloads": -1,
"filename": "xswap-0.0.2-cp35-cp35m-manylinux2010_x86_64.whl",
"has_sig": false,
"md5_digest": "c9ef9aeff7a3cce349f8ad967aa39bee",
"packagetype": "bdist_wheel",
"python_version": "cp35",
"requires_python": ">=3.5",
"size": 470790,
"upload_time": "2019-08-01T13:55:11",
"url": "https://files.pythonhosted.org/packages/66/c8/1ce89c5c1dd07b361100cbbc852c5146dd6efb264618e384a6b89b5f8b2d/xswap-0.0.2-cp35-cp35m-manylinux2010_x86_64.whl"
},
{
"comment_text": "",
"digests": {
"md5": "6b396775f8c8653f92a578fefb25440a",
"sha256": "be43e4272a901e95eba578fdcb507e4be5123f28f049b05501f24460db26ee57"
},
"downloads": -1,
"filename": "xswap-0.0.2-cp36-cp36m-manylinux1_i686.whl",
"has_sig": false,
"md5_digest": "6b396775f8c8653f92a578fefb25440a",
"packagetype": "bdist_wheel",
"python_version": "cp36",
"requires_python": ">=3.5",
"size": 402599,
"upload_time": "2019-08-01T13:54:27",
"url": "https://files.pythonhosted.org/packages/83/6e/9da394d99be4d64abee2af2cefbf9bbea28bf2ec44bd4f1213b23eda67fa/xswap-0.0.2-cp36-cp36m-manylinux1_i686.whl"
},
{
"comment_text": "",
"digests": {
"md5": "683913523cf9373df76636e7a4579a30",
"sha256": "bec28d2ae24c8fb18b31e5a1fac10b8bc5ab9db70ed1775ac3988a0d59f377dc"
},
"downloads": -1,
"filename": "xswap-0.0.2-cp36-cp36m-manylinux1_x86_64.whl",
"has_sig": false,
"md5_digest": "683913523cf9373df76636e7a4579a30",
"packagetype": "bdist_wheel",
"python_version": "cp36",
"requires_python": ">=3.5",
"size": 471478,
"upload_time": "2019-08-01T13:55:13",
"url": "https://files.pythonhosted.org/packages/ec/72/430ea01d631a003edbad07d50d8972ed774e8533d98bc12e743b3b833eef/xswap-0.0.2-cp36-cp36m-manylinux1_x86_64.whl"
},
{
"comment_text": "",
"digests": {
"md5": "4cccf2a6ccddc39193428f7c9d9086ca",
"sha256": "69742fcca57e82664924bcb54fa2a16a28461e37d8758e69c9cd70597d977a47"
},
"downloads": -1,
"filename": "xswap-0.0.2-cp36-cp36m-manylinux2010_x86_64.whl",
"has_sig": false,
"md5_digest": "4cccf2a6ccddc39193428f7c9d9086ca",
"packagetype": "bdist_wheel",
"python_version": "cp36",
"requires_python": ">=3.5",
"size": 471479,
"upload_time": "2019-08-01T13:55:15",
"url": "https://files.pythonhosted.org/packages/45/65/3d4ca9533f18b107917906a09b920b8a8d716772d5fa9c29285256941e89/xswap-0.0.2-cp36-cp36m-manylinux2010_x86_64.whl"
},
{
"comment_text": "",
"digests": {
"md5": "a3eb8337b777619018d168bfbf1223cb",
"sha256": "22b57690c0782d41c0fb93f7d82a3e6858e26f8e1050fc74945e3065e3a6a9da"
},
"downloads": -1,
"filename": "xswap-0.0.2-cp37-cp37m-manylinux1_i686.whl",
"has_sig": false,
"md5_digest": "a3eb8337b777619018d168bfbf1223cb",
"packagetype": "bdist_wheel",
"python_version": "cp37",
"requires_python": ">=3.5",
"size": 402573,
"upload_time": "2019-08-01T13:54:29",
"url": "https://files.pythonhosted.org/packages/2b/7b/86929ad64575b0763f3e6f37230bd591242893c291c2a4b149393763036c/xswap-0.0.2-cp37-cp37m-manylinux1_i686.whl"
},
{
"comment_text": "",
"digests": {
"md5": "782dcb2f9e37680b886b9a69676cc971",
"sha256": "266614df150b830f31cfedf8b68070544b50a213707017ae885554f63f2e7182"
},
"downloads": -1,
"filename": "xswap-0.0.2-cp37-cp37m-manylinux1_x86_64.whl",
"has_sig": false,
"md5_digest": "782dcb2f9e37680b886b9a69676cc971",
"packagetype": "bdist_wheel",
"python_version": "cp37",
"requires_python": ">=3.5",
"size": 426103,
"upload_time": "2019-08-01T13:55:15",
"url": "https://files.pythonhosted.org/packages/bb/52/4f269b43e8e1acd18c9a401bf41e55dccfef07434d33b38827abbd2af8df/xswap-0.0.2-cp37-cp37m-manylinux1_x86_64.whl"
},
{
"comment_text": "",
"digests": {
"md5": "3c4fce450ca173948cf2f989fb7a0214",
"sha256": "ea2d49e1ae4367e595eaf6ec6c6cd498a8059a2cd7e2337ed2a5764ace0a37ba"
},
"downloads": -1,
"filename": "xswap-0.0.2-cp37-cp37m-manylinux2010_x86_64.whl",
"has_sig": false,
"md5_digest": "3c4fce450ca173948cf2f989fb7a0214",
"packagetype": "bdist_wheel",
"python_version": "cp37",
"requires_python": ">=3.5",
"size": 473579,
"upload_time": "2019-08-01T13:55:18",
"url": "https://files.pythonhosted.org/packages/d8/88/f159a7895058706f9fdbfe81d12fb2020a1848b75c3b7466451da96956ca/xswap-0.0.2-cp37-cp37m-manylinux2010_x86_64.whl"
}
]
}