def computePLDistribution(gr, interval): clsv = algorithms.importance.closeness_centrality.getClosenessVectors(gr) cls = [] for v in clsv.values(): cls.extend(v) print min(cls) return distribution.computeDistribution(cls, 0, max(cls), interval, len(cls))
def computeNodeBetweennessDistribution(gr): numnodes = gr.getNumNodes() nbs = algorithms.importance.betweenness_centrality.getNodeBetnSeq(gr) return distribution.computeDistribution(nbs, 0, numnodes * (numnodes - 1), numnodes)
def computeEdgeBetweennessEntropy(gr): numedges = gr.getNumEdges() numnodes = gr.getNumNodes() ebs = algorithms.importance.betweenness_centrality.getEdgeBetnSeq(gr) ebd = distribution.computeDistribution(ebs, 0, numnodes * (numnodes - 1), numedges) return entropy.computeEntropy(ebd)
def computeEdgeConnectivityDistribution(gr): econ = robustness.robustness_measures.getConnSeq(gr) return distribution.computeDistribution(econ, 0, max(econ), len(econ))
def computeOutdegreeDistributionEntropy(gr): numnodes = gr.getNumNodes() ds = algorithms.importance.degree_centrality.getOutDegSeq(gr) dd = distribution.computeDistribution(ds, 0, numnodes - 1, numnodes) return entropy.computeEntropy(dd)
def computeDegreeDistribution(gr): numnodes = gr.getNumNodes() ds = algorithms.importance.degree_centrality.getDegSeq(gr) return distribution.computeDistribution(ds, 0, numnodes - 1, numnodes)