Skip to content

Commit 7349b48

Browse files
committed
remove the references to stdog in the examples
1 parent dfdb9a3 commit 7349b48

File tree

2 files changed

+13
-20
lines changed

2 files changed

+13
-20
lines changed

README.md

+6-8
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,19 @@ The Kernel Polynomial Method can estimate the spectral density of large sparse
1717
### Example
1818

1919
```python
20-
import igraph as ig
20+
import networkx as nx
2121
import numpy as np
2222

23-
N = 3000
24-
G = ig.Graph.Erdos_Renyi(N, 3/N)
23+
n = 3000
24+
g = nx.erdos_renyi_graph(n , 3/n)
25+
W = nx.adjacency_matrix(g)
2526

26-
W = np.array(G.get_adjacency().data, dtype=np.float64)
27-
vals = np.linalg.eigvalsh(W).real
27+
vals = np.linalg.eigvals(W.todense()).real
2828
```
2929

3030
```python
3131
from emate.hermitian import tfkpm
32-
from stdog.utils.misc import ig2sparse
3332

34-
W = ig2sparse(G)
3533

3634
num_moments = 40
3735
num_vecs = 40
@@ -54,7 +52,7 @@ from emate.hermitian import cupykpm
5452
num_moments = 40
5553
num_vecs = 40
5654
extra_points = 10
57-
ek, rho = cupykpm(W, num_moments, num_vecs, extra_points)
55+
ek, rho = cupykpm(W.tocsr(), num_moments, num_vecs, extra_points)
5856
```
5957

6058

docs/source/examples.rst

+7-12
Original file line numberDiff line numberDiff line change
@@ -14,26 +14,24 @@ trace estimator + kernel smoothing.
1414

1515
.. code-block:: python
1616
17-
import igraph as ig
17+
import networkx as nx
1818
import numpy as np
1919
20-
N = 3000
21-
G = ig.Graph.Erdos_Renyi(N, 3/N)
20+
n = 3000
21+
g = nx.erdos_renyi_graph(n , 3/n)
22+
W = nx.adjacency_matrix(g)
2223
23-
W = np.array(G.get_adjacency().data, dtype=np.float64)
24-
vals = np.linalg.eigvalsh(W).real
24+
vals = np.linalg.eigvals(W.todense()).real
2525
2626
.. code-block:: python
2727
28-
from emate.hermitian import pykpm
29-
from stdog.utils.misc import ig2sparse
28+
from emate.hermitian import tfkpm
3029
31-
W = ig2sparse(G)
3230
3331
num_moments = 300
3432
num_vecs = 200
3533
extra_points = 10
36-
ek, rho = pykpm(W, num_moments, num_vecs, extra_points)
34+
ek, rho = tfkpm(W, num_moments, num_vecs, extra_points)
3735
3836
.. code-block:: python
3937
@@ -87,11 +85,8 @@ Estrada Index
8785
8886
import scipy
8987
import scipy.sparse
90-
import igraph as ig
9188
import numpy as np
9289
93-
N = 3000
94-
G = ig.Graph.Erdos_Renyi(N, 3/N)
9590
9691
.. code-block:: python
9792

0 commit comments

Comments
 (0)