Skip to content
forked from Pometry/Raphtory

Blazingly fast, vectorised, parallel, and scalable temporal graph engine for Rust, Python and JavaScript

License

Notifications You must be signed in to change notification settings

D4rkisek/Raphtory

Repository files navigation


Raphtory

Test and Build Latest Release Issues Launch Notebook

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


Raphtory is a powerful analytics engine for large-scale graph analysis. It lets you run complex queries on your data, no matter where it's stored or what format it's in. But that's not all - Raphtory's real superpower is its ability to track and explore the history of a complex system, from "time traveling" through data to executing advanced analysis like taint tracking, temporal reachability, and mining temporal motifs.

Raphtory is easy to use: just run a single pip install raphtory command and embed it with your existing Python/Pandas pipeline for input and output.

Raphtory is expressive: It's designed to represent all types of graph queries and has a well-developed API for exploring your data across its history.

Raphtory is lightning-fast and scales effortlessly: Our core is built upon rust. Raphtory can be run on a laptop or a distributed cluster for terabyte-scale graphs.

Running a basic example

# Import raphtory
from raphtory import Graph
import pandas as pd

# Create a new graph
graph = Graph(1)

# Add some data to your graph
graph.add_vertex(1, 1, {"name": "Alice"})
graph.add_vertex(2, 2, {"name": "Bob"})
graph.add_vertex(3, 3, {"name": "Charlie"})
graph.add_edge(3, 2, 3, {"friend": "yes"})
graph.add_edge(4, 1, 2, {"friend": "yes"})
graph.add_vertex(5, 1, {"name": "Alice Bob"})
graph.add_edge(4, 2, 3, {"friend": "no"})

# Collect some simple vertex metrics
# Ran across a range of the data with incremental windowing
graph_set = graph.rolling(1)

results = [["timestamp", "window", "name", "out_degree", "in_degree", "properties"]]

for rolling_graph in graph_set:
    for v in rolling_graph.vertices():
        window = rolling_graph.end() - rolling_graph.start()
        results.append([rolling_graph.earliest_time(), window, v.name(), v.out_degree(), v.in_degree(), v.properties()])
    

# Preview DataFrame and vertex properties
pd.DataFrame(results[1:], columns=results[0])

|    |   timestamp |   window |   name |   out_degree |   in_degree |            properties |
|----|-------------|----------|--------|--------------|-------------|---------------------- |
|  0 |           1 |        1 |      1 |            0 |           0 |     {'name': 'Alice'} |
|  1 |           2 |        1 |      2 |            0 |           0 |       {'name': 'Bob'} |
|  2 |           3 |        1 |      2 |            1 |           0 |                    {} |
|  3 |           4 |        1 |      3 |            0 |           1 |   {'name': 'Charlie'} |
|  4 |           4 |        1 |      1 |            1 |           0 |                    {} |
|  5 |           4 |        1 |      2 |            1 |           1 |                    {} |
|  6 |           4 |        1 |      3 |            0 |           1 |                    {} |
|  7 |           5 |        1 |      1 |            0 |           1 | {'name': 'Alice Bob'} |
# Again but we focus on edges
graph_set = graph.rolling(1)

results = [["timestamp", "window", "src vertex", "dst vertex", "properties"]]

for rolling_graph in graph_set:
    for e in rolling_graph.edges():
        window = rolling_graph.end() - rolling_graph.start()
        results.append([rolling_graph.earliest_time(), window, e.src().name(), e.dst().name(), e.properties()])

# Preview Dataframe with edge properties 
pd.DataFrame(results[1:], columns=results[0])

|    |   timestamp |   window | src vertex | dst vertex |          properties |
|----|-------------|----------|------------|------------|---------------------|
|  0 |           3 |        1 |          2 |          3 |   {'friend': 'yes'} |
|  1 |           4 |        1 |          1 |          2 |   {'friend': 'yes'} |
|  2 |           4 |        1 |          1 |          3 |    {'friend': 'no'} |

Installing Raphtory

Raphtory is available for Python and Rust as of version 0.3.0. We recommend using the raphtory client for Python, which includes everything you need and can be run locally or in distributed mode.

You should have Python version 3.9 or higher. 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 see what Raphtory can do? Scroll down for more.

1. Getting started

Type Location Description
Example ingestion Loading some sample data into Raphtory
Example degree count Running the simplest graph query in Raphtory
Example timetravel (COMING SOON) Understanding the time APIs in Raphtory

2. Running some algorithms

Type Location Description
Example centrality (COMING SOON) Centrality algorithms for finding important nodes
Example community (COMING SOON) Community detection for finding clusters
Example reciprocity Measuring the symmetry of relationships in a graph
Example triangle count Calculates the number of triangles (a cycle of length 3) for a node

3. Developing an end-to-end application

Type Location Description
Notebook nft_analysis.ipynb Use our powerful time APIs to analyse monetary cycles of 1000s of hops to find pump and dump scams of popular NFTs
Notebook ppe_analysis.ipnyb Consolidate disparate data sources and use deep link analysis and temporal indicators to find hidden fraud patterns in COVID-19 Relief Schemes

Want to run your own analysis?

Learn how to use Raphtory in your analysis and project by following these links.

Bounty board

Raphtory is currently offering rewards for contributions, such as new features or algorithms. Contributors will receive swag and prizes!

To get started, check out our list of desired algorithms at https://github.com/Raphtory/Raphtory/discussions/categories/bounty-board which include some low hanging fruit (🍇) that are easy to implement.

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!

Articles and Talks about Raphtory

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).

About

Blazingly fast, vectorised, parallel, and scalable temporal graph engine for Rust, Python and JavaScript

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 89.2%
  • Python 10.6%
  • Other 0.2%