In [1]:
from networkit import *
In [2]:
# we find the k nodes with highest closeness in a graph
G = readGraph("input/PGPgiantcompo.graph", Format.METIS)
In [3]:
k = 10
In [12]:
# The last two parameters indicate which heuristics we want to use.
# We recommend using True, False for complex networks and True, True for street networks
topk = centrality.TopCloseness(G, k, True, False)
%time topk.run()
Out[12]:
In [8]:
cc = centrality.Closeness(G)
%time cc.run()
Out[8]:
In [13]:
topk.topkNodesList()
Out[13]:
In [14]:
cc.ranking()[:k]
Out[14]:
In [ ]: