code: def testRewire(self):
      # Undirected graph
      g = Graph.GRG(25, 0.4)
      degrees = g.degree()
  
      # Rewiring without loops
      g.rewire(10000)
      self.assertEqual(degrees, g.degree())
      self.assertTrue(g.is_simple())
  
      # Rewiring with loops (1)
      g.rewire(10000, mode="loops")
      self.assertEqual(degrees, g.degree())
      self.assertFalse(any(g.is_multiple()))
  
      # Rewiring with loops (2)
      g = Graph.Full(4)
      g[1, 3] = 0
      degrees = g.degree()
      g.rewire(100, mode="loops")
      self.assertEqual(degrees, g.degree())
      self.assertFalse(any(g.is_multiple()))
  
      # Directed graph
      g = Graph.GRG(25, 0.4)
      g.to_directed("mutual")
      indeg, outdeg = g.indegree(), g.outdegree()
      g.rewire(10000)
      self.assertEqual(indeg, g.indegree())
      self.assertEqual(outdeg, g.outdegree())
      self.assertTrue(g.is_simple())
  
      # Directed graph with loops
      g.rewire(10000, mode="loops")
      self.assertEqual(indeg, g.indegree())
      self.assertEqual(outdeg, g.outdegree())
      self.assertFalse(any(g.is_multiple()))
  
file_path: python-igraph/tests/test_games.py
imports: import unittest
  from igraph import Graph, InternalError, Layout
label_desc: Use image node_id 10 for calling the GameTests obj's underlying member method code with example usage: obj.testRewire() without return types