Some mistakes in colab 1
Closed this issue · 3 comments
AngusMonroe commented
- For Q4, networkx closeness centrality returns the normalized closeness directly, which is different from the raw (unnormalized) one that we learned in the lecture. You should add
closeness = closeness * (G.number_of_nodes() - 1)
in your code. - For Q6, you directly used
edge_1
inis_neg_edge()
, which causes your outputs to be wrong.
hdvvip commented
Thanks Angus for the comment,
- Following the equation in Q4, the calculation should be
raw closeness centrality(node) = 1 / sum(distance from node to all other nodes)
https://neo4j.com/docs/graph-data-science/current/algorithms/closeness-centrality/
Last version, I think the implement version by networkX is better so I just use the normalized version by NetworkX
In the new commit, I added the raw closeness centrality calculation following the equation in Q4.
- You're right. Thank you so much!
SLKyrim commented
For Q3, I think r0 should be updated with the r values of the neighbors of node 0, not r0 itself.
hdvvip commented
Thank you!
I just fix that in the new commit.