Skip to content

Commit cb9a76e

Browse files
committed
Add numrefs
1 parent 59b93ae commit cb9a76e

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

lectures/networks.md

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -946,6 +946,16 @@ the graph.
946946
Consider the following simple example.
947947

948948
```{code-cell} ipython3
949+
---
950+
mystnb:
951+
figure:
952+
caption: "Sample Graph"
953+
name: sample_gph_1
954+
image:
955+
alt: sample_gph_1
956+
classes: shadow bg-primary
957+
width: 200px
958+
---
949959
G7 = nx.DiGraph()
950960
951961
G7.add_nodes_from(['1','2','3','4','5','6','7'])
@@ -1025,7 +1035,7 @@ plt.show()
10251035
Unfortunately, while in-degree and out-degree centrality are simple to
10261036
calculate, they are not always informative.
10271037

1028-
In *add numref*, an edge exists between almost every node,
1038+
In {numref}`financial_network`, an edge exists between almost every node,
10291039
so the in- or out-degree based centrality ranking fails to effectively separate the countries.
10301040

10311041
This can be seen in the above graph as well.
@@ -1129,10 +1139,10 @@ def eigenvector_centrality(A, k=40, authority=False):
11291139
return e / np.sum(e)
11301140
```
11311141

1132-
Let us compute eigenvector centrality for the graph generated in *add numref*.
1142+
Let us compute eigenvector centrality for the graph generated in {numref}`sample_gph_1`.
11331143

11341144
```{code-cell} ipython3
1135-
A = nx.to_numpy_array(G7) #compute adjacency matrix of graph
1145+
A = nx.to_numpy_array(G7) # compute adjacency matrix of graph
11361146
```
11371147

11381148
```{code-cell} ipython3
@@ -1146,7 +1156,7 @@ for i in range(n):
11461156
While nodes $2$ and $4$ had the highest in-degree centrality we can see that nodes $1$ and $2$ have the
11471157
highest eigenvector centrality.
11481158

1149-
Let's once again revisit the international credit network in *add numref*.
1159+
Let's once again revisit the international credit network in {numref}`financial_network`.
11501160

11511161
```{code-cell} ipython3
11521162
eig_central = eigenvector_centrality(Z)
@@ -1287,7 +1297,7 @@ Element-by-element, this is given by
12871297
We see $e_j$ will be high if many nodes with high authority rankings link to $j$.
12881298

12891299
The following figurenshows the authority-based eigenvector centrality ranking for the international
1290-
credit network shown in *add numref*.
1300+
credit network shown in {numref}`financial_network`.
12911301

12921302
```{code-cell} ipython3
12931303
ecentral_authority = eigenvector_centrality(Z, authority=True)

0 commit comments

Comments
 (0)