code: def test_pagerank(self, alg):
      G = self.G
      p = alg(G, alpha=0.9, tol=1.0e-08)
      for n in G:
          assert p[n] == pytest.approx(G.pagerank[n], abs=1e-4)
  
      nstart = {n: random.random() for n in G}
      p = alg(G, alpha=0.9, tol=1.0e-08, nstart=nstart)
      for n in G:
          assert p[n] == pytest.approx(G.pagerank[n], abs=1e-4)
  
imports: import random
  import pytest
  import networkx
  from networkx.classes.tests import dispatch_interface
  from networkx.algorithms.link_analysis.pagerank_alg import _pagerank_numpy, _pagerank_python, _pagerank_scipy
label_desc: Use image node_id 2 for calling the TestPageRank obj's underlying member method code with example usage: obj.test_pagerank(alg) without return types