Skip to content

Create a graph#

You can create graphs from scratch in Raphtory or build a graph from existing data formatted as either a pandas dataframe or Apache Parquet file.

Using these standard data formats allows you to integrate your existing data sanitisation and normalisation pipelines into creating your Raphtory graphs. It is typically easier to prepare your data before ingestion to ensure the quality of subsequent analysis.

Creating a graph#

To get started we first need to create a graph to store our data. Printing this graph will show it as empty with no nodes, edges or update times.

from raphtory import Graph

g = Graph()
print(g)

Output

Graph(number_of_nodes=0, number_of_edges=0, number_of_temporal_edges=0, earliest_time=None, latest_time=None)

Updating a graph#

Once you have a graph object you can add data by:

Saving a graph#

When you have created a graph you can save it to disk to reload quickly in the future.

Raphtory can store a graph as:

  • Native Raphtory graph
  • Zip file
  • Parquet
  • Raw bytes