class_docstr: Select closest anchors as the nodes with the largest personalized page rank.
  
  .. seealso::
      http://web.stanford.edu/class/cs224w/slides/04-pagerank.pdf
class_docstr_tok: ["Select","closest","anchors","as","the","nodes","with","the","largest","personalized","page","rank",".","..","seealso",":",":","http",":","\/\/web.stanford.edu\/class\/cs224w\/slides\/04-pagerank.pdf"]
docstr: Sort anchors nodes by PPR values from each node.
  
  :param edge_index: shape: (2, m)
      the edge index.
  :param anchors: shape: `(num_anchors,)`
      the anchor IDs.
  
  :return: shape: `(num_entities, num_anchors)`
      the PPR values for each anchor
docstr_tok: ["Sort","anchors","nodes","by","PPR","values","from","each","node",".",":","param","edge_index",":","shape",":","(","2",",","m",")","the","edge","index",".",":","param","anchors",":","shape",":","`","(","num_anchors",",",")","`","the","anchor","IDs",".",":","return",":","shape",":","`","(","num_entities",",","num_anchors",")","`","the","PPR","values","for","each","anchor"]
code: def precalculate_anchor_ppr(
      self, edge_index: numpy.ndarray, anchors: numpy.ndarray
  ) -> numpy.ndarray:
      """
      Sort anchors nodes by PPR values from each node.
  
      :param edge_index: shape: (2, m)
          the edge index.
      :param anchors: shape: `(num_anchors,)`
          the anchor IDs.
  
      :return: shape: `(num_entities, num_anchors)`
          the PPR values for each anchor
      """
      return (
          torch.cat(
              [
                  ppr_batch.argsort(dim=-1)
                  for ppr_batch in self._iter_ppr(
                      edge_index=edge_index,
                      anchors=anchors,
                  )
              ]
          )
          .flip(-1)
          .cpu()
          .numpy()
      )
  
imports: import logging
  from abc import ABC, abstractmethod
  from typing import Iterable, Optional
  import numpy
  import scipy.sparse
  import torch
  from class_resolver import ClassResolver, OptionalKwargs
  from torch_ppr import page_rank
  from torch_ppr.utils import edge_index_to_sparse_matrix, prepare_page_rank_adjacency, prepare_x0
  from tqdm.auto import tqdm
  from .utils import ensure_num_entities
  from ...typing import DeviceHint
  from ...utils import ExtraReprMixin, format_relative_comparison, resolve_device
label_desc: Use image node_id 3 for calling the PersonalizedPageRankAnchorSearcher obj's underlying member method code with example usage: obj.precalculate_anchor_ppr(edge_index, anchors) and returns: torch