(self)
return shortest_path_lengths
Calculates shortest path distances between all pairs of 
        nodes based on the observed shortest paths (and subpaths)
Calculates shortest path distances between all pairs of 
        nodes based on the observed shortest paths (and subpaths)
Calculates shortest path distances between all pairs of nodes based on the observed shortest paths ( and subpaths )
def getDistanceMatrix(self):
        """
        Calculates shortest path distances between all pairs of 
        nodes based on the observed shortest paths (and subpaths)
        """
        shortest_path_lengths = _co.defaultdict( lambda: _co.defaultdict( lambda: _np.inf ) )
        
        Log.add('Calculating distance matrix based on empirical paths ...', Severity.INFO)
        # Node: no need to initialize shortest_path_lengths[v][v] = 0
        # since paths of length zero are contained in self.paths

        for l in self.paths:
            for p in self.paths[l]:
                start = p[0]
                end = p[-1]
                if l < shortest_path_lengths[start][end]:
                    shortest_path_lengths[start][end] = l
        
        Log.add('finished.', Severity.INFO)

        return shortest_path_lengths
def getDistanceMatrix ( self ) : shortest_path_lengths = _co . defaultdict ( lambda : _co . defaultdict ( lambda : _np . inf ) ) Log . add ( 'Calculating distance matrix based on empirical paths ...' , Severity . INFO ) # Node: no need to initialize shortest_path_lengths[v][v] = 0 # since paths of length zero are contained in self.paths for l in self . paths : for p in self . paths [ l ] : start = p [ 0 ] end = p [ - 1 ] if l < shortest_path_lengths [ start ] [ end ] : shortest_path_lengths [ start ] [ end ] = l Log . add ( 'finished.' , Severity . INFO ) return shortest_path_lengths