Properties and metadata

In Raphtory graphs, nodes and edges can all have temporal properties and constant metadata, consisting of a wide range of data types. This is also discussed in the ingestion tutorial.

The Properties class offers several functions to access values in different formats. To demonstrate this you can create a simple graph with one node that has a variety of different properties.

You can fetch a node's property object and call the following functions to access data:

  • keys(): Returns all of the property keys (names).
  • values(): Returns the latest value for each property.
  • items(): Combines the keys() and values() into a list of tuples.
  • get(): Returns the latest value for a given key if the property exists or None if it does not.
  • as_dict(): Converts the Properties object into a standard python dictionary.

Metadata can call the same functions as properties

Examining histories

Properties have a history, this means that you can do more than just look at the latest value. Calling get(), values() or items() on Properties.temporal will return a TemporalProperty object which contains all of the value history.

TemporalProperty has many helper functions to examine histories, this includes:

  • value() and values(): Get the latest value or all values of the property.
  • at(): Get the latest value of the property at the specified time.
  • history(): Returns a History object with timestamps of all updates. Call .dt to get datetime format.
  • items(): Merges values() and history() into a list of tuples.
  • mean(), median(), and average(): If the property is orderable, get the average value for the property.
  • min() and max(): If the property is orderable, get the minimum or maximum value.
  • count(): Get the number of updates which have occurred
  • sum(): If the property is additive, sum the values and return the result.

In the code below, we call a subset of these functions on the Weight property of the edge between FELIPE and MAKO in our previous monkey graph example.