code: def testGraphcomm(self):
      comm = self.COMM
      size = comm.Get_size()
      rank = comm.Get_rank()
      index, edges = [0], []
      for i in range(size):
          pos = index[-1]
          index.append(pos + 2)
          edges.append((i - 1) % size)
          edges.append((i + 1) % size)
      topo = comm.Create_graph(index[1:], edges)
      self.assertTrue(topo.is_topo)
      self.assertEqual(topo.topology, MPI.GRAPH)
      self.checkFortran(topo)
      topo.Free()
      topo = comm.Create_graph(index, edges)
      self.assertEqual(topo.dims, (len(index) - 1, len(edges)))
      self.assertEqual(topo.nnodes, len(index) - 1)
      self.assertEqual(topo.nedges, len(edges))
      self.assertEqual(topo.index, index[1:])
      self.assertEqual(topo.edges, edges)
      self.assertEqual(topo.topo, (index[1:], edges))
      neighbors = edges[index[rank] : index[rank + 1]]
      self.assertEqual(neighbors, topo.neighbors)
      self.assertEqual(len(neighbors), topo.nneighbors)
      for rank in range(size):
          neighs = topo.Get_neighbors(rank)
          self.assertEqual(
              neighs, [(rank - 1) % size, (rank + 1) % size]
          )
      self.assertEqual(topo.indegree, len(neighbors))
      self.assertEqual(topo.outdegree, len(neighbors))
      self.assertEqual(topo.inedges, neighbors)
      self.assertEqual(topo.outedges, neighbors)
      inedges, outedges = topo.inoutedges
      self.assertEqual(inedges, neighbors)
      self.assertEqual(outedges, neighbors)
      topo.Free()
  
imports: from mpi4py import MPI
  import mpiunittest
label_desc: Use image node_id 4 for calling the BaseTestTopo obj's underlying member method code with example usage: obj.testGraphcomm() without return types