Probability to visit nodes in a random walk on graph
Asked Answered
R

1

6

I have a finite undirected graph in which a node is marked as "start" and another is marked as "goal".

An agent is initially placed at the start node and it navigates through the graph randomly, i.e. at each step it chooses uniformly at random a neighbor node and moves to it. When it reaches the goal node it stops.

I am looking for an algorithm that, for each node, gives an indication about the probability that the agent visits it, while traveling from start to goal. Thank you.

Rook answered 11/3, 2013 at 2:43 Comment(3)
Have you read e.g. en.wikipedia.org/wiki/Random_walk#Random_walk_on_graphs?Fricke
Yes, but so far I haven't found an algorithm or an explanation of this particular problem. I found some books about probability in graphs, but it is a lot stuff and I am taking some time to look at it carefully, so any hint about where to look is appreciated.Rook
I think the current_flow_betweenness_centrality function of the NetworkX python library does what I want, but I can't get it work, as explained in this question [#15451789Rook
G
12

As is often the case with graphs, it's simply a matter of knowing an appropriate way to describe the problem.

One way of writing a graph is as an adjacency matrix. If your graph G = (V, E) has |V| nodes (where |V| is the number of vertices), the this matrix will be |V| x |V|. If an edge exists between a pair of vertices, you set the item in the adjacency matrix to 1, or 0 if it isn't present.

A natural extension of this is to weighted graphs. Here, rather than 0 or 1, the adjacency matrix has some notion of weight.

In the case you're describing, you have a weighted graph where the weights are the probability of transitioning from one node to another. This type of matrix has a special name, it is a stochastic matrix. Depending on how you've arranged your matrix, this matrix will have either rows or columns that sum to 1, right and left stochastic matrices respectively.

One link between stochastic matrices and graphs is Markov Chains. In Markov chain literature the critical thing you need to have is a transition matrix (the adjacency matrix with weights equal to the probability of transition after one time-step). Let's call the transition matrix P.

Working out the probability of transitioning from one state to another after k timesteps is given by P^k. If you have a known source state i, then the i-th row of P^k will give you the probability of transitioning to any other state. This gives you an estimate of the probability of being in a given state in the short term

Depending on your source graph, it may be that P^k reaches a steady state distribution - that is, P^k = P^(k+1) for some value of k. This gives you an estimate of the probability of being in a given state in the long term

As an aside, before you do any of this, you should be able to look at your graph, and say some things about what the probability of being in a given state is at some time.

  1. If your graph has disjoint components, the probability of being in a component that you didn't start in is zero.
  2. If your graph has some states that are absorbing, that is, some states (or groups of states) are inescapable once you've entered them, then you'll need to account for that. This may happen if your graph is tree-like.
Geodesic answered 20/3, 2013 at 13:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.