code: def test_to_markov_model(self):
      phi1 = DiscreteFactor(["a", "b"], [2, 2], np.random.rand(4))
      phi2 = DiscreteFactor(["b", "c"], [2, 2], np.random.rand(4))
      self.graph.add_edges_from(
          [("a", phi1), ("b", phi1), ("b", phi2), ("c", phi2)]
      )
      self.graph.add_factors(phi1, phi2)
      mm = self.graph.to_markov_model()
      self.assertIsInstance(mm, MarkovNetwork)
      self.assertListEqual(sorted(mm.nodes()), ["a", "b", "c"])
      self.assertListEqual(
          hf.recursive_sorted(mm.edges()), [["a", "b"], ["b", "c"]]
      )
      self.assertListEqual(
          sorted(mm.get_factors(), key=lambda x: x.scope()),
          [phi1, phi2],
      )
  
imports: import numpy
  import unittest
  from pgmpy.factors.discrete import DiscreteFactor
  from pgmpy.models import FactorGraph
  from pgmpy.models import MarkovNetwork
  from pgmpy.models import JunctionTree
  from pgmpy.tests import help_functions
label_desc: Use image node_id 7 for calling the TestFactorGraphMethods obj's underlying member method code with example usage: obj.test_to_markov_model() without return types