Open hrai opened 6 years ago
The library doesn't support weighted graphs explicitly but you can easily work around that. I'll assume you are using the weights as costs i.e. the more an edge is heavily weighted the less a random walker would want to take it.
In this case, you can simply take your weighted adjacency matrix A and create a corresponding transition matrix* T such that:
T[i, j] = 1/A[i, j] (or some similar formula kind of inverts the values)
And then pass this matrix to the algorithm and it will work just fine.
Note that if you actually intend for a random walker to prefer heavily weighted edges (which a doubt but it's possible!), then you can pass the matrix to the algorithm directly.
*T has actually to be normalized along the columns to be a real transition matrix, but this will be done internally so no worries.
I'm trying to implement this algorithm implementation on weighted graph.
Does the library support it? If yes, how can I use that feature?