Data Scientist Tutorial
From pandas DataFrame to temporal graph insights in 30 minutes.
Learn how to use Raphtory within your existing data science workflow - load data from pandas, run temporal algorithms, and export results for visualization or downstream ML.
What You'll Build
- Load Data – Import from CSV, Parquet, or pandas DataFrame
- Temporal Querying – Travel through time with
.at()and.window() - Run Algorithms – PageRank, community detection, temporal motifs
- Generate Embeddings – FastRP for downstream ML
- Export Results – Back to pandas, NetworkX, or your ML pipeline
Time: 30 minutes
Prerequisites: Python, pandas familiarity.
1. Load Data from Pandas
Most data science workflows start with DataFrames. Raphtory makes conversion seamless.
Timestamp Formats: Raphtory accepts Unix timestamps (int/float), datetime objects, or pandas Timestamp. Conversion is automatic.
2. Time Travel with Temporal Queries
Unlike static graphs, Raphtory lets you see the network at any point in time.
3. Run Graph Algorithms
Raphtory includes optimized implementations of standard algorithms that work on temporal views.
4. Temporal Motif Analysis
Find recurring temporal patterns - sequences of interactions that happen in a specific order within a time window.
What are temporal motifs? They're patterns like "A→B, then B→C within 5 seconds" - the building blocks of behavioral analysis.
5. Generate Node Embeddings
Use FastRP to create vector representations for downstream ML tasks.
6. Export Results
Move results back to your favorite tools.
Real-World Example: Analyzing Social Interactions
Coming from NetworkX?
Raphtory's API will feel familiar:
| NetworkX | Raphtory |
|---|---|
G.add_edge(u, v) | g.add_edge(time, u, v) |
G.nodes() | g.nodes() |
nx.pagerank(G) | algorithms.pagerank(g) |
nx.to_pandas_edgelist(G) | g.edges.to_df() |
The key difference: Raphtory requires a timestamp for every edge, unlocking temporal analysis that NetworkX can't do.
Next Steps
- Temporal Views – Advanced windowing and filtering
- Algorithm Reference – Full algorithm library
- Visualisation – See your graphs