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.1.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.1-cp39-abi3-win_amd64.whl (208.2 kB view details)

Uploaded CPython 3.9+Windows x86-64

graphrs_python-0.11.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (363.9 kB view details)

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

graphrs_python-0.11.1-cp39-abi3-macosx_11_0_arm64.whl (310.9 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: graphrs_python-0.11.1.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.1.tar.gz
Algorithm Hash digest
SHA256 916f384314aa0e63c98993bbc6a58866500df04786f46cc1244013da70660aaa
MD5 4e675c125673ce1056786b1392c66e13
BLAKE2b-256 6cfc939d006a0b1e29d9d5bd90bfc4b56b8c02da3c9ad8c395ea7c5cc40a2de8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for graphrs_python-0.11.1-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 c330095ce874886d6c3db1b8b8ecf5121497e75807ea11d711c1656ee83bbb4a
MD5 2b6f4222cda4fba4fbd11f34f229ef34
BLAKE2b-256 68a99c84a80394017bd918412f99000c86cfb349a7c99694f139d8aa201c5d41

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for graphrs_python-0.11.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 313600e4aa859e36132afda3f967d8d9896cd339de9ee549696184504a41e5c2
MD5 2e7bb064b6f2768df128b2c0d5d72b81
BLAKE2b-256 fee16882a991f0021a4e4d02ba129069c4304408930a565dd6ff356546e7d8b4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for graphrs_python-0.11.1-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 29328c33b8d62fd70126e935a5eb9a752980aaa176eb8ba2c7b29b44f4c9a822
MD5 04e1d1bd335368c19e12cb5a160a8563
BLAKE2b-256 cdce15c7196e47510f4a7f1ef8254c5ff8abe1049059f42ccddc35dffc42cce0

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