Introduction and dataset

After reading data into Raphtory we can now make use of the graph representation to ask some interesting questions. This example will use a dataset from SocioPatterns, comprising different behavioral interactions between a group of 22 baboons over a month.

In the below code loads this dataset into a dataframe and does a small amount of preprocessing to prepare it for loading into Raphtory. This includes dropping rows with blank fields and mapping the values of the behavior category into a weight which can be aggregated. The mapping consists of the following conversions:

  • Affiliative (positive interaction) → +1
  • Agonistic (negative interaction) → -1
  • Other (neutral interaction) → 0

Next we load this dataframe into Raphtory using the load_edges() function, modelling it as a weighted multi-layer graph, with a layer per unique behavior.