(self)
return visitation_probabilities
Calculates the probabilities that randomly chosen paths
        pass through nodes. If 5 out of 100 paths (of any length) contain 
        node v, it will be assigned a value of 0.05. This measure can be 
        interpreted as path-based ground truth for the notion of importance 
        captured by PageRank applied to a graphical abstraction of the paths.
Calculates the probabilities that randomly chosen paths
        pass through nodes. If 5 out of 100 paths (of any length) contain 
        node v, it will be assigned a value of 0.05. This measure can be 
        interpreted as path-based ground truth for the notion of importance 
        captured by PageRank applied to a graphical abstraction of the paths.
Calculates the probabilities that randomly chosen paths pass through nodes . If 5 out of 100 paths ( of any length ) contain node v it will be assigned a value of 0 . 05 . This measure can be interpreted as path - based ground truth for the notion of importance captured by PageRank applied to a graphical abstraction of the paths .
def VisitationProbabilities(self):
        """
        Calculates the probabilities that randomly chosen paths
        pass through nodes. If 5 out of 100 paths (of any length) contain 
        node v, it will be assigned a value of 0.05. This measure can be 
        interpreted as path-based ground truth for the notion of importance 
        captured by PageRank applied to a graphical abstraction of the paths.
        """

        Log.add('Calculating path visitation probabilities...', Severity.INFO)

        # entries capture the probability that a given node is visited on an arbitrary path
        # Note: this is identical to the subpath count of zero-length paths
        # (i.e. the relative frequencies of nodes across all pathways)
        visitation_probabilities = _co.defaultdict( lambda: 0 )

        # total number of visits
        visits = 0.0
        
        for l in self.paths:
            for p in self.paths[l]:
                for v in p:
                    # count occurrences in longest paths only!
                    visitation_probabilities[v] += float(self.paths[l][p][1])
                    visits += float(self.paths[l][p][1])

        for v in visitation_probabilities:
            visitation_probabilities[v] /= visits
                    

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

        return visitation_probabilities
def VisitationProbabilities ( self ) : Log . add ( 'Calculating path visitation probabilities...' , Severity . INFO ) # entries capture the probability that a given node is visited on an arbitrary path # Note: this is identical to the subpath count of zero-length paths # (i.e. the relative frequencies of nodes across all pathways) visitation_probabilities = _co . defaultdict ( lambda : 0 ) # total number of visits visits = 0.0 for l in self . paths : for p in self . paths [ l ] : for v in p : # count occurrences in longest paths only! visitation_probabilities [ v ] += float ( self . paths [ l ] [ p ] [ 1 ] ) visits += float ( self . paths [ l ] [ p ] [ 1 ] ) for v in visitation_probabilities : visitation_probabilities [ v ] /= visits Log . add ( 'finished.' , Severity . INFO ) return visitation_probabilities