Skip to main content

Python package for raphtory, a temporal graph library

Project description


Raphtory

Test and Build Latest Release Issues Crates.io PyPI Launch Notebook

🌍 Website   📒 Documentation   Pometry   🧙🏻‍ Tutorial   🐛 Report a Bug   Join Slack


Raphtory is an in-memory graph tool written in Rust with friendly Python APIs on top. It is blazingly fast, scales to hundreds of millions of edges on your laptop, and can be dropped into your existing pipelines with a simple pip install raphtory.

It supports time traveling, multilayer modelling, and advanced analytics beyond simple querying like community evolution, dynamic scoring, and mining temporal motifs.

If you wish to contribute, check out the open list of issues, bounty board or hit us up directly on slack. Successful contributions will be reward with swizzling swag!

Running a basic example

from raphtory import Graph
import pandas as pd

# Create a new graph
graph = Graph()

# Add some data to your graph
graph.add_vertex(timestamp=1, id="Alice")
graph.add_vertex(timestamp=1, id="Bob")
graph.add_vertex(timestamp=1, id="Charlie")
graph.add_edge  (timestamp=2, src="Bob",   dst="Charlie", properties={"weight":5.0})
graph.add_edge  (timestamp=3, src="Alice", dst="Bob",     properties={"weight":10.0})
graph.add_edge  (timestamp=3, src="Bob",   dst="Charlie", properties={"weight":-15.0})

# Check the number of unique nodes/edges in the graph and earliest/latest time seen.
print(graph)

results = [["earliest_time", "name", "out_degree", "in_degree"]]

# Collect some simple vertex metrics Ran across the history of your graph with a rolling window
for graph_view in graph.rolling(window=1):
    for v in graph_view.vertices():
        results.append([graph_view.earliest_time(), v.name(), v.out_degree(), v.in_degree()])

# Print the results
print(pd.DataFrame(results[1:], columns=results[0]))

# Grab an edge, explore the history of its 'weight' 
cb_edge = graph.edge("Bob","Charlie")
weight_history = cb_edge.property_history("weight")
print("The edge between Bob and Charlie has the following weight history:", weight_history)

# Compare this weight between time 2 and time 3
weight_change = cb_edge.at(2)["weight"] - cb_edge.at(3)["weight"]
print("The weight of the edge between Bob and Charlie has changed by",weight_change,"pts")
Graph(number_of_edges=2, number_of_vertices=3, earliest_time=1, latest_time=3)

|   | earliest_time | name    | out_degree | in_degree |
|---|---------------|---------|------------|-----------|
| 0 | 1             | Alice   | 0          | 0         |
| 1 | 1             | Bob     | 0          | 0         |
| 2 | 1             | Charlie | 0          | 0         |
| 3 | 2             | Bob     | 1          | 0         |
| 4 | 2             | Charlie | 0          | 1         |
| 5 | 3             | Alice   | 1          | 0         |
| 6 | 3             | Bob     | 1          | 1         |
| 7 | 3             | Charlie | 0          | 1         |

The edge between Bob and Charlie has the following weight history: [(2, 5.0), (3, -15.0)]

The weight of the edge between Bob and Charlie has changed by 20.0 pts

Installing Raphtory

Raphtory is available for Python and Rust as of version 0.3.0. You should have Python version 3.10 or higher and it's a good idea to use conda, virtualenv, or pyenv.

pip install raphtory

Examples and Notebooks

Check out Raphtory in action with our interactive Jupyter Notebook! Just click the badge below to launch a Raphtory sandbox online, no installation needed.

Binder

Want to give Raphtory a go on your laptop? You can checkout out the latest documentation and complete list of available algorithms or hop on our notebook based tutorials below!

Getting started

Type Description
Tutorial Building your first graph

Developing an end-to-end application

Type Description
Notebook Use our powerful time APIs to find pump and dump scams in popular NFTs

Community

Join the growing community of open-source enthusiasts using Raphtory to power their graph analysis projects!

  • Follow Slack for the latest Raphtory news and development

  • Join our Slack to chat with us and get answers to your questions!

Contributors

Want to get involved? Please join the Raphtory Slack group and speak with us on how you could pitch in!

License

Raphtory is licensed under the terms of the GNU General Public License v3.0 (check out our LICENSE file).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

raphtory-0.2.0-cp311-none-win_amd64.whl (2.8 MB view hashes)

Uploaded CPython 3.11 Windows x86-64

raphtory-0.2.0-cp311-cp311-macosx_11_0_arm64.whl (3.3 MB view hashes)

Uploaded CPython 3.11 macOS 11.0+ ARM64

raphtory-0.2.0-cp311-cp311-macosx_10_7_x86_64.whl (3.5 MB view hashes)

Uploaded CPython 3.11 macOS 10.7+ x86-64

raphtory-0.2.0-cp310-none-win_amd64.whl (2.8 MB view hashes)

Uploaded CPython 3.10 Windows x86-64

raphtory-0.2.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.1 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

raphtory-0.2.0-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (5.8 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ ARMv7l

raphtory-0.2.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (5.9 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ ARM64

raphtory-0.2.0-cp310-cp310-macosx_11_0_arm64.whl (3.3 MB view hashes)

Uploaded CPython 3.10 macOS 11.0+ ARM64

raphtory-0.2.0-cp310-cp310-macosx_10_7_x86_64.whl (3.5 MB view hashes)

Uploaded CPython 3.10 macOS 10.7+ x86-64

raphtory-0.2.0-cp39-none-win_amd64.whl (2.8 MB view hashes)

Uploaded CPython 3.9 Windows x86-64

raphtory-0.2.0-cp38-none-win_amd64.whl (2.8 MB view hashes)

Uploaded CPython 3.8 Windows x86-64

raphtory-0.2.0-cp37-none-win_amd64.whl (2.8 MB view hashes)

Uploaded CPython 3.7 Windows x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page