Types API Reference

This page documents the core data types in REM.jl.

Events

Event

REM.EventType
Event{T}

Represents a single relational event (directed interaction between actors).

Fields

  • sender::Int: ID of the event sender/source
  • receiver::Int: ID of the event receiver/target
  • time::T: Timestamp of the event
  • eventtype::Symbol: Type/category of the event (default: :event)
  • weight::Float64: Weight/magnitude of the event (default: 1.0)
source

EventSequence

REM.EventSequenceType
EventSequence{T}

A sequence of relational events, sorted by time.

Fields

  • events::Vector{Event{T}}: Vector of events sorted by time
  • actors::Set{Int}: Set of all actor IDs
  • n_actors::Int: Number of unique actors
  • eventtypes::Set{Symbol}: Set of all event types
source

Actor Data

ActorSet

REM.ActorSetType
ActorSet

Represents a set of actors with optional ID-to-name mapping.

source

NodeAttribute

REM.NodeAttributeType
NodeAttribute{T}

Stores an attribute value for each actor.

Fields

  • name::Symbol: Name of the attribute
  • values::Dict{Int, T}: Mapping from actor ID to attribute value
  • default::T: Default value for actors not in the dict
source

RiskSet

REM.RiskSetType
RiskSet

Represents the risk set for a given event - the set of potential dyads that could have experienced an event at a given time.

Fields

  • event_index::Int: Index of the focal event in the sequence
  • potential_senders::Vector{Int}: Actors who could be senders
  • potential_receivers::Vector{Int}: Actors who could be receivers
  • exclude_self_loops::Bool: Whether to exclude self-loops from risk set
source

Network State

The NetworkState type maintains the cumulative state of the network as events are processed. It tracks dyad counts, degrees, and neighbor sets, optionally with exponential decay.

NetworkState

REM.NetworkStateType
NetworkState

Tracks the cumulative state of the network up to a given point in time. Used for efficient computation of statistics.

Fields

  • n_actors::Int: Number of actors
  • dyad_counts::Dict{Tuple{Int,Int}, Float64}: Weighted count of events for each directed dyad
  • undirected_counts::Dict{Tuple{Int,Int}, Float64}: Weighted count for undirected dyads (min,max sorted)
  • out_degree::Dict{Int, Float64}: Weighted out-degree for each actor
  • in_degree::Dict{Int, Float64}: Weighted in-degree for each actor
  • last_event_time::Dict{Tuple{Int,Int}, Any}: Time of last event for each dyad
  • decay::Float64: Exponential decay rate (0 = no decay)
  • current_time::Any: Current time in the event sequence
source

State Updates

REM.update!Function
update!(state::NetworkState, event::Event)

Update the network state with a new event.

source
REM.reset!Function
reset!(state::NetworkState)

Reset the network state to empty.

source

State Query Functions

These functions query the current network state for various quantities.

Dyad Queries

REM.get_dyad_countFunction
get_dyad_count(state::NetworkState, sender::Int, receiver::Int) -> Float64

Get the weighted count of events from sender to receiver.

source
REM.get_undirected_countFunction
get_undirected_count(state::NetworkState, actor1::Int, actor2::Int) -> Float64

Get the weighted count of events between two actors (in either direction).

source
REM.has_edgeFunction
has_edge(state::NetworkState, sender::Int, receiver::Int) -> Bool

Check if there has been at least one event from sender to receiver.

source

Degree Queries

REM.get_out_degreeFunction
get_out_degree(state::NetworkState, actor::Int) -> Float64

Get the weighted out-degree of an actor.

source
REM.get_in_degreeFunction
get_in_degree(state::NetworkState, actor::Int) -> Float64

Get the weighted in-degree of an actor.

source

Neighbor Queries

REM.get_out_neighborsFunction
get_out_neighbors(state::NetworkState, actor::Int) -> Set{Int}

Get the set of actors to whom the given actor has sent events.

source
REM.get_in_neighborsFunction
get_in_neighbors(state::NetworkState, actor::Int) -> Set{Int}

Get the set of actors who have sent events to the given actor.

source

Time Utilities

Missing docstring.

Missing docstring for halflife_to_decay. Check Documenter's build log for details.

Missing docstring.

Missing docstring for decay_to_halflife. Check Documenter's build log for details.

Missing docstring.

Missing docstring for compute_decay_weight. Check Documenter's build log for details.