Answers.Body: <p>According to the definition of Graph Neural Networks <a href="https://tkipf.github.io/graph-convolutional-networks/" rel="nofollow noreferrer">taken from here</a> GCN perfroms an operation of the form:
  <span class="math-container">$$
  f (H^{(l)} ,A) = \sigma(\tilde{D}^{-1/2} \tilde{A} \tilde{D}^{-1/2} H^{(l)} W^{(l)})
  $$</span>
  Where <span class="math-container">$H^{(l)}$</span> is the input to GCN layer, <span class="math-container">$\tilde{A} = A + I$</span> is the adjacency matrix with self loops added and <span class="math-container">$\tilde{D}$</span> is a degree matrix, corresponding to the adjacency matrix <span class="math-container">$\tilde{A}$</span> (on the diagonals there are sums over the columns of <span class="math-container">$\tilde{A}$</span>).</p>
  <p>This definition is for matrix with <span class="math-container">$1$</span>, if there is an edge between <span class="math-container">$i$</span> and <span class="math-container">$j$</span>, and <span class="math-container">$0$</span> otherwise. For matrix of this form normalized Graph Laplacian <span class="math-container">$\tilde{D}^{-1/2} \tilde{A} \tilde{D}^{-1/2}$</span> is
  guaranteed to be positive semidefinite matrix.</p>
  <p>One can extend the definition for arbitrary values of <span class="math-container">$a_{ij} \in A$</span>. But there won't be guarantees, that graph Laplacian will be well-defined.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-09-05T16:54:47.563Z
Answers.LastActivityDate: 2021-09-05T16:54:47.563Z
Answers.UserDisplayName: spiridon_the_sun_rotator
Answers.Body: <p><a href="https://arxiv.org/pdf/1710.10903.pdf" rel="nofollow noreferrer">Graph attention network(GAN)</a> exactly perform the same thing you are referring to . In chebnet, graphsage we have a fixed adjacency matrix that is given to us. Now, in GAN the authors try to learn the adjacency matrix via self-attention mechanism.</p>
  <h2>Graph Attention Network:</h2>
  <p>Let, <span class="math-container">$K$</span> be the number of attention heads, <span class="math-container">$h^{l+1}_i$</span> is the feature vector of node <span class="math-container">$i$</span> at <span class="math-container">$l+1$</span> layer, <span class="math-container">$e^{l}_{ij}$</span> is the attention weight between two adjacence node <span class="math-container">$i$</span> and <span class="math-container">$j$</span> at layer <span class="math-container">$l$</span>.</p>
  <p><a href="https://i.sstatic.net/ESDAd.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/ESDAd.png" alt="enter image description here" /></a></p>
  <p>Then the update rule for graph attention network is as follows:
  <span class="math-container">\begin{align}
      h^{l+1} &amp;= \text{Concat}_{K=1}^{K}(\text{ELU}(\sum_{j \in \mathcal{N}_i} \underset{\text{scalar}}{e_{ij}^{K,l}} \underset{d \times d}{W_1^{K,l}} \underset{d \times 1}{h_j^l})) 
  \end{align}</span>
  where the <span class="math-container">$K$</span>-th head attention weight is defined as:</p>
  <p><span class="math-container">\begin{align}
  \underset{\text{scalar}}{e^{K,l}_{ij}} &amp;= \text{Softmax}_{\mathcal{N}_i}(\hat{e}^{K,l}_{ij}) \\
      \hat{e}^{K,l}_{ij} &amp;= \text{LeakyRelu}(W_{2}^{K,l} \text{Concat}(W_1^{K,l}h_i^l, W_1^{k,l}h_j^l))
  \end{align}</span></p>
  <p>Notice that in GAN we are learning anisotropic filters(treats each direction differently, since attention weight is different for each direaction) which are more powerful than isotropic filters(treat all the directions). For this reason, GAN are more powerful than isotropic graph convolutional network(GCN).</p>
  <h2>Spatio Temporal GCN(ST-GCN)</h2>
  <p>In stgcn, we first perform graph convolution(vanilla GCN or GAN) on the spatial domain then apply temporal convolution along the temporal direction. Here is an example of STGCN for human activity recognition here blurred skeleton indicate time axis.</p>
  <p><a href="https://i.sstatic.net/8yJY7.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/8yJY7.png" alt="enter image description here" /></a></p>
  <p>In the aforementioned figure, color coding indicates attention weight.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-09-05T20:48:30.193Z
Answers.LastActivityDate: 2021-09-05T20:48:30.193Z
Answers.UserDisplayName: Swakshar Deb
Body: <p>I'm researching spatio-temporal forecasting utilising GCN as a side project, and I am wondering if I can extend it by using a graph with weighted edges instead of a simple adjacency matrix with 1's and 0's denoting connections between nodes.</p>
  <p>I've simply created a similarity measure and have replaced the 1's and 0's in the adjacency with it.</p>
  <p>For example, let's take this adjacency matrix</p>
  <p><span class="math-container">$$A=
  \begin{bmatrix}
  0 &amp; 1 &amp; 0 \\
  1 &amp; 0 &amp; 1 \\
  0 &amp; 1 &amp; 0
  \end{bmatrix}
  $$</span></p>
  <p>It would be replaced with the following weighted adjacency matrix</p>
  <p><span class="math-container">$$
  A'=
  \begin{bmatrix}
  0 &amp; 0.8 &amp; 0 \\
  0.8 &amp; 0 &amp; 0.3 \\
  0 &amp; 0.3 &amp; 0
  \end{bmatrix}
  $$</span></p>
  <p>As I am new to graph NN's, I am wondering whether my intuition checks out. If two nodes have similar time-series, then the weight of the edge between them should be approximately 1, right? If the convolution is performed based on my current weights, will this be incorporated into the learning?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-09-03T18:48:23.277Z
Comments.Text: I think what you are referring is graph attention network https://arxiv.org/pdf/1710.10903.pdf
Comments.UserDisplayName: Swakshar Deb
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-09-03T18:51:34.570Z
Comments.Text: "If two nodes have similar time-series then the weight of the edge between them should be ~ 1 right?" I am not sure about what you are referring here, why it should be 1? Normally the adjacency matrix is already given to you.
Comments.UserDisplayName: Swakshar Deb
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-09-03T18:53:05.693Z
Comments.Text: "If the convolution is performed based on my current weights, will this be incorporated into the learning?" Convolution is not performed on the current weights(assuming vanilla GCN), node features are updated.
Comments.UserDisplayName: Swakshar Deb
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-09-04T06:37:23.107Z
Comments.Text: @SwaksharDeb Thanks for that link.  I hope to see more of these fundamental questions!
Comments.UserDisplayName: DukeZhou
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-09-04T08:47:13.880Z
Comments.Text: @SwaksharDeb thanks so much. GAT seems like something I could be interested in too. Maybe I'm not clear with my question. Adjacency matrix with 1's simply denote a connection between two nodes. To model the strength of this connection between nodes could we use a number other than [1] to connect two nodes?
Comments.UserDisplayName: richieeDS
Tags: <deep-learning><geometric-deep-learning><graph-neural-networks><graphs>
Title: Can I extend Graph Convolutional Networks to graphs with weighted edges?
UserDisplayName: richieeDS
ThreadText: # Can I extend Graph Convolutional Networks to graphs with weighted edges?
  
  (Asked by: username_0 on 2021-09-03)
  
  I'm researching spatio-temporal forecasting utilising GCN as a side project, and I am wondering if I can extend it by using a graph with weighted edges instead of a simple adjacency matrix with 1's and 0's denoting connections between nodes.
  
  I've simply created a similarity measure and have replaced the 1's and 0's in the adjacency with it.
  
  For example, let's take this adjacency matrix
  
  $$A=
  \begin{bmatrix}
  0 & 1 & 0 \\
  1 & 0 & 1 \\
  0 & 1 & 0
  \end{bmatrix}
  $$
  
  It would be replaced with the following weighted adjacency matrix
  
  $$
  A'=
  \begin{bmatrix}
  0 & 0.8 & 0 \\
  0.8 & 0 & 0.3 \\
  0 & 0.3 & 0
  \end{bmatrix}
  $$
  
  As I am new to graph NN's, I am wondering whether my intuition checks out. If two nodes have similar time-series, then the weight of the edge between them should be approximately 1, right? If the convolution is performed based on my current weights, will this be incorporated into the learning?
  
  **Tags:** deep-learning, geometric-deep-learning, graph-neural-networks, graphs
  > **Comments:**
  > **username_1**: I think what you are referring is graph attention network https://arxiv.org/pdf/1710.10903.pdf  
  > **username_1**: "If two nodes have similar time-series then the weight of the edge between them should be ~ 1 right?" I am not sure about what you are referring here, why it should be 1? Normally the adjacency matrix is already given to you.  
  > **username_1**: "If the convolution is performed based on my current weights, will this be incorporated into the learning?" Convolution is not performed on the current weights(assuming vanilla GCN), node features are updated.  
  > **username_2**: @SwaksharDeb Thanks for that link.  I hope to see more of these fundamental questions!  
  > **username_0**: @SwaksharDeb thanks so much. GAT seems like something I could be interested in too. Maybe I'm not clear with my question. Adjacency matrix with 1's simply denote a connection between two nodes. To model the strength of this connection between nodes could we use a number other than [1] to connect two nodes?  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_3 on 2021-09-05. Score: 0
  
  According to the definition of Graph Neural Networks [taken from here](https://tkipf.github.io/graph-convolutional-networks/) GCN perfroms an operation of the form:
  $$
  f (H^{(l)} ,A) = \sigma(\tilde{D}^{-1/2} \tilde{A} \tilde{D}^{-1/2} H^{(l)} W^{(l)})
  $$
  Where $H^{(l)}$ is the input to GCN layer, $\tilde{A} = A + I$ is the adjacency matrix with self loops added and $\tilde{D}$ is a degree matrix, corresponding to the adjacency matrix $\tilde{A}$ (on the diagonals there are sums over the columns of $\tilde{A}$).
  
  This definition is for matrix with $1$, if there is an edge between $i$ and $j$, and $0$ otherwise. For matrix of this form normalized Graph Laplacian $\tilde{D}^{-1/2} \tilde{A} \tilde{D}^{-1/2}$ is
  guaranteed to be positive semidefinite matrix.
  
  One can extend the definition for arbitrary values of $a\_{ij} \in A$. But there won't be guarantees, that graph Laplacian will be well-defined.
  
  
  ---
  
  ### Answer by username_1 on 2021-09-05. Score: -1
  
  [Graph attention network(GAN)](https://arxiv.org/pdf/1710.10903.pdf) exactly perform the same thing you are referring to . In chebnet, graphsage we have a fixed adjacency matrix that is given to us. Now, in GAN the authors try to learn the adjacency matrix via self-attention mechanism.
  
  ## Graph Attention Network:
  
  Let, $K$ be the number of attention heads, $h^{l+1}\_i$ is the feature vector of node $i$ at $l+1$ layer, $e^{l}\_{ij}$ is the attention weight between two adjacence node $i$ and $j$ at layer $l$.
  
  [![enter image description here](https://i.sstatic.net/ESDAd.png)](https://i.sstatic.net/ESDAd.png)
  
  Then the update rule for graph attention network is as follows:
  \begin{align}
  h^{l+1} &= \text{Concat}\_{K=1}^{K}(\text{ELU}(\sum\_{j \in \mathcal{N}\_i} \underset{\text{scalar}}{e\_{ij}^{K,l}} \underset{d \times d}{W\_1^{K,l}} \underset{d \times 1}{h\_j^l}))
  \end{align}
  where the $K$-th head attention weight is defined as:
  
  \begin{align}
  \underset{\text{scalar}}{e^{K,l}\_{ij}} &= \text{Softmax}\_{\mathcal{N}\_i}(\hat{e}^{K,l}\_{ij}) \\
  \hat{e}^{K,l}\_{ij} &= \text{LeakyRelu}(W\_{2}^{K,l} \text{Concat}(W\_1^{K,l}h\_i^l, W\_1^{k,l}h\_j^l))
  \end{align}
  
  Notice that in GAN we are learning anisotropic filters(treats each direction differently, since attention weight is different for each direaction) which are more powerful than isotropic filters(treat all the directions). For this reason, GAN are more powerful than isotropic graph convolutional network(GCN).
  
  ## Spatio Temporal GCN(ST-GCN)
  
  In stgcn, we first perform graph convolution(vanilla GCN or GAN) on the spatial domain then apply temporal convolution along the temporal direction. Here is an example of STGCN for human activity recognition here blurred skeleton indicate time axis.
  
  [![enter image description here](https://i.sstatic.net/8yJY7.png)](https://i.sstatic.net/8yJY7.png)
  
  In the aforementioned figure, color coding indicates attention weight.
  
  
  ---
  
  