Skip to main content

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

Metadata

Release files for graphrs-python 0.12.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for graphrs-python 0.12.0
File Size Uploaded
graphrs_python-0.12.0.tar.gz 5.6 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for graphrs-python 0.12.0
File Interpreter ABI Platform
graphrs_python-0.12.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.9 abi3 Linux glibc 2.17+ x86-64 Details
graphrs_python-0.12.0-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details

Total release size: 4.1 MB

Release files / graphrs_python-0.12.0.tar.gz

Download URL graphrs_python-0.12.0.tar.gz
Size 5.6 kB
Tags Source
SHA-256 checksum
How to use checksums
b59375d485dc430b1c5426290c5618e0f0f271b4d18cfbc48e6e22be8e2fff68
BLAKE2b-256 checksum
How to use checksums
ac96b2b4f372f3e74b2c4e366b53867c977e45f0b20a8631d3c2f640dedaf6ee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.15

Release files / graphrs_python-0.12.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL graphrs_python-0.12.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 3.7 MB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
c9c1df3745e2cac71179a020b7e717775226b1c3535702090e4fa13f72a4f9f4
BLAKE2b-256 checksum
How to use checksums
5b1ca455995c993acde0269dd2da9a139d16fccc73c0ac25bc76536c6e0acfda
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.15

Release files / graphrs_python-0.12.0-cp39-abi3-macosx_11_0_arm64.whl

Download URL graphrs_python-0.12.0-cp39-abi3-macosx_11_0_arm64.whl
Size 359.4 kB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
aa47f8ab297baee0a3ab02579aa024e813fb991b4bcbeda830a82122546048b0
BLAKE2b-256 checksum
How to use checksums
b308bac1fcf4f71330d80b0294f1d3cdaafb190cf943c6837e0ebdcc4d2bb55c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.15
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page