diff options
author | Ross Barnowski <rossbar@berkeley.edu> | 2022-10-19 19:56:56 -0700 |
---|---|---|
committer | Jarrod Millman <jarrod.millman@gmail.com> | 2022-11-01 10:27:46 -0700 |
commit | 5361ef6f06d7f05672b94a8d7912f2c9cc4729af (patch) | |
tree | efdf010ea9cd5b617ccf59eb26b74b9b012a3ab0 | |
parent | 5f3b11aafa93690ebfac7cd227ca4633430000ed (diff) | |
download | networkx-5361ef6f06d7f05672b94a8d7912f2c9cc4729af.tar.gz |
Replace .A call with .toarray for sparse array in example. (#6106)
-rw-r--r-- | examples/drawing/plot_eigenvalues.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/examples/drawing/plot_eigenvalues.py b/examples/drawing/plot_eigenvalues.py index b0df67ae..67322cfd 100644 --- a/examples/drawing/plot_eigenvalues.py +++ b/examples/drawing/plot_eigenvalues.py @@ -14,7 +14,7 @@ m = 5000 # 5000 edges G = nx.gnm_random_graph(n, m, seed=5040) # Seed for reproducibility L = nx.normalized_laplacian_matrix(G) -e = numpy.linalg.eigvals(L.A) +e = numpy.linalg.eigvals(L.toarray()) print("Largest eigenvalue:", max(e)) print("Smallest eigenvalue:", min(e)) plt.hist(e, bins=100) # histogram with 100 bins |