Message Boards Message Boards

0
|
5049 Views
|
1 Reply
|
1 Total Likes
View groups...
Share
Share this post:

PageRankCentrality third argument problem --- 'not a valid parameter'

Posted 10 years ago
Hi,

I have an adjacency matrix, and I'm trying to compute the page rank centralities for the different nodes.
To do so, I first create the graph corresponding to my adjacency matrix, and then I run PageRankCentrality on that graph.
The function PageRankCentrality takes three arguments: the graph, a weight alpha, and an initial vector of centralities beta.
For the task that I'm working on, I need to use the parameters alpha=0.1, and beta={1,1,1...,1}. The problem I'm having is that Mathematica says my beta is not a valid parameter.
Without beta, it runs just fine, but I really need that beta for my calculations to be how I want them. In the documentation, it says nothing that as far as I can tell would indicate that my beta is wrong. I've tried both with just the number 1, and the vector of 1s (the documentation says both should work).

I've used the same graph to compute Katz centralities, with the same values for the parameters, without any trouble, but for some reason, PageRankCentrality is unhappy.
The lines I'm running are the following:
graph = AdjacencyGraph[m];
b = ConstantArray[1, 500];

pRA = PageRankCentrality[graph, 0.1, b];(where m is a 500x500 adjacency matrix). And the error reads:
PageRankCentrality::inv: The argument {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
,1,1,1,1,1,<<450>>} in PageRankCentrality[Graph[<500>, <2636>], 0.1, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, <<450>>}] is not a valid parameter. >>

Does anyone see what I'm doing wrong here? As I said, I've tried using beta as just a number, with the exact same error:
PageRankCentrality::inv: The argument 1 in PageRankCentrality[Graph[<500>, <2636>], 0.1, 1] is not a valid parameter. >>

Any help is greatly appreciated!
POSTED BY: Peder Bruusgaard
Posted 10 years ago
Your b needs to total 1. Try
b = ConstantArray[1/500, 500];
Total@b
instead.
According to the PageRankCentrality reference page the following evaluations are identical then:
PageRankCentrality[graph, 0.1, b]
PageRankCentrality[graph, 0.1, 0.002]
PageRankCentrality[graph, 0.1]
So unless you'd like the initial centralities to differ, the two-argument form will do.

Hope this helps.
POSTED BY: Peter Fleck
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract