# Confusion about ordering in output of PageRankCentrality

I'm doing a project in which I want to rank the nodes of a graph using page-rank centrality. The Mathematica documentation for PageRankCentrality is:

PageRankCentrality[g, α], gives a list of page-rank centralities for the vertices in the graph g and weight α.

For example, it may return something like: {0.04, 0.0012, 0.093}, where each element of the list is a centrality measure. My question is how do I figure out which nodes each of these centrality measures represents? In other words, how would I figure out if node 1, 2, or 3 is the node that corresponds to 0.04, 0.0012, or 0.093?

Thank you so much!

• They are ordered by VertexIndex, i.e., 1, 2, 3, ... Commented Jan 12, 2021 at 6:34

All functions that returns values that characterize vertices return them in the same order as VertexList.

If you want to get an association between vertices and centralities, you could use something similar to

g = Graph[{2 <-> 1, 3 <-> 2}];


As you can see here, the vertex names (which happen to be integers here) are not the same as the vertex indices, i.e. the position of vertices in VertexList.