[EDITED - thanks to the Ludovico Loreti's comment]
If I run the following code (.py file) from Visual Studio Code, i.e. by pressing the green triangular button "Run Python File in Terminal" at the top right corner of VSCode
from networkit import *
import networkit as nk
import matplotlib.pyplot as plt
g = generators.HyperbolicGenerator(1e3).generate()
bc = nk.centrality.Betweenness(g)
bc.run()
bc.ranking()[:10] # the 10 most central nodes
the expected result (i.e. the betweenness calculation) is NOT shown in the VSCode embedded Terminal.
Instead, if I run the same code directly from Terminal, using ipython3, the result comes out well.
Out[4]:
[(392, 625118.6896734448),
(875, 204886.97319625755),
(170, 121481.35921722073),
(621, 72627.46666666666),
(566, 71881.75991032101),
(37, 62046.49111887374),
(701, 53157.760291814484),
(988, 45316.922735729204),
(934, 42894.204329181564),
(657, 32147.666666666664)]
Why? What should I change in Visual Studio Code in order to see my results in its embedded Terminal?
[P.S.1]: If I add other commands to my code, such as
print(g.numberOfNodes(), g.numberOfEdges())
VSCode shows correctly the results in its embedded Terminal. Therefore, it looks like that (so far) only the betweenness-related results are not shown/displayed.
[P.S.2]: Just for information, if it can be useful, I have installed Visual Studio Code through snap (https://snapcraft.io/install/code/centos):
sudo yum install epel-release -y
sudo yum install snapd -y
sudo systemctl enable --now snapd.socket
sudo ln -s /var/lib/snapd/snap /snap
sudo snap install code --classic
and I run VSCode from Terminal by typing:
snap run code
The solution/explanation is provided in the networkit forum https://github.com/networkit/networkit/issues/788
Many thanks to avdgrinten!