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.4.post1.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.4.post1-cp39-abi3-win_amd64.whl (245.4 kB view details)

Uploaded CPython 3.9+Windows x86-64

graphrs_python-0.11.4.post1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (403.3 kB view details)

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

graphrs_python-0.11.4.post1-cp39-abi3-macosx_11_0_arm64.whl (343.9 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

File details

Details for the file graphrs_python-0.11.4.post1.tar.gz.

File metadata

  • Download URL: graphrs_python-0.11.4.post1.tar.gz
  • Upload date:
  • Size: 5.4 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.4.post1.tar.gz
Algorithm Hash digest
SHA256 319d2e5a0299cf58dcc31c1e293010aed6c14998f25b437b5638a9a09ec89232
MD5 cda853f4a3fc93178abcbe1c32f773bc
BLAKE2b-256 e9444ed905c4788adbe59ead9bf97791651a66f34f3cc57768c0fc2d0c12e794

See more details on using hashes here.

File details

Details for the file graphrs_python-0.11.4.post1-cp39-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for graphrs_python-0.11.4.post1-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 8255493abd52fc4792186c8dccbeeffb9a08dc4eb537a78f9a0bd0b88b9421a2
MD5 e0db638737b6d4c9eb61893ad28b7e3d
BLAKE2b-256 6baf1b335466ec47cefc505d61d0995c2b3a79ce345e2a81cbba7d4baed7314f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for graphrs_python-0.11.4.post1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 97581ff645bd4ada56aa4bb9f664aba21d9a2b88b0f4a282c45a36393054d7d3
MD5 24740e971a33d6587b6fe4200c045906
BLAKE2b-256 ec60a3c323a8a3eb3964592157dfe6217bbc41e5c4a2260f865bc8db9cb126ad

See more details on using hashes here.

File details

Details for the file graphrs_python-0.11.4.post1-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for graphrs_python-0.11.4.post1-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 84ef4701da8637ef1cda8310d444ffe6b3d0cd40bf26f16d45944390eb091669
MD5 92c7240fa09f5b43b712ed67ac527f00
BLAKE2b-256 369762859995a16e24cd876fb52d690679d2d1f5547c7566594f7d6e57906e45

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