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.tar.gz (5.1 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-cp39-abi3-win_amd64.whl (220.3 kB view details)

Uploaded CPython 3.9+Windows x86-64

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

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

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

Uploaded CPython 3.9+macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: graphrs_python-0.11.0.tar.gz
  • Upload date:
  • Size: 5.1 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.tar.gz
Algorithm Hash digest
SHA256 e43ddf3025e5e67ee4ea19ec66ebffa0d6ebd551acbcf0d98ef2f0cdd46349c4
MD5 f55edb5b1aa3e9bbfc84ce221b9c0f53
BLAKE2b-256 a52e6e544491f13a0b2fdecbab3811abb47bdc0fc37cbeab00c5178780dbbbbf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for graphrs_python-0.11.0-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 ceea8f8030468d8d6c115d66f70ea156c95b412ec4a25e874c21b63b6cb1cf9a
MD5 a3807063aa9d79da38f3f6c069422845
BLAKE2b-256 e93ca32ad0d26a51219aa42d3697b86b19f6be5b6fdaab22c6aa01cc73023db2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for graphrs_python-0.11.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 17d6c09b154513dd8a9746b98a75a547ed06471704cea4b5c1b50761e0495601
MD5 2bd508fa8287821b658c2e4a363d71a0
BLAKE2b-256 8aaba6554c44557f52502c4bf3424c34dff010371260087dbf2fb2867e31547e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for graphrs_python-0.11.0-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5aa6e1a0ca2b135a12ba14c45985a5869f07ca64214a9808d3c4629dcd744f70
MD5 048d5186f186f33a19348c7f01d74afd
BLAKE2b-256 41da5ceae95d414ff068fe3992955251893c925572a176b8e9e32d42b937d9a5

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