ChebConv Source Code

Hello DGL community,
i have recently started coding in school and am therefore a complete beginner. I recently discovered your library and am trying to understand the ChebNet layer. Maybe the question is stupid at this point, but I would like to understand it and I think someone here can definitely help me. In Line 37 of the ChebConv Source code you set

self.linear = nn.Linear(k * in_feats, out_feats, bias)

I am wondering why you multiply by k. In some literatures like e.g. (Graph convolutional networks: a comprehensive review, page 7) the expression is multiplied by k+1. Why is it necessary to multiply by k at this point at all?

From line 90-95 and 98-104 of the Source Code for ChebConv you write

            # X_1(f)
            if self._k > 1:
                h = unnLaplacian(X_0, D_invsqrt, graph)
                X_1 = - re_norm * h + X_0 * (re_norm - 1)       
                # Concatenate Xt and X_1
                Xt = th.cat((Xt, X_1), 1)                       
   
            # Xi(x), i = 2...k
            for _ in range(2, self._k):
                h = unnLaplacian(X_1, D_invsqrt, graph)
                X_i = - 2 * re_norm * h + X_1 * 2 * (re_norm - 1) - X_0        
                # Concatenate Xt and X_i
                Xt = th.cat((Xt, X_i), 1)                                       
                X_1, X_0 = X_i, X_1

If I choose for example lambda_max =1and k=3 then my results (by hand) do not match the results from the Chebyshev approximation. I guess this is because I don’t understand the torch.cat command in this context. When i change line 93 of the source Code to

X_1 = - re_norm * h * X_0 + X_0 * (re_norm - 1) 

and line 101 of the Source code to

X_i = - 2 * re_norm * h * X_1 + X_1 * 2 * (re_norm - 1) - X_0    

then i get the correct result for the approximation on paper. I still don’t understand how torch.cat corrects the calculation.
I thank you for any help and hope I am not stepping on anyone’s toes. Everyone starts small :).

John

I am wondering why you multiply by k. In some literatures like e.g. (Graph convolutional networks: a comprehensive review , page 7) the expression is multiplied by k+1. Why is it necessary to multiply by k at this point at all?

I have not read the review paper you referenced. However, self.linear = nn.Linear(k * in_feats, out_feats, bias) is used to initialize the learnable weights \theta at once in the original paper.

If you only read the review paper, I recommend reading the original paper first.