[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## Re: [igraph] NA results from maximum PageRank vertex names

**From**: |
Tamás Nepusz |

**Subject**: |
Re: [igraph] NA results from maximum PageRank vertex names |

**Date**: |
Thu, 1 Aug 2013 23:46:50 +0200 |

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.