graphrs-python


Namegraphrs-python JSON
Version 0.11.4 PyPI version JSON
download
home_pageNone
SummaryA Python module that wraps the high-performance `graphrs` Rust library.
upload_time2024-12-11 15:07:07
maintainerNone
docs_urlNone
authorNone
requires_pythonNone
licenseMIT License Copyright (c) 2024 Malcolm van Raalte Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords graph network graph theory network theory graph algorithms network algorithms
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # graphrs_python

`graphrs_python` is a Python wrapper around the high-performance [graphrs](<https://crates.io/crates/graphrs>)
Rust crate. See the [performance documentation](<https://github.com/malcolmvr/graphrs/blob/main/performance.md>)
for a comparison of the performance of `graphrs` to other graph libraries.

## Example Usage

```python
import graphrs_python as grs

nodes = ["n1", "n2", "n3", "n4"]
edges = [("n1", "n2", 1.0), ("n2", "n3", 1.0), ("n3", "n4", 1.0), ("n4", "n2", 1.0)]
graph = grs.create_graph_from_nodes_and_edges(nodes, edges, directed=True)

print(grs.betweenness_centrality(graph, weighted=True, normalized=True))
print(grs.closeness_centrality(graph, weighted=True, wf_improved=True))
print(grs.eigenvector_centrality(graph, weighted=True))
```

Graphs can also be created from just edges:

```python
import graphrs_python as grs

edges = [("n1", "n2", 1.0), ("n2", "n3", 1.0), ("n3", "n4", 1.0), ("n4", "n2", 1.0)]
graph = grs.create_graph_from_edges(edges, directed=True)
```

And graphs can also be created from NetworkX `Graph` objects:

```python
import graphrs_python as grs
import networkx

graph = nx.DiGraph()
graph.add_edges_from(
    [
        ("n1", "n2", {"weight": 1.0}),
        ("n2", "n3", {"weight": 1.0}),
        ("n3", "n4", {"weight": 1.0}),
        ("n4", "n2", {"weight": 1.0}),
    ]
)
graph = grs.create_graph_from_networkx(graph, weight="weight")
```

## License

MIT

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "graphrs-python",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "graph, network, graph theory, network theory, graph algorithms, network algorithms",
    "author": null,
    "author_email": "Malcolm van Raalte <malcolm@van.raalte.ca>",
    "download_url": "https://files.pythonhosted.org/packages/13/e4/f65a5467487ce865ca1ea696ada7227852f76188ada2ee75ab44bf22a192/graphrs_python-0.11.4.tar.gz",
    "platform": null,
    "description": "# graphrs_python\n\n`graphrs_python` is a Python wrapper around the high-performance [graphrs](<https://crates.io/crates/graphrs>)\nRust crate. See the [performance documentation](<https://github.com/malcolmvr/graphrs/blob/main/performance.md>)\nfor a comparison of the performance of `graphrs` to other graph libraries.\n\n## Example Usage\n\n```python\nimport graphrs_python as grs\n\nnodes = [\"n1\", \"n2\", \"n3\", \"n4\"]\nedges = [(\"n1\", \"n2\", 1.0), (\"n2\", \"n3\", 1.0), (\"n3\", \"n4\", 1.0), (\"n4\", \"n2\", 1.0)]\ngraph = grs.create_graph_from_nodes_and_edges(nodes, edges, directed=True)\n\nprint(grs.betweenness_centrality(graph, weighted=True, normalized=True))\nprint(grs.closeness_centrality(graph, weighted=True, wf_improved=True))\nprint(grs.eigenvector_centrality(graph, weighted=True))\n```\n\nGraphs can also be created from just edges:\n\n```python\nimport graphrs_python as grs\n\nedges = [(\"n1\", \"n2\", 1.0), (\"n2\", \"n3\", 1.0), (\"n3\", \"n4\", 1.0), (\"n4\", \"n2\", 1.0)]\ngraph = grs.create_graph_from_edges(edges, directed=True)\n```\n\nAnd graphs can also be created from NetworkX `Graph` objects:\n\n```python\nimport graphrs_python as grs\nimport networkx\n\ngraph = nx.DiGraph()\ngraph.add_edges_from(\n    [\n        (\"n1\", \"n2\", {\"weight\": 1.0}),\n        (\"n2\", \"n3\", {\"weight\": 1.0}),\n        (\"n3\", \"n4\", {\"weight\": 1.0}),\n        (\"n4\", \"n2\", {\"weight\": 1.0}),\n    ]\n)\ngraph = grs.create_graph_from_networkx(graph, weight=\"weight\")\n```\n\n## License\n\nMIT\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2024 Malcolm van Raalte  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "A Python module that wraps the high-performance `graphrs` Rust library.",
    "version": "0.11.4",
    "project_urls": {
        "Repository": "https://github.com/malcolmvr/graphrs_python"
    },
    "split_keywords": [
        "graph",
        " network",
        " graph theory",
        " network theory",
        " graph algorithms",
        " network algorithms"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "99338e1e424c9af7418b0ce2316e21d7d4b026f40ffb8ef5fc63401688e632ad",
                "md5": "3f023b61a3310b557e6816bd9fc5b411",
                "sha256": "6f74ba92c3874a7aa8ebd9b434e6ac0442575240c129e9e6f667cd02334a0f76"
            },
            "downloads": -1,
            "filename": "graphrs_python-0.11.4-cp39-abi3-macosx_11_0_arm64.whl",
            "has_sig": false,
            "md5_digest": "3f023b61a3310b557e6816bd9fc5b411",
            "packagetype": "bdist_wheel",
            "python_version": "cp39",
            "requires_python": null,
            "size": 319969,
            "upload_time": "2024-12-11T15:07:02",
            "upload_time_iso_8601": "2024-12-11T15:07:02.622868Z",
            "url": "https://files.pythonhosted.org/packages/99/33/8e1e424c9af7418b0ce2316e21d7d4b026f40ffb8ef5fc63401688e632ad/graphrs_python-0.11.4-cp39-abi3-macosx_11_0_arm64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ec68dbc211a0957168981d048a4612c14baf361776e3933899fe449e1ee6f1b1",
                "md5": "ef4814a4943b15d24efd01dbb87c4a23",
                "sha256": "e9bf5e8fb4ad9dc85ff4c3b700a9195f82cd78b70715bb133ca16d18bd2339fc"
            },
            "downloads": -1,
            "filename": "graphrs_python-0.11.4-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "has_sig": false,
            "md5_digest": "ef4814a4943b15d24efd01dbb87c4a23",
            "packagetype": "bdist_wheel",
            "python_version": "cp39",
            "requires_python": null,
            "size": 375327,
            "upload_time": "2024-12-11T15:07:04",
            "upload_time_iso_8601": "2024-12-11T15:07:04.263029Z",
            "url": "https://files.pythonhosted.org/packages/ec/68/dbc211a0957168981d048a4612c14baf361776e3933899fe449e1ee6f1b1/graphrs_python-0.11.4-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "970a48b9b08f267343778762563492e655dc4c1458b201f0f79a2ef08587b841",
                "md5": "2bc15ed7922fa867803d128a9a53e589",
                "sha256": "7f893e7f8e186c036078fc68fca45a49f656a1082a2ba653e5f13aa98346046d"
            },
            "downloads": -1,
            "filename": "graphrs_python-0.11.4-cp39-abi3-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "2bc15ed7922fa867803d128a9a53e589",
            "packagetype": "bdist_wheel",
            "python_version": "cp39",
            "requires_python": null,
            "size": 219176,
            "upload_time": "2024-12-11T15:07:05",
            "upload_time_iso_8601": "2024-12-11T15:07:05.746386Z",
            "url": "https://files.pythonhosted.org/packages/97/0a/48b9b08f267343778762563492e655dc4c1458b201f0f79a2ef08587b841/graphrs_python-0.11.4-cp39-abi3-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "13e4f65a5467487ce865ca1ea696ada7227852f76188ada2ee75ab44bf22a192",
                "md5": "1ed222f9ced3260013841c6da294e263",
                "sha256": "07d9099b196e69596e902d4e7d33cd2d79a36b0d9d4e75ae882a187697b35704"
            },
            "downloads": -1,
            "filename": "graphrs_python-0.11.4.tar.gz",
            "has_sig": false,
            "md5_digest": "1ed222f9ced3260013841c6da294e263",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 5247,
            "upload_time": "2024-12-11T15:07:07",
            "upload_time_iso_8601": "2024-12-11T15:07:07.045607Z",
            "url": "https://files.pythonhosted.org/packages/13/e4/f65a5467487ce865ca1ea696ada7227852f76188ada2ee75ab44bf22a192/graphrs_python-0.11.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-11 15:07:07",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "malcolmvr",
    "github_project": "graphrs_python",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "graphrs-python"
}
        
Elapsed time: 0.41675s