-
Notifications
You must be signed in to change notification settings - Fork 63
Description
The result on SwedenGraph and SchemaGraph both have the same result on the between the id and label.
This source code should represent the top 10 node with the highest number of Betweenness Centrality, but on the source code given, there are no representing value of Betweeness Centrality.
It happen because the function in namesDict.setdefault(param1,param2), set the value default to param2 if the dic[param1] is none. Therefor on the code, the namesDict is never been set before (always have none value). So self.namesDict.setdefault(str(key),str[key]) will always return the str[key] (which is the value of the id)
These are the solution i found :
Change :
for key in map: output += "nodeID: %d centrality: %f\n" % (key, map[key]) index += 1 if (index <= 10): label = self.namesDict.setdefault(str(key),str[key]) topNodes += "\tnodeID: %d label: %s\n" % (key, label) return output, topNodes
To :
for key in map: output += "nodeID: %d centrality: %f\n" % (key, map[key]) index += 1 if (index <= 10): label = self.namesDict.setdefault(str(key), map[key]) topNodes += "\tnodeID: %d label: %s\n" % (key, label) return output, topNodes