Types API Reference
This page documents the core data types in REM.jl.
Events
Event
REM.Event — Type
Event{T}Represents a single relational event (directed interaction between actors).
Fields
sender::Int: ID of the event sender/sourcereceiver::Int: ID of the event receiver/targettime::T: Timestamp of the eventeventtype::Symbol: Type/category of the event (default: :event)weight::Float64: Weight/magnitude of the event (default: 1.0)
EventSequence
REM.EventSequence — Type
EventSequence{T}A sequence of relational events, sorted by time.
Fields
events::Vector{Event{T}}: Vector of events sorted by timeactors::Set{Int}: Set of all actor IDsn_actors::Int: Number of unique actorseventtypes::Set{Symbol}: Set of all event types
Actor Data
ActorSet
REM.ActorSet — Type
ActorSetRepresents a set of actors with optional ID-to-name mapping.
NodeAttribute
REM.NodeAttribute — Type
NodeAttribute{T}Stores an attribute value for each actor.
Fields
name::Symbol: Name of the attributevalues::Dict{Int, T}: Mapping from actor ID to attribute valuedefault::T: Default value for actors not in the dict
RiskSet
REM.RiskSet — Type
RiskSetRepresents 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 sequencepotential_senders::Vector{Int}: Actors who could be senderspotential_receivers::Vector{Int}: Actors who could be receiversexclude_self_loops::Bool: Whether to exclude self-loops from risk set
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.NetworkState — Type
NetworkStateTracks 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 actorsdyad_counts::Dict{Tuple{Int,Int}, Float64}: Weighted count of events for each directed dyadundirected_counts::Dict{Tuple{Int,Int}, Float64}: Weighted count for undirected dyads (min,max sorted)out_degree::Dict{Int, Float64}: Weighted out-degree for each actorin_degree::Dict{Int, Float64}: Weighted in-degree for each actorlast_event_time::Dict{Tuple{Int,Int}, Any}: Time of last event for each dyaddecay::Float64: Exponential decay rate (0 = no decay)current_time::Any: Current time in the event sequence
State Updates
REM.update! — Function
update!(state::NetworkState, event::Event)Update the network state with a new event.
REM.reset! — Function
reset!(state::NetworkState)Reset the network state to empty.
State Query Functions
These functions query the current network state for various quantities.
Dyad Queries
REM.get_dyad_count — Function
get_dyad_count(state::NetworkState, sender::Int, receiver::Int) -> Float64Get the weighted count of events from sender to receiver.
REM.get_undirected_count — Function
get_undirected_count(state::NetworkState, actor1::Int, actor2::Int) -> Float64Get the weighted count of events between two actors (in either direction).
REM.has_edge — Function
has_edge(state::NetworkState, sender::Int, receiver::Int) -> BoolCheck if there has been at least one event from sender to receiver.
Degree Queries
REM.get_out_degree — Function
get_out_degree(state::NetworkState, actor::Int) -> Float64Get the weighted out-degree of an actor.
REM.get_in_degree — Function
get_in_degree(state::NetworkState, actor::Int) -> Float64Get the weighted in-degree of an actor.
Neighbor Queries
REM.get_out_neighbors — Function
get_out_neighbors(state::NetworkState, actor::Int) -> Set{Int}Get the set of actors to whom the given actor has sent events.
REM.get_in_neighbors — Function
get_in_neighbors(state::NetworkState, actor::Int) -> Set{Int}Get the set of actors who have sent events to the given actor.
Time Utilities
Missing docstring for halflife_to_decay. Check Documenter's build log for details.