Skip to main content

A Python module that wraps the high-performance `graphrs` Rust library.

Project description

graphrs_python

graphrs_python is a Python wrapper around the high-performance graphrs Rust crate. See the performance documentation for a comparison of the performance of graphrs to other graph libraries.

Example Usage

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:

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:

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

graphrs_python-0.11.0.post2.tar.gz (5.2 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

graphrs_python-0.11.0.post2-cp39-abi3-win_amd64.whl (220.5 kB view details)

Uploaded CPython 3.9+Windows x86-64

graphrs_python-0.11.0.post2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (373.1 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ x86-64

graphrs_python-0.11.0.post2-cp39-abi3-macosx_11_0_arm64.whl (319.1 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

File details

Details for the file graphrs_python-0.11.0.post2.tar.gz.

File metadata

  • Download URL: graphrs_python-0.11.0.post2.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.3

File hashes

Hashes for graphrs_python-0.11.0.post2.tar.gz
Algorithm Hash digest
SHA256 a197fbcea843d96b8740e554fbaa892241750db77cf24f3b273709f9b15dce7a
MD5 476d9ca78b61dc2760946d3ec1e3dc75
BLAKE2b-256 4c6e3f9b2119de8d38f2ced3958f8d64915a866119e3c4c54c424e88ddf2f2ab

See more details on using hashes here.

File details

Details for the file graphrs_python-0.11.0.post2-cp39-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for graphrs_python-0.11.0.post2-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 777d7c4b3cb125529a56a0206767163fbc885c8754f0abb9efe3fb2d63c9fcec
MD5 651ae6ce824101419d20781c4d6b06be
BLAKE2b-256 9d83643976198ffc51ba77d563c6a5ef2004f67717a60ba3a24c3c3a313366cb

See more details on using hashes here.

File details

Details for the file graphrs_python-0.11.0.post2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for graphrs_python-0.11.0.post2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 57f1670f62db17a9a1b0832c70cfcf42245ee7d417e598eb705124c78d75ab9f
MD5 dc70862a3f295f82bcda7d11bea49045
BLAKE2b-256 3ff9816b283019583184c309323e111db4ae2db134d352ede9588cd52d735b62

See more details on using hashes here.

File details

Details for the file graphrs_python-0.11.0.post2-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for graphrs_python-0.11.0.post2-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 78b0bb2a641908a3de5b238061629e5cbc6adf8c36863f6437c2fbf08ce855ac
MD5 77bacb3b1258b66ea0039927154722d7
BLAKE2b-256 cd86d45c9916fa252f135722cd0b877ec54a46c67a935ac0bc8592a34bb5fea7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page