Week 8
Notation
In Problems 2 and 3, let \(G\) be a weighted undirected graph on \(n\) vertices with no isolated vertices,such that it has symmetric weights \(w_{ij}\geq0\) and no self-loops (\(w_{ii}=0\)). Moreover, to standardize some notation:
- \(\bfW=(w_{ij})\): the weight matrix.
- \(d_i=\sum_j w_{ij}\): the degree of vertex \(i\).
- \(\bfD=\operatorname{diag}(d_1,\ldots,d_n)\): the degree matrix.
- \(\bfL=\bfD-\bfW\): the graph Laplacian.
- \(V=\sum_{i=1}^n d_i\): the total degree.
- \(\bfY\in\Rbb^{n\times m}\): an embedding in \(\Rbb^m\). Its \(i\)th row is \(\bfy_i^\top\), where \(\bfy_i\) is the point assigned to vertex \(i\). Its columns are \(\bfy^{(1)},\ldots,\bfy^{(m)}\).
Problem 1
Work through the notebook Spectral Embeddings (live). Again, this will not be on the quiz.
Problem 2
In Lecture 17 we measured how far apart an embedding places neighbours by its energy \[ E(\bfY)=\frac12\sum_{i,j=1}^nw_{ij}\|\bfy_i-\bfy_j\|_2^2, \] and minimized it subject to \(\bfY^\top\bfD\mathbf{1}=\mathbf{0}\) and \(\bfY^\top\bfD\bfY=\bfI_m\).
- Show that \(E(\bfY)=\operatorname{tr}(\bfY^\top\bfL\bfY)\). Start from \(\|\bfy_i-\bfy_j\|_2^2=\sum_{c=1}^m(Y_{ic}-Y_{jc})^2\) and use the Laplacian quadratic form on each column.
- Let \(\bfQ\in\Rbb^{m\times m}\) be orthogonal. Show that row \(i\) of \(\bfY\bfQ\) is the point \(\bfQ^\top\bfy_i\), and use this to show \(E(\bfY\bfQ)=E(\bfY)\) directly from the definition of \(E\).
- Show \(E(\bfY\bfQ)=E(\bfY)\) again, this time from part 1 and the cyclic property of the trace.
- Show that if \(\bfY\) satisfies both constraints, then so does \(\bfY\bfQ\). Conclude that the Laplacian eigenmap is only the smoothest embedding up to a rotation or reflection of \(\Rbb^m\).
- Swap the order of summation: \[ E(\bfY)=\sum_{c=1}^m\frac12\sum_{i,j=1}^nw_{ij}(Y_{ic}-Y_{jc})^2=\sum_{c=1}^m\bfy^{(c)\top}\bfL\bfy^{(c)}, \] by the quadratic form applied to the column \(\bfy^{(c)}\). The \((c,c)\) entry of \(\bfY^\top\bfL\bfY\) is \(\bfy^{(c)\top}\bfL\bfy^{(c)}\), so the sum is the trace. The factor \(\frac12\) is there because the sum runs over ordered pairs, so each edge \(\{i,j\}\) appears twice, as \((i,j)\) and \((j,i)\); the terms with \(i=j\) are zero.
- Row \(i\) of \(\bfY\bfQ\) is \(\bfy_i^\top\bfQ=(\bfQ^\top\bfy_i)^\top\). Since \(\bfQ\bfQ^\top=\bfI\), \(\|\bfQ^\top\bfu\|_2^2=\bfu^\top\bfQ\bfQ^\top\bfu=\|\bfu\|_2^2\) for every \(\bfu\), so \(\|\bfQ^\top\bfy_i-\bfQ^\top\bfy_j\|_2=\|\bfy_i-\bfy_j\|_2\). Every term of the sum is unchanged: rotating or reflecting the picture does not move any point closer to or farther from another.
- \(\operatorname{tr}\big((\bfY\bfQ)^\top\bfL\bfY\bfQ\big)=\operatorname{tr}(\bfQ^\top\bfY^\top\bfL\bfY\bfQ)=\operatorname{tr}(\bfY^\top\bfL\bfY\bfQ\bfQ^\top)=\operatorname{tr}(\bfY^\top\bfL\bfY)\).
- \((\bfY\bfQ)^\top\bfD\mathbf{1}=\bfQ^\top(\bfY^\top\bfD\mathbf{1})=\mathbf{0}\) and \((\bfY\bfQ)^\top\bfD(\bfY\bfQ)=\bfQ^\top\bfI_m\bfQ=\bfI_m\). So if \(\bfY\) attains the minimum energy \(\lambda_2+\cdots+\lambda_{m+1}\) of the smoothest embedding, so does \(\bfY\bfQ\), and the theorem cannot single out one of them.
Problem 3
Suppose that the embedding satisfies \[ \bfY^\top\bfD\mathbf{1}=\mathbf{0}, \qquad \bfY^\top\bfD\bfY=\bfI_m. \]
- Expand the squared distances and use both constraints to show that \[ \frac12\sum_{i,j=1}^n d_i d_j\|\bfy_i-\bfy_j\|_2^2=mV. \] Hint: Use the outer product form of matrix products to analyze \(\bfY^\top\bfD \bfY\) (see HW2) and then take the trace of both sides.
- Now, suppose we obtain the minimizing embedding per \(E(Y)\) that satisfies both constraints above. Explain how minimizing the embedding energy can pull neighbours together without collapsing the entire embedding. Does the above identity require every pair of distinct vertices to stay apart?
- Expanding the square, \(\|\bfy_i-\bfy_j\|_2^2=\|\bfy_i\|_2^2+\|\bfy_j\|_2^2-2\bfy_i^\top\bfy_j\), splits the sum into three pieces: \[ \frac12\sum_{i,j}d_i d_j\|\bfy_i-\bfy_j\|_2^2 =\underbrace{\frac12\sum_{i,j}d_i d_j\|\bfy_i\|_2^2}_{(a)} +\underbrace{\frac12\sum_{i,j}d_i d_j\|\bfy_j\|_2^2}_{(b)} -\underbrace{\sum_{i,j}d_i d_j\,\bfy_i^\top\bfy_j}_{(c)}. \] In \((a)\) the summand depends on \(j\) only through \(d_j\), so the sum over \(j\) factors out as \(\sum_j d_j=V\): \[ (a)=\frac12\Big(\sum_j d_j\Big)\Big(\sum_i d_i\|\bfy_i\|_2^2\Big)=\frac V2\sum_i d_i\|\bfy_i\|_2^2. \] Swapping the names \(i\) and \(j\) turns \((b)\) into \((a)\), so \((b)=(a)\), and together they give \(V\sum_i d_i\|\bfy_i\|_2^2\). In \((c)\) the double sum factors as a product of two single sums, because the inner product is bilinear: \[ (c)=\Big(\sum_i d_i\bfy_i\Big)^\top\Big(\sum_j d_j\bfy_j\Big)=\Big\|\sum_i d_i\bfy_i\Big\|_2^2. \] Now we use the constraints, writing them in terms of the rows \(\bfy_i\). Since \(\bfY^\top=[\bfy_1\ \cdots\ \bfy_n]\) and \(\bfD\mathbf{1}=(d_1,\ldots,d_n)^\top\), the first constraint says \(\bfY^\top\bfD\mathbf{1}=\sum_i d_i\bfy_i=\mathbf{0}\), so \((c)=0\). Similarly \(\bfY^\top\bfD\bfY=\sum_i d_i\bfy_i\bfy_i^\top\), and taking the trace of the second constraint, using \(\operatorname{tr}(\bfy_i\bfy_i^\top)=\|\bfy_i\|_2^2\), gives \[ \sum_i d_i\|\bfy_i\|_2^2=\operatorname{tr}(\bfY^\top\bfD\bfY)=\operatorname{tr}(\bfI_m)=m. \] Putting the pieces together, the sum is \(V\cdot m-0=mV\).
- The constraints fix the total degree-weighted spread over all pairs of vertices, while the energy penalizes distances between neighbours. If some pairwise distances shrink, others must grow to keep this total fixed, so the entire embedding cannot collapse to a point. The identity does not give a positive lower bound on each individual distance: some distinct vertices can occupy the same point, provided other pairs supply the required spread.
Problem 4
Read the example Unshredding an Image with One Eigenvector first. Here is the ideal case. Suppose that, with the columns (or rows, however it was shredded) in their original order \(0,1,\ldots,n-1\), the nearest-neighbour graph is exactly the path. That is, an edge of weight \(1\) between \(j\) and \(j+1\) for each \(j<n-1\), and no others.
You may use that the second eigenvalue \(\lambda_2\) of its Laplacian \(\bfL\) has multiplicity one, with eigenvector \[ u_j=\cos\big(\pi(j+\tfrac12)/n\big),\qquad j=0,\ldots,n-1. \] Shuffling moves column/row \(j\) to position \(\sigma(j)\), for a permutation \(\sigma\) we do not know. This relabels vertex \(j\) as \(\sigma(j)\), so the shuffled graph has weight matrix \(\bfW'=\bfP\bfW\bfP^\top\), where \(\bfP\bfe_j=\bfe_{\sigma(j)}\). For any vector \(\bfv\), the entry of \(\bfP\bfv\) at vertex \(\sigma(j)\) is \(v_j\).
Show that the Laplacian of the shuffled graph is \(\bfL'=\bfP\bfL\bfP^\top\), and that \(\bfP\bfu\) is an eigenvector of \(\bfL'\) for \(\lambda_2\). Hint: \(\bfP^\top\mathbf{1}=\mathbf{1}\), and \(\bfP^\top\bfP=\bfI\). Moreover, recall that for any arbitrary matrix \(\bfC\), \(\bfP \bfC\) permutes the rows of \(\bfC\) and \(\bfC \bfP^\top\) permutes the columns of \(\bfC\).
Show that \(u_0>u_1>\cdots>u_{n-1}\). Then explain why, whatever \(\sigma\) is, the vector \(\bfP\bfu\) gives the strip that started at position \(j\) the number \(u_j\).
Explain why sorting the shuffled strips by their numbers in \(\bfP\bfu\), largest first, puts them back in their original order, even though we never learn \(\sigma\). Why might the restored picture come out as its mirror image?
Here is a picture whose graph is not a path: two copies of Jumbo, side by side, cut into columns. Column \(j\) of the left copy is identical to column \(j\) of the right copy, so besides the path (grey), the graph joins \(j\) and \(j+6\) for \(j=0,\ldots,5\) (orange, dashed). Each vertex is colored by a Fiedler vector of this graph, which is again unique up to sign.
Which assumption above fails for this graph? Using the colors, explain why sorting by this Fiedler vector does not put the strips back in order.
The degrees are \(\bfd'=\bfW'\mathbf{1}=\bfP\bfW\bfP^\top\mathbf{1}=\bfP\bfW\mathbf{1}=\bfP\bfd\): vertex \(\sigma(j)\) has the degree vertex \(j\) had. So \(\bfD'=\bfP\bfD\bfP^\top\) and \(\bfL'=\bfD'-\bfW'=\bfP\bfL\bfP^\top\). Then \(\bfL'\bfP\bfu=\bfP\bfL\bfP^\top\bfP\bfu=\bfP\bfL\bfu=\lambda_2\bfP\bfu\). In words: relabelling the vertices relabels the entries of the eigenvectors in the same way. (\(\bfL'\) has the same eigenvalues as \(\bfL\), so \(\lambda_2\) still has multiplicity one, and every Fiedler vector of the shuffled graph is \(c\,\bfP\bfu\) for some \(c\neq0\).)
The angles \(\pi(j+\frac12)/n\) increase with \(j\) and lie in \((0,\pi)\), where \(\cos\) is strictly decreasing, so \(u_0>u_1>\cdots>u_{n-1}\). The strip that started at position \(j\) now sits at position \(\sigma(j)\), and the entry of \(\bfP\bfu\) at position \(\sigma(j)\) is \(u_j\). So each strip carries its own number \(u_j\) with it, wherever the shuffle puts it.
By part 2, the strip with the largest number is the one that started at position \(0\), the next largest is the one that started at position \(1\), and so on. So sorting by the numbers, largest first, lists the strips in their original order. We only used the numbers, and \(\bfP\bfu\) is computed from the shuffled graph \(\bfW'\) alone, so we never needed \(\sigma\).
An eigensolver returns some Fiedler vector \(c\,\bfP\bfu\) of \(\bfL'\), and it may have \(c<0\). Then every number changes sign, sorting largest first lists the strips in the reverse order, and the picture comes out flipped. No method could do better: the picture and its mirror image have exactly the same strips, so the same shuffled input could have come from either.
The graph is not a path: it has the extra edges \(\{j,j+6\}\). A Fiedler vector changes little across every edge, including the orange ones, so it gives the identical columns \(j\) and \(j+6\) similar values. That forces it to go down and back up: from the colors, it decreases from \(0\) to \(4\), increases from \(4\) to \(7\), and decreases again to \(11\), so each column of the right copy gets nearly the number of its twin in the left copy. It is not monotone along the original order, which is what part 3 needed. Sorting it largest first gives \(0,1,7,6,2,8,3,9,5,4,10,11\), which interleaves the strips of the two copies.