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.12.tar.gz (5.4 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.12-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.7 MB view details)

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

graphrs_python-0.11.12-cp39-abi3-macosx_11_0_arm64.whl (355.0 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: graphrs_python-0.11.12.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.11

File hashes

Hashes for graphrs_python-0.11.12.tar.gz
Algorithm Hash digest
SHA256 930475e3f1e9ecb3787c5f52d2bee460a436d31ee2f13a2a98e27d31c9bd3b28
MD5 3fcbe93ca3416dbcbcee5be726272172
BLAKE2b-256 172a98290c101208b251590b455f1374d1db6ed98a4d1465e722a65bc3a4fed2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for graphrs_python-0.11.12-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d25d2a0061e4e04d531cd91be9990ecbb46138f6872ff1de3fdd4cadce97eeb2
MD5 c18aa909ce31b6033e4c17e98fe36fd4
BLAKE2b-256 118b90961fd5ad6a048c241093ae2b675c8b4c7708c9a91b5fc8cc47cd346240

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for graphrs_python-0.11.12-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 20470d983be96d216bb701ac999ae4a5652ed49e2ca266b3809a187833183584
MD5 7b8348320176bd0e3ae8b609da647aeb
BLAKE2b-256 7d5d057f6816239ce2a55eea18dcf35c30de36521c47d31b6423f9f03659c498

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