(self)
return node_centralities
Calculates the closeness centralities of all nodes.
        If the order of the higher-order network is larger than one 
        centralities calculated based on the higher-order 
        topology will automatically be projected back to first-order 
        nodes.
Calculates the closeness centralities of all nodes.
        If the order of the higher-order network is larger than one 
        centralities calculated based on the higher-order 
        topology will automatically be projected back to first-order 
        nodes.
Calculates the closeness centralities of all nodes . If the order of the higher - order network is larger than one centralities calculated based on the higher - order topology will automatically be projected back to first - order nodes .
def ClosenessCentrality(self):
        """ 
        Calculates the closeness centralities of all nodes.
        If the order of the higher-order network is larger than one 
        centralities calculated based on the higher-order 
        topology will automatically be projected back to first-order 
        nodes.
        """

        dist_first = self.getDistanceMatrixFirstOrder()
        node_centralities = _co.defaultdict( lambda: 0 )   
        
        Log.add('Calculating closeness centralities (k = ' + str(self.order) + ') ...', Severity.INFO)             

        # calculate closeness values
        for v1 in dist_first:
            for w1 in dist_first[v1]:
                if v1 != w1 and dist_first[v1][w1] < _np.inf:
                    node_centralities[v1] += 1.0 / dist_first[v1][w1]
        
        # assign centrality zero to nodes not occurring on higher-order shortest paths
        nodes = self.paths.getNodes()
        for v in nodes:
            node_centralities[v] += 0

        Log.add('finished.', Severity.INFO)

        return node_centralities
def ClosenessCentrality ( self ) : dist_first = self . getDistanceMatrixFirstOrder ( ) node_centralities = _co . defaultdict ( lambda : 0 ) Log . add ( 'Calculating closeness centralities (k = ' + str ( self . order ) + ') ...' , Severity . INFO ) # calculate closeness values for v1 in dist_first : for w1 in dist_first [ v1 ] : if v1 != w1 and dist_first [ v1 ] [ w1 ] < _np . inf : node_centralities [ v1 ] += 1.0 / dist_first [ v1 ] [ w1 ] # assign centrality zero to nodes not occurring on higher-order shortest paths nodes = self . paths . getNodes ( ) for v in nodes : node_centralities [ v ] += 0 Log . add ( 'finished.' , Severity . INFO ) return node_centralities