code: def test_greedy(self):
      cycle = nx_app.greedy_tsp(self.DG, source="D")
      cost = sum(
          self.DG[n][nbr]["weight"] for n, nbr in pairwise(cycle)
      )
      validate_solution(cycle, cost, ["D", "C", "B", "A", "D"], 31.0)
  
      cycle = nx_app.greedy_tsp(self.DG2, source="D")
      cost = sum(
          self.DG2[n][nbr]["weight"] for n, nbr in pairwise(cycle)
      )
      validate_solution(cycle, cost, ["D", "C", "B", "A", "D"], 78.0)
  
      cycle = nx_app.greedy_tsp(self.UG, source="D")
      cost = sum(
          self.UG[n][nbr]["weight"] for n, nbr in pairwise(cycle)
      )
      validate_solution(cycle, cost, ["D", "C", "B", "A", "D"], 33.0)
  
      cycle = nx_app.greedy_tsp(self.UG2, source="D")
      cost = sum(
          self.UG2[n][nbr]["weight"] for n, nbr in pairwise(cycle)
      )
      validate_solution(cycle, cost, ["D", "C", "A", "B", "D"], 27.0)
  
imports: import random
  import pytest
  import networkx
  import networkx.algorithms.approximation
label_desc: Use image node_id 1 for calling the TestGreedyTSP obj's underlying member method code with example usage: obj.test_greedy() without return types