function g = commGSP_gft(A, signal, type) % Returns Graph Fourier Transform (GFT) of a signal on the graph A % INPUT: % A - (symmetric) matrix to decompose % signal - vector (length equal to size of A) representing graph signal % of size number_of_nodes x 1, or a set of signals organized in a matrix % of size number_of_nodes x number_of_signals % type - string equal to 'laplacian' for Laplacian-based GFT % or 'modularity' for modularity-based GFT; % if the GFT eigenvector matrix/basis is already available, then % instead of a string, type is equal to the eigenvector matrix U % OUTPUT % g - vector of spectral GFT coefficients having % the same length as input signal x if strcmp(type,'laplacian') || strcmp(type,'modularity') [U, ~] = commGSP_eig_implicit(A, type); else U=type; end g=U'*signal; end