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

Uploaded CPython 3.9+Windows x86-64

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

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

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

Uploaded CPython 3.9+macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: graphrs_python-0.11.4.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.4.tar.gz
Algorithm Hash digest
SHA256 07d9099b196e69596e902d4e7d33cd2d79a36b0d9d4e75ae882a187697b35704
MD5 1ed222f9ced3260013841c6da294e263
BLAKE2b-256 13e4f65a5467487ce865ca1ea696ada7227852f76188ada2ee75ab44bf22a192

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for graphrs_python-0.11.4-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 7f893e7f8e186c036078fc68fca45a49f656a1082a2ba653e5f13aa98346046d
MD5 2bc15ed7922fa867803d128a9a53e589
BLAKE2b-256 970a48b9b08f267343778762563492e655dc4c1458b201f0f79a2ef08587b841

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for graphrs_python-0.11.4-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e9bf5e8fb4ad9dc85ff4c3b700a9195f82cd78b70715bb133ca16d18bd2339fc
MD5 ef4814a4943b15d24efd01dbb87c4a23
BLAKE2b-256 ec68dbc211a0957168981d048a4612c14baf361776e3933899fe449e1ee6f1b1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for graphrs_python-0.11.4-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6f74ba92c3874a7aa8ebd9b434e6ac0442575240c129e9e6f667cd02334a0f76
MD5 3f023b61a3310b557e6816bd9fc5b411
BLAKE2b-256 99338e1e424c9af7418b0ce2316e21d7d4b026f40ffb8ef5fc63401688e632ad

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