Skip to content

Commit ca36ed3

Browse files
authored
Merge pull request #20 from aroragarima/master
errors corrected
2 parents 237f92f + 2bdf09e commit ca36ed3

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

21-network-analysis-in-python-(part-1)/02-important-nodes/02-compute-degree-distribution.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
Print the degrees.
1313
'''
1414
# Compute the degree of every node: degrees
15-
degrees = [len(T.neighbors(n)) for n in T.nodes()]
15+
degrees = [len(list(T.neighbors(n))) for n in T.nodes()]
1616

1717
# Print the degrees
1818
print(degrees)

21-network-analysis-in-python-(part-1)/02-important-nodes/03-degree-centrality-distribution.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@
2727

2828
# Plot a histogram of the degree distribution of the graph
2929
plt.figure()
30-
plt.hist([len(T.neighbors(n)) for n in T.nodes()])
30+
plt.hist([len(list(T.neighbors(n))) for n in T.nodes()])
3131
plt.show()
3232

3333
# Plot a scatter plot of the centrality distribution and the degree distribution
3434
plt.figure()
3535
plt.scatter(degrees, list(deg_cent.values()))
36-
plt.show()
36+
plt.show()

0 commit comments

Comments
 (0)