This is a breadth-first all paths walk with possible multiple visits to a node
along the direction specified by dir
.
This is a breadth-first all paths walk with possible multiple visits to a node
along the direction specified by dir
.
All paths walk is a queue based walk, where each node adds all her neighbors to the queue and each node can be visited multiple times.
number of paths per node to keep track of
walk limits
a pair of elements
This is a breadth-first walk along the direction specified by dir
.
This is a breadth-first walk along the direction specified by dir
.
node to start the random walk from. These must exist in the graph.
walk limits
a sequence of visited nodes and depths of the visit (or empty sequence if startNodeId was not found in the graph)
Does a breadth-first-walk starting from startNodeId
using the walk
parameters specified in walkParams
.
Does a breadth-first-walk starting from startNodeId
using the walk
parameters specified in walkParams
. Returns a 2-tuple:
1. List of (node's id, the number of visits made to the node) sorted in decreasing
order of the number of visits, and
2. A mapping for a visited node with id V to the top paths leading to V
in the form of (P as a DirectedPath
, frequency of walking P).
Calculates the reputation of graph nodes personalized to a given node based on a random walk.
Calculates the reputation of graph nodes personalized to a given node based on a random walk.
the ids of the node to get personalized reputations for
the RandomWalkParams
random walk parameters
a 2-tuple:
DirectedPath
, frequency of walking P).
Assuming that the node stores both directions of edges, calculate the number of mutual edges incident on this node
Assuming that the node stores both directions of edges, calculate the number of mutual edges incident on this node
number of neighbors of node that have an edge to and from this node
the id of the node to count neighbors of
the direction of interest
number of neighbors (i.e., number of nodes 1 hop away) in dir
.
Warning: Lossy: Returns 0 if id is not found.
Do a random walk starting from the set of nodes with ids startNodeIds
.
Do a random walk starting from the set of nodes with ids startNodeIds
.
The walk maintains a count of the number of times that nodes have been visited
during the walk.
nodes to start the random walk from
the RandomWalkParams
random walk parameters
a tuple of two elements.
The first is a counter tracking a visited node's id to the number of visits to that node.
The second is a counter tracking a visited node's id to the paths visited while hitting
that node. The paths are sorted in decreasing order by occurrence
Each path is kept as a DirectedPath
.
This class contains some common graph utilities and convenience functions.