Hi,

> V(g[[1]])$pagerank <- page.rank(g[[1]])$vector
> vertex_max_pagerank <- V(g[[1]])[pagerank == max( page.rank(g[[1]])$vector 
> )]$name
> 
> However, I am getting most of the sometimes NAs as result of the that script 
> while only a few run are giving meaningful vertex names.
Well, you are essentially calculating the PageRank twice. First you calculate 
it and store it in the "pagerank" vertex attribute in the first line. Then you 
calculate it again as an argument to the max() function in the second line. The 
results from the two calculations are likely to yield slightly different 
results due to numeric inaccuracies.

Also, consider using which.max() instead of max() in this particular use-case 
because which.max() would immediately give you the vertex indices where the 
maximum PageRank is attained.

-- 
T.
_______________________________________________
igraph-help mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/igraph-help

Reply via email to