## 3 Dynamic Graph Neural Networks
### Dynamic Graph Neural Networks, Discrete and Continuous Case  
Temporal graphs can be represented as a stream of static graphs or vertex/edge events. The former is referred to as a Snapshot-based Temporal Graph, while the latter is known as an Event-based Temporal Graph. This work focuses on designing an algorithm based on Event-based Temporal Graphs, i.e., a continuous dynamic approach. Snapshot-based Temporal Graph (STG): Let \(t_{1}<t_{2}<...<t_{n}\) be an ordered set of timestamps in \(G_{\mathcal{T}}\). Let \(V_{j}:=\{(v,x_{v},t_{i},t_{f})\mid v\in V_{\mathcal{T}},t_{i}\leq t_{j}\leq t _{f}\}\), \(E_{j}:=\{(e,x_{e},t_{i},t_{f})\mid e\in E_{\mathcal{T}},t_{i}\leq t_{j}\leq t _{f}\}\) be the sets of vertices and edges that exist between an initial time \(t_{i}\) and a final time \(t_{f}\) and \(G_{j}=(V_{i},E_{i})\), \(l=1,2,...,n\) be the graph snapshots. A Snapshot-based Temporal Graph is the sequence  
\[G_{\mathcal{T}}^{S}=\{(G_{t},t_{l})\mid l=1,2,...,n\}. \tag{2}\]  
The literature indicates STGs are related to DTTGs because the snapshots are at periodic fixed time intervals. Another form of graph representation occurs when the data model a continuous process, i.e., a dynamic continuous temporal graph. However, this approach is better modeled as a stream of events, so it receives the name of an Event-Based Temporal Graph. Event-based Temporal Graph (ETG): Let \(G_{\mathcal{T}}\) be a temporal graph and \(\mathcal{E}\) one of the following events:  
* Vertex insertion \(\mathcal{E}_{\mathcal{V}}^{+}:=(v,t)\): There is an addition of the vertex \(v\) to \(G_{\mathcal{T}}\) at time \(t\). * Vertex deletion \(\mathcal{E}_{\mathcal{V}}^{-}:=(v,t)\): There is a removal of the vertex \(v\) from \(G_{\mathcal{T}}\) at time \(t\). * Edge insertion \(\mathcal{E}_{E}^{+}:=(e,t)\): There is an addition of the edge \(e\) to \(G_{\mathcal{T}}\) at time \(t\). * Edge deletion \(\mathcal{E}_{E}^{-}:=(e,t)\): There is a removal of the edge \(e\) from \(G_{\mathcal{T}}\) at time \(t\). An ETG of a temporal graph is a sequence of events  
\[G_{\mathcal{T}}^{\mathbb{E}}=\{\mathcal{E}|\mathcal{E}\in\{\mathcal{E}_{V}^{+ },\mathcal{E}_{V}^{-},\mathcal{E}_{E}^{+},\mathcal{E}_{E}^{-}\}\}. \tag{3}\]  
Message-Passing TGNN--MPTGNN: Let \(G_{\mathcal{T}}\) be a temporal graph with parameters \(V_{\mathcal{T}}\) and \(E_{\mathcal{T}}\). At each iteration of the MPTGNN, an embedding \(h_{v}^{k}(t)\) is updated with neighborhood information \(\mathcal{N}_{\mathcal{T}(v)}\). According to [24], the message passing can be expressed as  
\[h_{v}^{(k+1)}(t) =\text{UPDATE}^{k}\Big{(}h_{v}^{(k)}(t),\text{AGG}^{k}\Big{(}\{h_ {u}^{(k)}(t),\forall u\in\mathcal{N}_{\mathcal{T}(v)}\}\Big{)}\Big{)} \tag{4}\] \[=\text{UPDATE}^{k}\Big{(}h_{v}^{(k)}(t),m_{\mathcal{N}(u)}^{(k)}( t)\Big{)}, \tag{5}\]  
where UPDATE is a differentiable function (a neural network); AGG could be some permutation-invariant operation such as mean, max-pooling, sum, etc. ; \(m_{\mathcal{N}(u)}(t)\) is the message that aggregates temporal neighborhood information about the vertex \(n\) and \(\mathbf{h}_{u}^{(0)}(t)=s_{u}(t)\) is the state of \(v\) at time \(t\). The TGNN algorithm proposed uses the concept of memory as a set of vectors that summarizes the history of a vertex and is updated whenever an event occurs. Given a set of events \(\mathcal{E}\), the state of \(v\) is updated based on \(\mathcal{E}\) as  
\[\mathcal{M}_{v}(t) =\text{MEMAGG}\Big{(}\{(s_{u}(t),s_{v}(t),t-t_{v},\mathcal{E}_{ uv}(t))\mid(u,v,t)\in\mathcal{E}\}\Big{)} \tag{6}\] \[s_{v}(t^{+}) =\text{MEMUPDATE}\Big{(}s_{v}(t),\mathcal{M}_{v}(t)\Big{)}, \tag{7}\]  
where \(s_{v}(0)=x_{v}\).