code: def testDistgraphcommAdjacent(self):
      comm = self.COMM
      size = comm.Get_size()
      rank = comm.Get_rank()
      try:
          topo = comm.Create_dist_graph_adjacent(None, None)
          topo.Free()
      except NotImplementedError:
          self.skipTest("mpi-comm-create_dist_graph_adjacent")
      #
      sources = [(rank - 2) % size, (rank - 1) % size]
      destinations = [(rank + 1) % size, (rank + 2) % size]
      topo = comm.Create_dist_graph_adjacent(sources, destinations)
      self.assertTrue(topo.is_topo)
      self.assertEqual(topo.topology, MPI.DIST_GRAPH)
      self.checkFortran(topo)
      self.assertEqual(topo.Get_dist_neighbors_count(), (2, 2, False))
      self.assertEqual(
          topo.Get_dist_neighbors(), (sources, destinations, None)
      )
      self.assertEqual(topo.indegree, len(sources))
      self.assertEqual(topo.outdegree, len(destinations))
      self.assertEqual(topo.inedges, sources)
      self.assertEqual(topo.outedges, destinations)
      inedges, outedges = topo.inoutedges
      self.assertEqual(inedges, sources)
      self.assertEqual(outedges, destinations)
      topo.Free()
      #
      sourceweights = [1, 2]
      destweights = [3, 4]
      weights = (sourceweights, destweights)
      topo = comm.Create_dist_graph_adjacent(
          sources, destinations, sourceweights, destweights
      )
      self.assertEqual(topo.Get_dist_neighbors_count(), (2, 2, True))
      self.assertEqual(
          topo.Get_dist_neighbors(), (sources, destinations, weights)
      )
      topo.Free()
      #
      topo = comm.Create_dist_graph_adjacent(
          sources, None, MPI.UNWEIGHTED, None
      )
      self.assertEqual(topo.Get_dist_neighbors_count(), (2, 0, False))
      self.assertEqual(topo.Get_dist_neighbors(), (sources, [], None))
      topo.Free()
      topo = comm.Create_dist_graph_adjacent(
          None, destinations, None, MPI.UNWEIGHTED
      )
      self.assertEqual(topo.Get_dist_neighbors_count(), (0, 2, False))
      self.assertEqual(
          topo.Get_dist_neighbors(), ([], destinations, None)
      )
      topo.Free()
      if MPI.VERSION < 3:
          return
      topo = comm.Create_dist_graph_adjacent(
          [], [], MPI.WEIGHTS_EMPTY, MPI.WEIGHTS_EMPTY
      )
      self.assertEqual(topo.Get_dist_neighbors_count(), (0, 0, True))
      self.assertEqual(topo.Get_dist_neighbors(), ([], [], ([], [])))
      topo.Free()
  
imports: from mpi4py import MPI
  import mpiunittest
label_desc: Use image node_id 5 for calling the BaseTestTopo obj's underlying member method code with example usage: obj.testDistgraphcommAdjacent() without return types