Skip to content

Commit

Permalink
doc: eigenvalue concentration example
Browse files Browse the repository at this point in the history
  • Loading branch information
mdeff committed Mar 28, 2019
1 parent 2798f99 commit 5044bd3
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions examples/eigenvalue_concentration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
r"""
Concentration of the eigenvalues
================================
The eigenvalues of the graph Laplacian concentrates to the same value as the
graph becomes full.
"""

from matplotlib import pyplot as plt
import pygsp as pg

n_neighbors = [1, 2, 5, 8]
fig, axes = plt.subplots(4, len(n_neighbors), figsize=(15, 10))

for k, ax in zip(n_neighbors, axes.T):
graph = pg.graphs.Ring(17, k=k)
graph.compute_fourier_basis()
graph.plot(graph.U[:, 1], ax=ax[0])
ax[0].axis('equal')
ax[1].spy(graph.W)
ax[2].plot(graph.e, '.')
ax[2].set_title('k={}'.format(k))
graph.set_coordinates('line1D')
graph.plot(graph.U[:, :4], ax=ax[3], title='')

fig.tight_layout()

0 comments on commit 5044bd3

Please sign in to comment.