Sorting dataset based on the nodes' page rank values #3004
Unanswered
OliverSummers
asked this question in
Q&A
Replies: 1 comment 2 replies
-
Sorting of the inner lists is not really necessary, but if you want to do that I suggest iterating over each page rank value and sorting the list of node indices manually, e.g.,: for k, v in dict_inx.items():
dict_inx[k] = sorted(v) |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I asked a similar question in another post, and according to the provided answer to sort the Planetoid dataset based on nodes'
PageRank
, I coded as follows:Then I check the transformed dataset to see if it is sorted based on the nodes' PageRank. The following snippet prints out the indices of the consecutive nodes with the same
PageRank
values:The output of the above snippet is:
where the number before
:
isPageRank
and the tuple after:
denotes indices of all nodes with the samePageRank
.As we can see, the page ranks are sorted in ascending order but their corresponding indices are not sorted. If all of the above code is written based on the nodes'
degree
values then the final output will be:where the number before
:
isdegree
and the tuple after:
refers to the nodes' indices with the samedegree
values.So as we can see, the results with the sorted dataset based on
degree
values are perfect. Both degrees and indices are sorted ascendingly but as I explained above, it is not the case withPageRank
.My question is how to fix the problem of the
PageRank
code?Beta Was this translation helpful? Give feedback.
All reactions