GetHits¶
-
GetHits
(MaxIter=20)¶
A graph method that returns the Hubs and Authorities score of every node.
Parameters
- (optional) MaxIter: int
Maximum number of iterations.
Return value:
- NIdHubH:
TIntFltH
, a hash table of int keys and float values The keys are the node ids and the values are the hub scores as outputed by the HITS algorithm.
- NIdHubH:
- NIdAuthH:
TIntFltH
, a hash table of int keys and float values The keys are the node ids and the values are the authority scores as outputed by the HITS algorithm.
- NIdAuthH:
The following example shows how to calculate Hub and Authority scores for nodes in
TNGraph
, TUNGraph
, and TNEANet
:
import snap
Graph = snap.GenRndGnm(snap.TNGraph, 100, 1000)
NIdHubH, NIdAuthH = Graph.GetHits()
for item in NIdHubH:
print(item, NIdHubH[item])
for item in NIdAuthH:
print(item, NIdAuthH[item])
UGraph = snap.GenRndGnm(snap.TUNGraph, 100, 1000)
NIdHubH, NIdAuthH = UGraph.GetHits()
for item in NIdHubH:
print(item, NIdHubH[item])
for item in NIdAuthH:
print(item, NIdAuthH[item])
Network = snap.GenRndGnm(snap.TNEANet, 100, 1000)
NIdHubH, NIdAuthH = Network.GetHits()
for item in NIdHubH:
print(item, NIdHubH[item])
for item in NIdAuthH:
print(item, NIdAuthH[item])